Table of Contents

Class DbPath

Namespace
RocksDbNet
Assembly
RocksDb.Net.dll

One directory a database may store data in, with a size target. Maps to rocksdb_dbpath_t.

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

Remarks

Used with SetDbPaths(IReadOnlyList<DbPath>) to spread a database across several directories. The usual reason is mixed storage: give a fast device a modest target so the newest, hottest levels live there, and let the rest overflow onto slower, larger media.

The target is advisory. RocksDb fills each path up to its target in order and then moves on, so the last path should be the one with room to spare.

Constructors

DbPath(string, ulong)

Creates a path entry.

public DbPath(string path, ulong targetSizeBytes)

Parameters

path string

Directory to store data in.

targetSizeBytes ulong

How much data to place here before moving to the next path. Zero means no limit, which only makes sense for the last entry.

Remarks

The validation is in the body rather than folded into a base-constructor argument. Throwing from there would leave an allocated object whose base constructor never ran, with every inherited field at its default, and the finalizer still runs on that.

Properties

Path

The directory this entry names.

public string Path { get; }

Property Value

string

TargetSizeBytes

How much data to place here before using the next path.

public ulong TargetSizeBytes { get; }

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().