Home

Awesome

Build Status Nuget

<a href="https://curiosity.ai"><img src="https://curiosity.ai/media/cat.color.square.svg" width="100" height="100" align="right" /></a>

rocksdb-sharp is a C# binding for Facebook's RocksDB, based on the original work from @warrenfalk. This fork from the original repository has been modified to keep in sync with the latest release from Facebook, and will automatically re-built on new RocksDB releases using Azure Pipelines.

RocksDb for C#

RocksDB is a key-value database with a log-structured-merge design, optimized for flash and RAM storage, which can be tuned to balance write-, read-, and space-amplification factors.

RocksDB is developed by Facebook and is based on LevelDB. For more information about RocksDB, visit RocksDB and on GitHub

This library provides C# bindings for rocksdb, implemented as a wrapper for the native rocksdb DLL (unmanaged C++) via the rocksdb C API.

This is a multi-level binding, providing direct access to the C API functions (low level) plus some helper wrappers on those to aid in marshaling and exception handling (mid level) plus an idiomatic C# class hierarchy for ease of use (high level).

Example (High Level)

var options = new DbOptions()
    .SetCreateIfMissing(true);
using (var db = RocksDb.Open(options, path))
{
    // Using strings below, but can also use byte arrays for both keys and values
    db.Put("key", "value");
    string value = db.Get("key");
    db.Remove("key");
}

Usage

Using NuGet:

Nuget

install-package RocksDb

The version of the NuGet package is set to follow the official RocksDB version, with the last 4 numbers representing the build number on Azure - i.e. NuGet version 6.7.3.6120 corresponds to release v6.7.3

This will install the managed library and the correct version of the unmanaged library depending on your operating system. The native64-bit library is automatically built for each official RocksDB release, for Windows, Linux and MacOS, and is included in the package by default.