Class FileHandle.Builder

java.lang.Object
org.apache.cassandra.io.util.FileHandle.Builder
Enclosing class:
FileHandle

public static class FileHandle.Builder extends Object
Configures how the file will be read (compressed, mmapped, use cache etc.)
  • Field Details

    • NO_LENGTH_OVERRIDE

      public static final long NO_LENGTH_OVERRIDE
      See Also:
    • file

      public final File file
  • Constructor Details

    • Builder

      public Builder(File file)
  • Method Details

    • withChunkCache

      public FileHandle.Builder withChunkCache(ChunkCache chunkCache)
      Set ChunkCache to use.
      Parameters:
      chunkCache - ChunkCache object to use for caching
      Returns:
      this object
    • withCompressionMetadata

      public FileHandle.Builder withCompressionMetadata(CompressionMetadata metadata)
      Provide CompressionMetadata to 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 of FileHandle. Therefore, the caller is responsible for closing the instance of CompressionMetadata passed to this method after builder completion.
      Parameters:
      metadata - CompressionMetadata to use, can be null if no compression is used
      Returns:
      this object
    • withCrcCheckChance

      public FileHandle.Builder withCrcCheckChance(Supplier<Double> crcCheckChanceSupplier)
    • mmapped

      public FileHandle.Builder mmapped(boolean mmapped)
      Set whether to use mmap for reading
      Parameters:
      mmapped - true if using mmap
      Returns:
      this instance
    • mmapped

      public FileHandle.Builder mmapped(Config.DiskAccessMode diskAccessMode)
    • withMmappedRegionsCache

      public FileHandle.Builder withMmappedRegionsCache(MmappedRegionsCache mmappedRegionsCache)
    • bufferSize

      public FileHandle.Builder bufferSize(int bufferSize)
      Set the buffer size to use (if appropriate).
      Parameters:
      bufferSize - Buffer size in bytes
      Returns:
      this instance
    • bufferType

      public FileHandle.Builder bufferType(BufferType bufferType)
      Set the buffer type (on heap or off heap) to use (if appropriate).
      Parameters:
      bufferType - Buffer type to use
      Returns:
      this instance
    • withLengthOverride

      public FileHandle.Builder withLengthOverride(long lengthOverride)
      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

      public FileHandle complete()
      Complete building FileHandle.
    • complete

      public FileHandle complete(Function<File,ChannelProxy> channelProxyFactory)