Wiki

Clone wiki

yatce / APISpec

API Specification

Most functions are thin wrapper of TCADB APIs. All return form is {ok, Result} or {error, Reason}.

module yatce

module yatce has application behaviour. use it as an application.

yatce:db/2

Gets a new yatce table 'object'. This operation doesn't open the file. Second argument is to be input to tcadbopen called against tcadb:open/0. In some cases '*' and '+' is available without bad support. Currently, hashdb (with suffix '.tch') and B+-tree database are supported. Other options (mainly tuning parameters) can be input as a form of {Key, Value}.

module tcadb

tcadb:open/0

Opens a table 'object'. Corresponds to tcadbopen in TC.

tcadb:close/0

Closes a table 'object'. Corresponds to tcadbclose in TC.

tcadb:put/2

Puts a data into the table. Corresponds to tcadbput in TC.

  TCADBobj:put(Key, Value),

tcadb:putkeep/2

Puts a data into the table only if the record with same key doesn't exist. Corresponds to tcadbputkeep in TC.

  TCADBobj:putkeep(Key, Value),

tcadb:out/1

Deletes the record. Corresponds to tcadbout in TC.

tcadb:get/1

Gets the record. Corresponds to tcadbget in TC.

tcadb:iterinit/0

Initializes the iterator. The iterator is unique inside the table. Corresponds to tcadbinit in TC.

tcadb:iternext/0

Iterates the iterator. Returns the value. Corresponds to tcadbnext in TC.

tcadb:sync/0

Calls tcadbsync in TC. Synchronizes the table with disk.

tcadb:vanish/0

Removes all records in the table. Corresponds to tcadbvanish.

tcadb:path/0

Gets the file name of the table with atom.

tcadb:rnum/0

Gets the number of records. Corresponds to tcadbrnum.

tcadb:size/0

Gets the size of table file. Corresponds to tcadbsize.

tcadb:me/0

Returns the table 'object' itself.

Updated