Package org.rocksdb
Class EnvOptions
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class EnvOptions extends RocksObject
Options while opening a file to read/write
-
-
Field Summary
-
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_
-
Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_
-
-
Constructor Summary
Constructors Constructor Description EnvOptions()Construct with default OptionsEnvOptions(DBOptions dbOptions)Construct fromDBOptions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanallowFallocate()Determine if fallocate calls are used.longbytesPerSync()Get the number of incremental bytes per sync written in the background.longcompactionReadaheadSize()protected voiddisposeInternal(long handle)booleanfallocateWithKeepSize()Determine if file is preallocated.longrandomAccessMaxBufferSize()RateLimiterrateLimiter()Get the write rate limiter for flush and compaction.EnvOptionssetAllowFallocate(boolean allowFallocate)Enable/Disable fallocate calls.EnvOptionssetBytesPerSync(long bytesPerSync)Allows OS to incrementally sync files to disk while they are being written, in the background.EnvOptionssetCompactionReadaheadSize(long compactionReadaheadSize)EnvOptionssetFallocateWithKeepSize(boolean fallocateWithKeepSize)If true, we will preallocate the file withFALLOC_FL_KEEP_SIZEflag, which means that file size won't change as part of preallocation.booleansetFdCloexec()Determine i ftheFD_CLOEXECbit is set when opening file descriptors.EnvOptionssetRandomAccessMaxBufferSize(long randomAccessMaxBufferSize)EnvOptionssetRateLimiter(RateLimiter rateLimiter)Set the write rate limiter for flush and compaction.EnvOptionssetSetFdCloexec(boolean setFdCloexec)Enable/Disable theFD_CLOEXECbit when opening file descriptors.EnvOptionssetUseDirectReads(boolean useDirectReads)Enable/Disable direct reads, i.e.EnvOptionssetUseDirectWrites(boolean useDirectWrites)Enable/Disable direct writes, i.e.EnvOptionssetUseMmapReads(boolean useMmapReads)Enable/Disable memory mapped reads.EnvOptionssetUseMmapWrites(boolean useMmapWrites)Enable/Disable memory mapped Writes.EnvOptionssetWritableFileMaxBufferSize(long writableFileMaxBufferSize)booleanuseDirectReads()Determine if direct reads are in-use.booleanuseDirectWrites()Determine if direct writes are in-use.booleanuseMmapReads()Determine if memory mapped reads are in-use.booleanuseMmapWrites()Determine if memory mapped writes are in-use.longwritableFileMaxBufferSize()-
Methods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandle
-
Methods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Methods inherited from class org.rocksdb.AbstractNativeReference
dispose, finalize
-
-
-
-
Method Detail
-
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 theFD_CLOEXECbit when opening file descriptors. Default: true- Parameters:
setFdCloexec- true to enable theFB_CLOEXECbit, false to disable.- Returns:
- the reference to these options.
-
setFdCloexec
public boolean setFdCloexec()
Determine i ftheFD_CLOEXECbit is set when opening file descriptors.- Returns:
- true if the
FB_CLOEXECbit 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 everybytesPerSyncwritten. 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 withFALLOC_FL_KEEP_SIZEflag, 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:
disposeInternalin classRocksObject
-
-