Package org.apache.cassandra.io.util
Interface ChunkReader
- All Superinterfaces:
AutoCloseable,ReaderFileProxy,RebuffererFactory
- All Known Implementing Classes:
CompressedChunkReader,CompressedChunkReader.Mmap,CompressedChunkReader.Standard
RandomFileReader component that reads data from a file into a provided buffer and may have requirements over the
size and alignment of reads.
A caching or buffer-managing rebufferer will reference one of these to do the actual reading.
Note: Implementations of this interface must be thread-safe!
-
Method Summary
Modifier and TypeMethodDescriptionintBuffer size required for this rebufferer.Specifies type of buffer the caller should attempt to give.voidreadChunk(long position, ByteBuffer buffer) Read the chunk at the given position, attempting to fill the capacity of the given buffer.default voidMethods inherited from interface org.apache.cassandra.io.util.ReaderFileProxy
channel, close, fileLength, getCrcCheckChanceMethods inherited from interface org.apache.cassandra.io.util.RebuffererFactory
instantiateRebufferer
-
Method Details
-
readChunk
Read the chunk at the given position, attempting to fill the capacity of the given buffer. The filled buffer must be positioned at 0, with limit set at the size of the available data. The source may have requirements for the positioning and/or size of the buffer (e.g. chunk-aligned and chunk-sized). These must be satisfied by the caller. -
chunkSize
int chunkSize()Buffer size required for this rebufferer. Must be power of 2 if alignment is required. -
preferredBufferType
BufferType preferredBufferType()Specifies type of buffer the caller should attempt to give. This is not guaranteed to be fulfilled. -
releaseUnderlyingResources
default void releaseUnderlyingResources()
-