Interface KeyReader

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
BigTableKeyReader

public interface KeyReader extends Closeable
Reads keys from an SSTable.

It is specific to SSTable format how the keys are read but in general the assumption is that it will read all the keys in the order as they are placed in data file.

After creating it, it should be at the first key. Unless the SSTable is empty, key(), keyPositionForSecondaryIndex() and dataPosition() should return approriate values. If there is no data, isExhausted() returns true. In order to move to the next key, advance() should be called. It returns true if the reader moved to the next key; otherwise, there is no more data to read and the reader is exhausted. When the reader is exhausted, return values of key(), keyPositionForSecondaryIndex() and dataPosition() are undefined.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Moves the iterator forward.
    void
    Closes the iterator quietly
    long
    Position in the data file where the associated content resides
    boolean
    Returns true if we reach EOF
    key()
    Current key
    long
    Position in the component preferred for reading keys.
    void
    Resets the iterator to the initial position
  • Method Details

    • key

      ByteBuffer key()
      Current key
    • keyPositionForSecondaryIndex

      long keyPositionForSecondaryIndex()
      Position in the component preferred for reading keys. This is specific to SSTable implementation
    • dataPosition

      long dataPosition()
      Position in the data file where the associated content resides
    • advance

      boolean advance() throws IOException
      Moves the iterator forward. Returns false if we reach EOF and there nothing more to read
      Throws:
      IOException
    • isExhausted

      boolean isExhausted()
      Returns true if we reach EOF
    • reset

      void reset() throws IOException
      Resets the iterator to the initial position
      Throws:
      IOException
    • close

      void close()
      Closes the iterator quietly
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable