Package org.rocksdb

Class EnvOptions

All Implemented Interfaces:
AutoCloseable

public class EnvOptions extends RocksObject
Options while opening a file to read/write
  • Constructor Details

    • EnvOptions

      public EnvOptions()
      Construct with default Options
    • EnvOptions

      public EnvOptions(DBOptions dbOptions)
      Construct from DBOptions.
      Parameters:
      dbOptions - the database options.
  • Method Details

    • setUseMmapReads

      public EnvOptions setUseMmapReads(boolean useMmapReads)
      Enable/Disable memory mapped reads.

      Default: false

      Parameters:
      useMmapReads - true to enable memory mapped reads, false to disable.
      Returns:
      the reference to these options.
    • useMmapReads

      public boolean useMmapReads()
      Determine if memory mapped reads are in-use.
      Returns:
      true if memory mapped reads are in-use, false otherwise.
    • setUseMmapWrites

      public EnvOptions setUseMmapWrites(boolean useMmapWrites)
      Enable/Disable memory mapped Writes.

      Default: true

      Parameters:
      useMmapWrites - true to enable memory mapped writes, false to disable.
      Returns:
      the reference to these options.
    • useMmapWrites

      public boolean useMmapWrites()
      Determine if memory mapped writes are in-use.
      Returns:
      true if memory mapped writes are in-use, false otherwise.
    • setUseDirectReads

      public EnvOptions setUseDirectReads(boolean useDirectReads)
      Enable/Disable direct reads, i.e. O_DIRECT.

      Default: false

      Parameters:
      useDirectReads - true to enable direct reads, false to disable.
      Returns:
      the reference to these options.
    • useDirectReads

      public boolean useDirectReads()
      Determine if direct reads are in-use.
      Returns:
      true if direct reads are in-use, false otherwise.
    • setUseDirectWrites

      public EnvOptions setUseDirectWrites(boolean useDirectWrites)
      Enable/Disable direct writes, i.e. O_DIRECT.

      Default: false

      Parameters:
      useDirectWrites - true to enable direct writes, false to disable.
      Returns:
      the reference to these options.
    • useDirectWrites

      public boolean useDirectWrites()
      Determine if direct writes are in-use.
      Returns:
      true if direct writes are in-use, false otherwise.
    • setAllowFallocate

      public EnvOptions setAllowFallocate(boolean allowFallocate)
      Enable/Disable fallocate calls.

      Default: true

      If false, fallocate() calls are bypassed.

      Parameters:
      allowFallocate - true to enable fallocate calls, false to disable.
      Returns:
      the reference to these options.
    • allowFallocate

      public boolean allowFallocate()
      Determine if fallocate calls are used.
      Returns:
      true if fallocate calls are used, false otherwise.
    • setSetFdCloexec

      public EnvOptions setSetFdCloexec(boolean setFdCloexec)
      Enable/Disable the FD_CLOEXEC bit when opening file descriptors.

      Default: true

      Parameters:
      setFdCloexec - true to enable the FB_CLOEXEC bit, false to disable.
      Returns:
      the reference to these options.
    • setFdCloexec

      public boolean setFdCloexec()
      Determine i fthe FD_CLOEXEC bit is set when opening file descriptors.
      Returns:
      true if the FB_CLOEXEC bit is enabled, false otherwise.
    • setBytesPerSync

      public EnvOptions setBytesPerSync(long bytesPerSync)
      Allows OS to incrementally sync files to disk while they are being written, in the background. Issue one request for every bytesPerSync written.

      Default: 0

      Parameters:
      bytesPerSync - 0 to disable, otherwise the number of bytes.
      Returns:
      the reference to these options.
    • bytesPerSync

      public long bytesPerSync()
      Get the number of incremental bytes per sync written in the background.
      Returns:
      0 if disabled, otherwise the number of bytes.
    • setFallocateWithKeepSize

      public EnvOptions setFallocateWithKeepSize(boolean fallocateWithKeepSize)
      If true, we will preallocate the file with FALLOC_FL_KEEP_SIZE flag, which means that file size won't change as part of preallocation. If false, preallocation will also change the file size. This option will improve the performance in workloads where you sync the data on every write. By default, we set it to true for MANIFEST writes and false for WAL writes
      Parameters:
      fallocateWithKeepSize - true to preallocate, false otherwise.
      Returns:
      the reference to these options.
    • fallocateWithKeepSize

      public boolean fallocateWithKeepSize()
      Determine if file is preallocated.
      Returns:
      true if the file is preallocated, false otherwise.
    • setCompactionReadaheadSize

      public EnvOptions setCompactionReadaheadSize(long compactionReadaheadSize)
      Parameters:
      compactionReadaheadSize - the compaction read-ahead size.
      Returns:
      the reference to these options.
    • compactionReadaheadSize

      public long compactionReadaheadSize()
      Returns:
      the compaction read-ahead size.
    • setRandomAccessMaxBufferSize

      public EnvOptions setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize)
      Parameters:
      randomAccessMaxBufferSize - the max buffer size for random access.
      Returns:
      the reference to these options.
    • randomAccessMaxBufferSize

      public long randomAccessMaxBufferSize()
      Returns:
      the max buffer size for random access.
    • setWritableFileMaxBufferSize

      public EnvOptions setWritableFileMaxBufferSize(long writableFileMaxBufferSize)
      Parameters:
      writableFileMaxBufferSize - the max buffer size.
      Returns:
      the reference to these options.
    • writableFileMaxBufferSize

      public long writableFileMaxBufferSize()
      Returns:
      the max buffer size.
    • setRateLimiter

      public EnvOptions setRateLimiter(RateLimiter rateLimiter)
      Set the write rate limiter for flush and compaction.
      Parameters:
      rateLimiter - the rate limiter.
      Returns:
      the reference to these options.
    • rateLimiter

      public RateLimiter rateLimiter()
      Get the write rate limiter for flush and compaction.
      Returns:
      the rate limiter.
    • disposeInternal

      protected final void disposeInternal(long handle)
      Specified by:
      disposeInternal in class RocksObject