DB

LevelDB DB

Constructors

this
this()

Create a new unconnected DB

this
this(Options opt, string path)

Opens a new connection to a levelDB database on creation

Destructor

~this
~this()

Force database to close on destruction, cleans up library memory

Members

Classes

Iterator
class Iterator

DB Iterator

Snapshot
class Snapshot

DB Snapshot

Functions

del
void del(in T key, const(WriteOptions) opt = DefaultWriteOptions)

Deletes a key from the db

find
V find(in K key, V def, const(ReadOptions) opt = DefaultReadOptions)

finds an entry in the db or returns the default value Example

get
bool get(in T key, out V value, const(ReadOptions) opt = DefaultReadOptions)

Gets an entry from the DB

get_slice
auto get_slice(T key, const(ReadOptions) opt = DefaultReadOptions)

Gets an entry from the DB as a Slice.

opApply
int opApply(int delegate(Slice) dg)

Short cut iterator, treate the db like an iterator

open
void open(Options opt, string path)

Opens a new connection to a levelDB database

put
void put(in K key, in V val, const(WriteOptions) opt = DefaultWriteOptions)

Inserts/Updates a given value at a given key.

write
void write(const(WriteBatch) batch, const(WriteOptions) opt = DefaultWriteOptions)

Sublmits a BatchWrite to the DB.

Properties

close
void close [@property getter]

Close DB connection, also frees _db pointer in leveldb lib

isOpen
bool isOpen [@property getter]

Tests if the database is open

snapshot
ASnapshot snapshot [@property getter]

Returns a readonly snapshot

Static functions

destroyDB
void destroyDB(const Options opt, string path)

Destory/delete a non-locked leveldb

repairDB
void repairDB(const Options opt, string path)

Attempt to repair a non-locked leveldb

Throws

LeveldbException on errors

Meta