Table of Contents

Class EnvOptions

Namespace
RocksDbNet
Assembly
RocksDb.Net.dll

Options for configuring the RocksDb environment used by SstFileWriter.

public sealed class EnvOptions : RocksDbHandle, IDisposable
Inheritance
EnvOptions
Implements
Inherited Members

Remarks

Pass an instance to Create(EnvOptions, DbOptions). The values are read when the writer is created, so changing them afterwards has no effect on an existing writer.

Constructors

EnvOptions()

public EnvOptions()

Properties

AllowFallocate

If true, file space is preallocated with fallocate. Turn this off on filesystems where preallocation is expensive or unsupported.

public bool AllowFallocate { get; set; }

Property Value

bool

BytesPerSync

Ask the operating system to flush this many bytes at a time while writing, which smooths out I/O instead of letting it burst. 0 disables it.

public ulong BytesPerSync { get; set; }

Property Value

ulong

CompactionReadaheadSize

Readahead size in bytes used for compaction reads. 0 lets RocksDb choose.

public ulong CompactionReadaheadSize { get; set; }

Property Value

ulong

FallocateWithKeepSize

If true, preallocation keeps the reported file size rather than extending it, so the file does not appear larger than the data written.

public bool FallocateWithKeepSize { get; set; }

Property Value

bool

FdCloexec

If true, file descriptors are opened close-on-exec, so a child process does not inherit them.

public bool FdCloexec { get; set; }

Property Value

bool

StrictBytesPerSync

If true, BytesPerSync is a hard limit rather than a hint, giving more predictable I/O at some cost in throughput.

public bool StrictBytesPerSync { get; set; }

Property Value

bool

UseDirectReads

If true, reads bypass the operating system page cache. Saves memory when the data will not be read again, and costs performance when it would.

public bool UseDirectReads { get; set; }

Property Value

bool

UseDirectWrites

If true, writes bypass the operating system page cache.

public bool UseDirectWrites { get; set; }

Property Value

bool

UseMmapReads

If true, files are read through a memory mapping.

public bool UseMmapReads { get; set; }

Property Value

bool

UseMmapWrites

If true, files are written through a memory mapping.

public bool UseMmapWrites { get; set; }

Property Value

bool

WritableFileMaxBufferSize

Maximum size in bytes of the buffer used for writable files.

public ulong WritableFileMaxBufferSize { get; set; }

Property Value

ulong

Methods

DisposeHandle()

Releases the native handle. Called during disposal.

protected override void DisposeHandle()

Remarks

Protected rather than public: it destroys the native object without marking this instance disposed or clearing the handle, so calling it from outside and then disposing normally would free the same pointer twice. It was the most Dispose-looking member on the type. Callers want Dispose().

SetRateLimiter(RateLimiter?)

Throttles the I/O these options govern.

public EnvOptions SetRateLimiter(RateLimiter? rateLimiter)

Parameters

rateLimiter RateLimiter

Returns

EnvOptions

Remarks

Write-only, because the C API offers no getter. RocksDb copies the shared pointer rather than taking ownership, so the caller keeps responsibility for disposing rateLimiter and must keep it alive for as long as these options are in use.