Package org.apache.cassandra.io.sstable
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()
anddataPosition()
should return approriate values. If there is no data,isExhausted()
returnstrue
. In order to move to the next key,advance()
should be called. It returnstrue
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 ofkey()
,keyPositionForSecondaryIndex()
anddataPosition()
are undefined.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
advance()
Moves the iterator forward.void
close()
Closes the iterator quietlylong
dataPosition()
Position in the data file where the associated content residesboolean
isExhausted()
Returns true if we reach EOFjava.nio.ByteBuffer
key()
Current keylong
keyPositionForSecondaryIndex()
Position in the component preferred for reading keys.void
reset()
Resets the iterator to the initial position
-
-
-
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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-