Module tcbdb

Low level interface to tcbdb.

Description

Low level interface to tcbdb. This exposes most of the tcbdb interface directly operating on binaries.

Function Index

close/1Close a tcerl database.
first/1Get the first key in the database.
get/2Get (possibly multiple) values associated with a Key.
info/1Returns information about the data store.
is_tcbdb_file/1Returns true if file Filename is a tcbdb file, false otherwise.
last/1Get the last key in the database.
next/2Get the next key in the database.
open/2Open a tcerl database.
out/2Delete all records associated with Key.
out_async/2Asynchronously delete all records associated with Key.
out_exact/3Delete all records associated with Key that compare equal to Value.
out_exact_async/3Asynchronously delete all records associated with Key that compare equal to Value.
prefix/3Retrieve keys which have Key as a prefix.
prev/2Get the previous key in the database.
put/3Enter a key-value pair into the database.
put_async/3Asynchronously enter a key-value pair into the database.
put_dup/3Enter a key-value pair into the database, allowing duplicate keys.
put_dup_async/3Asynchronously enter a key-value pair into the database, allowing duplicate keys.
range/6Retrieve keys between Begin and End, optionally inclusive.
range_lb/4Retrieve keys greater than Begin, optionally inclusive.
range_ub/4Retrieve keys less than End, optionally inclusive.
sync/1Synchronize contents of a B+ tree database object with the file and the device.
unlink/1Unlinks the port underlying the table from the current process.
update_counter/4Update a counter associated with a tuple record whose Pos-th position consists of an integer field.
vanish/1Remove all records.

Function Details

close/1

close(Tcerl::tcerl()) -> ok | {error, Reason}

Close a tcerl database. Corresponds to tcbdbclose ().

first/1

first(Tcerl::tcerl()) -> [binary()] | {error, Reason}

Get the first key in the database. Empty list is returned if there are no keys. Corresponds to tcbdbcurfirst ().

get/2

get(Tcerl::tcerl(), Key::iodata()) -> [binary()] | {error, Reason}

Get (possibly multiple) values associated with a Key. Key is flattened to binary before lookup. Corresponds to tcbdbget4 ().

info/1

info(Tcerl::tcerl()) -> [info()] | {error, Reason}

Returns information about the data store. file_size is the size of the file in bytes. no_objects in the number of different objects stored in the table. Corresponds to tcbdbrnum () and tcbdbfsiz ().

is_tcbdb_file/1

is_tcbdb_file(Filename::iodata()) -> true | false | {error, Reason}

Returns true if file Filename is a tcbdb file, false otherwise.

last/1

last(Tcerl::tcerl()) -> [binary()] | {error, Reason}

Get the last key in the database. Empty list is returned if there are no keys. Corresponds to tcbdbcurlast ().

next/2

next(Tcerl::tcerl(), Key::iodata()) -> [binary()] | {error, Reason}

Get the next key in the database. Key is flattened to binary before lookup. Empty list is returned if there are no more keys. Like ets:next/2, Key need not be an element of the table, the next key in order in the table (if any) will be returned. Corresponds to tcbdbcurjump ().

open/2

open(Name::iodata(), Options::[option()]) -> {ok, tcerl()} | {error, Reason}

Open a tcerl database. This function corresponds to tcbdbtune () followed by tcbdbopen (). raw uses the default comparison function for keys (memcmp); term_store uses erlang term order and requires valid external term formats as keys.

out/2

out(Tcerl::tcerl(), Key::iodata()) -> ok | {error, Reason}

Delete all records associated with Key. Key is flattened to binary before lookup. Corresponds to tcbdbout3 ().

out_async/2

out_async(Tcerl::tcerl(), Key::iodata()) -> ok

Asynchronously delete all records associated with Key. Returns immediately, and does not do error checking. Key is flattened to binary before lookup. Corresponds to tcbdbout3 ().

out_exact/3

out_exact(Tcerl::tcerl(), Key::iodata(), Value::iodata()) -> ok | {error, Reason}

Delete all records associated with Key that compare equal to Value. Both Key and Value are flattened to binary before lookup. Corresponds to tcbdbout3 () coupled with tcbdbcurjump () and tcbdbcurnext ().

