Skip to main content
Published
Sep 29, 2026
20d ago
Total Downloads
1.4M
1,449,256

Install

dotnet add package Nethermind.RocksDbBindings --version 11.8.1-preview.140
ProductVersions
.NET
net10.0

README

RocksDB bindings

Tests Nethermind.RocksDbBindings

C# bindings for RocksDB.

Async reads

GetAsync and MultiGetAsync follow the results and error handling of Get and MultiGet. Keys are copied during submission. Read options must not be mutated until completion; disposing the database, read options or snapshot defers their native release until outstanding reads finish.

byte[]? value = await db.GetAsync(key);
KeyValuePair<byte[], byte[]?>[] values = await db.MultiGetAsync(keys);

GetAsync<T> accepts the existing ISpanDeserializer<T> and deserializes directly from native memory without copying the value into a managed byte array. For struct deserializers, use GetAsync<T, TDeserializer> to avoid boxing:

int value = await db.GetAsync<int, Int32Deserializer>(key, default);

readonly struct Int32Deserializer : ISpanDeserializer<int>
{
    public int Deserialize(ReadOnlySpan<byte> buffer)
        => System.Buffers.Binary.BinaryPrimitives.ReadInt32LittleEndian(buffer);
}

Missing keys return default(T) without invoking the deserializer. Deserialization runs on a thread-pool thread; shared deserializers must support concurrent calls. The span is valid only during Deserialize. Single reads use pooled completions: consume each returned ValueTask once, or call AsTask() once to share the result.

The API is the same on every platform. Linux builds enable RocksDB's native coroutine reads using Folly and io_uring. Windows, macOS and filesystems without a read executor use RocksDB's synchronous fallback, which can block during submission. DbOptions.SetReadIoExecutorThreads configures the shared executor on supported builds. This API does not cancel submitted reads.

License

This project is licensed under the MIT license.

Parts of the managed API were originally derived from rocksdb-sharp, used under BSD-2-Clause, and have since been substantially rewritten.

The package also ships prebuilt RocksDB binaries, used under the Apache-2.0 option of RocksDB's dual Apache-2.0/GPL-2.0 license. Those binaries statically link LZ4, Snappy, Zstandard, and, on Linux, jemalloc, Folly and its dependencies.

Changes from Previous Version

No structural changes between v11.8.1-preview.92 and v11.8.1-preview.140.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.