Package org.apache.cassandra.io.util
Class FileHandle.Builder
java.lang.Object
org.apache.cassandra.io.util.FileHandle.Builder
- Enclosing class:
- FileHandle
Configures how the file will be read (compressed, mmapped, use cache etc.)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbufferSize(int bufferSize) Set the buffer size to use (if appropriate).bufferType(BufferType bufferType) Set the buffer type (on heap or off heap) to use (if appropriate).complete()Complete buildingFileHandle.complete(Function<File, ChannelProxy> channelProxyFactory) mmapped(boolean mmapped) Set whether to use mmap for readingmmapped(Config.DiskAccessMode diskAccessMode) withChunkCache(ChunkCache chunkCache) SetChunkCacheto use.withCompressionMetadata(CompressionMetadata metadata) ProvideCompressionMetadatato use when reading compressed file.withCrcCheckChance(Supplier<Double> crcCheckChanceSupplier) withLengthOverride(long lengthOverride) Override the file length.withMmappedRegionsCache(MmappedRegionsCache mmappedRegionsCache)
-
Field Details
-
NO_LENGTH_OVERRIDE
public static final long NO_LENGTH_OVERRIDE- See Also:
-
file
-
-
Constructor Details
-
Builder
-
-
Method Details
-
withChunkCache
SetChunkCacheto use.- Parameters:
chunkCache- ChunkCache object to use for caching- Returns:
- this object
-
withCompressionMetadata
ProvideCompressionMetadatato use when reading compressed file. Upon completion, builder will create a shared copy of this object and that copy will be used in the created instance ofFileHandle. Therefore, the caller is responsible for closing the instance ofCompressionMetadatapassed to this method after builder completion.- Parameters:
metadata- CompressionMetadata to use, can benullif no compression is used- Returns:
- this object
-
withCrcCheckChance
-
mmapped
Set whether to use mmap for reading- Parameters:
mmapped- true if using mmap- Returns:
- this instance
-
mmapped
-
withMmappedRegionsCache
-
bufferSize
Set the buffer size to use (if appropriate).- Parameters:
bufferSize- Buffer size in bytes- Returns:
- this instance
-
bufferType
Set the buffer type (on heap or off heap) to use (if appropriate).- Parameters:
bufferType- Buffer type to use- Returns:
- this instance
-
withLengthOverride
Override the file length.- Parameters:
lengthOverride- Override file length (in bytes) so that read cannot go further than this value. If the value is less than or equal to 0, then the value is ignored.- Returns:
- Built file
-
complete
Complete buildingFileHandle. -
complete
-