Class SparseJournalIndex

java.lang.Object
io.atomix.storage.journal.index.SparseJournalIndex
All Implemented Interfaces:
JournalIndex

public final class SparseJournalIndex extends Object implements JournalIndex
A JournalIndex maintaining target density.
  • Constructor Details

    • SparseJournalIndex

      public SparseJournalIndex()
    • SparseJournalIndex

      public SparseJournalIndex(double density)
  • Method Details

    • index

      public Position index(long index, int position)
      Description copied from interface: JournalIndex
      Adds an entry for the given index at the given position.
      Specified by:
      index in interface JournalIndex
      Parameters:
      index - the index for which to add the entry
      position - the position of the given index
      Returns:
      A Position
    • last

      public Position last()
      Description copied from interface: JournalIndex
      Return the last position known to this index.
      Specified by:
      last in interface JournalIndex
      Returns:
      the last position known to this index
    • lookup

      public Position lookup(long index)
      Description copied from interface: JournalIndex
      Looks up the position of the given index.
      Specified by:
      lookup in interface JournalIndex
      Parameters:
      index - the index to lookup
      Returns:
      the position of the given index or a lesser index, or null
    • truncate

      public Position truncate(long index)
      Description copied from interface: JournalIndex
      Truncates the index to the given index and returns its position, if available.
      Specified by:
      truncate in interface JournalIndex
      Parameters:
      index - the index to which to truncate the index, or null
      Returns:
      the position of the given index or a lesser index, or null
    • toString

      public String toString()
      Overrides:
      toString in class Object