Skip to content
erlang implementation of the constant databse (cdb) by Daniel J. Bernstein.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
src
test
.gitignore
LICENSE
README.md
rebar.config
rebar.lock

README.md

cdb

An implementation of cdb written in erlang. The binary format is compatible with D. J. Bernstein cdb as well as tinycdb.

Build

    $ rebar3 compile

Create a cdb

    A = cdb:make_start("foo.cdb"),
    B = cdb:make_add(A, <<199919:64>>, <<"ccc">>),
    C = cdb:make_add(B, <<"aa">>, <<"bbb">>),
    ok = cdb:make_finish(C),
    ?assertEqual({<<199919:64>>, <<"ccc">>}, cdb:find("foo.cdb", <<199919:64>>)),
    ?assertEqual({<<"aa">>, <<"bbb">>}, cdb:find("foo.cdb", <<"aa">>)).

Find a key

    A = cdb:make_start("foo.cdb"),
    B = cdb:make_add(A, <<"aa">>, <<"bbb">>),
    ok = cdb:make_finish(B),
    ?assertEqual({<<"aa">>, <<"bbb">>}, cdb:find("foo.cdb", <<"aa">>)).
You can’t perform that action at this time.