Package org.apache.cassandra.io.sstable
Interface KeyReader
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
BigTableKeyReader
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 TypeMethodDescriptionbooleanadvance()Moves the iterator forward.voidclose()Closes the iterator quietlylongPosition in the data file where the associated content residesbooleanReturns true if we reach EOFkey()Current keylongPosition in the component preferred for reading keys.voidreset()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
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
Resets the iterator to the initial position- Throws:
IOException
-
close
void close()Closes the iterator quietly- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-