out_exact_async/3

out_exact_async(Tcerl::tcerl(), Key::iodata(), Value::iodata()) -> ok

Asynchronously delete all records associated with Key that compare equal to Value. Returns immediately, and does not do error checking. Both Key and Value are flattened to binary before lookup. Corresponds to tcbdbout3 () coupled with tcbdbcurjump () and tcbdbcurnext ().

prefix/3

prefix(Tcerl::tcerl(), Prefix::iodata(), Max::integer()) -> [binary()] | {error, Reason}

Retrieve keys which have Key as a prefix. Key is flattened to binary before lookup. If Max is non-negative, no more than Max results are returned. Corresponds to tcbdbprefix ().

prev/2

prev(Tcerl::tcerl(), Key::iodata()) -> [binary()] | {error, Reason}

Get the previous key in the database. Key is flattened to binary before lookup. Empty list is returned if there are no more keys. Like ets:prev/2, Key need not be an element of the table, the previous key in order in the table (if any) will be returned. Corresponds to tcbdbcurjump ().

put/3

put(Tcerl::tcerl(), Key::iodata(), Value::iodata()) -> ok | {error, Reason}

Enter a key-value pair into the database. Both Key and Value are flattened to binary before insertion. If a record exists %% for the key it will be replaced. Corresponds to tcbdbput ().

put_async/3

put_async(Tcerl::tcerl(), Key::iodata(), Value::iodata()) -> ok

Asynchronously enter a key-value pair into the database. Returns immediately, and does not do error checking. Both Key and Value are flattened to binary before insertion. If a record exists for the key it will be replaced. Corresponds to tcbdbput ().

put_dup/3

put_dup(Tcerl::tcerl(), Key::iodata(), Value::iodata()) -> ok | {error, Reason}

Enter a key-value pair into the database, allowing duplicate keys. Both Key and Value are flattened to binary before insertion. Corresponds to tcbdbputdup ().

put_dup_async/3

put_dup_async(Tcerl::tcerl(), Key::iodata(), Value::iodata()) -> ok

Asynchronously enter a key-value pair into the database, allowing duplicate keys. Returns immediately, and does not do error checking. Both Key and Value are flattened to binary before insertion. Corresponds to tcbdbputdup ().

range/6

range(Tcerl::tcerl(), Begin::iodata(), BeginInc::bool(), End::iodata(), EndInc::bool(), Max::integer()) -> [binary()] | {error, Reason}

Retrieve keys between Begin and End, optionally inclusive. Begin and End are flattened to binary before comparison. If Max is non-negative, no more than Max results are returned. Corresponds to tcbdbrange ().

range_lb/4

range_lb(Tcerl::tcerl(), Begin::iodata(), BeginInc::bool(), Max::integer()) -> [binary()] | {error, Reason}

Retrieve keys greater than Begin, optionally inclusive. Begin is flattened to binary before comparison. If Max is non-negative, no more than Max results are returned. Corresponds to tcbdbrange ().

range_ub/4

range_ub(Tcerl::tcerl(), End::iodata(), EndInc::bool(), Max::integer()) -> [binary()] | {error, Reason}

Retrieve keys less than End, optionally inclusive. End is flattened to binary before comparison. If Max is non-negative, no more than Max results are returned. Corresponds to tcbdbrange ().

sync/1

sync(Tcerl::tcerl()) -> ok | {error, Reason}

Synchronize contents of a B+ tree database object with the file and the device. Corresponds to tcbdbsync ().

unlink/1

unlink(Tcerl::tcerl()) -> true

Unlinks the port underlying the table from the current process.

update_counter/4

update_counter(Tcerl::tcerl(), Key::iodata(), Pos::integer(), Incr::integer()) -> Result::integer()

Update a counter associated with a tuple record whose Pos-th position consists of an integer field. The new counter value is returned.

For compatibility with ets/dets, this method will exit (throw an exception) if certain conditions are violated:
  1. An object exists associated with the key.
  2. The value is a tuple with an integer at the Pos-th position.

vanish/1

vanish(Tcerl::tcerl()) -> ok | {error, Reason}

Remove all records. Corresponds to tcbdbvanish ().


Generated by EDoc, Mar 2 2009, 02:06:45.