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(T key, const(WriteOptions) opt)

Deletes a key from the db

find
V find(K key, V def, const(ReadOptions) opt)

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

get
bool get(T key, V value, const(ReadOptions) opt)

Gets an entry from the DB

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

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

opApply
int opApply(int delegate(Slice, Slice) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opApplyReverse
int opApplyReverse(int delegate(Slice) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opApplyReverse
int opApplyReverse(int delegate(Slice, Slice) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
open
void open(Options opt, string path)

Opens a new connection to a levelDB database

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

Inserts/Updates a given value at a given key.

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

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

iterator
const(ReadOptions) iterator [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
snapshot
ASnapshot snapshot [@property getter]

Returns a readonly snapshot

Static functions

destroyDB
void destroyDB(Options opt, string path)

Destory/delete a non-locked leveldb

repairDB
void repairDB(Options opt, string path)

Attempt to repair a non-locked leveldb

Throws

LeveldbException on errors

Meta