Description

A D binding to rocksdb

Package Information

Version0.0.7 (2017-Feb-12)
Repositoryhttps://github.com/b1naryth1ef/rocksdb
LicenseMIT
AuthorsAndrei Zbikowski <b1naryth1ef@gmail.com>
Registered byAndrei Z
Dependenciesnone

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

RocksDB D-Lang

A straightforward binding to RocksDB v5.0.1 in D-lang.

Building

You need a valid rocksdb library somewhere your linker can find it.

Example

import rocksdb;
import std.conv : to;

auto opts = new DBOptions;
opts.createIfMissing = true;
opts.errorIfExists = false;

auto db = new Database(opts, "testdb");

// Put a value into the database
db.put("key", "value");

// Get a value out
assert(db.get("key") == "value");

// Delete a value
db.remove("key");

// Add values in bulk
auto batch = new WriteBatch;
for (int i = 0; i < 1000; i++) {
  batch.put(i.to!string, i.to!string);
}
db.write(batch);

// Iterate over the DB
auto iter = db.iter();
foreach (key, value; iter) {
  db.remove(key);
}
destroy(iter);

// Close the database
db.close();

Available versions

0.0.7 0.0.6 0.0.5 0.0.4 0.0.3 0.0.2 0.0.1 ~master ~feature/column-families