Interface KeyReader

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
    All Known Implementing Classes:
    BigTableKeyReader

    public interface KeyReader
    extends java.io.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 Detail

      • key

        java.nio.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 java.io.IOException
        Moves the iterator forward. Returns false if we reach EOF and there nothing more to read
        Throws:
        java.io.IOException
      • isExhausted

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

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

        void close()
        Closes the iterator quietly
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable