access() = read | read_write
object() = tuple()
type() = ordered_set | ordered_duplicate_bag
bchunk/2 | Returns a list of objects stored in a table. |
close/1 | Close a tcbdbets. |
delete/2 | Delete all records associated with Key. |
delete_all_objects/1 | Deletes all objects from a table. |
delete_object/2 | Deletes all instances of a given object from a table.. |
first/1 | Returns the first key stored in the table according to erlang term order, or the atom '$end_of_table' if the table is empty. |
foldl/3 | Calls Function on successive elements of the table together with an extra argument AccIn. |
foldr/3 | Calls Function on successive elements of the table together with an extra argument AccIn. |
from_ets/2 | Deletes all objects of the table and then inserts all the objects of the Ets table Tab. |
info/1 | Returns information about the table as a list of { Item, Value } tuples. |
info/2 | Returns the information associated with Item for the table. |
init_table/2 | Equivalent to init_table(tcbdbets(), initfun(), [{format, term}]). |
init_table/3 | Replaces the existing objects of the table with objects created by calling the input function InitFun, see below. |
insert/2 | Inserts one or more objects into the table. |
insert_new/2 | Inserts one or more objects into the table. |
is_compatible_bchunk_format/2 | Returns true if it would be possible to initialize the table, using init_table/3 with the option { format, bchunk }, with objects read with bchunk/2 from some table T such that calling info (T, bchunk_format) returns Format. |
is_tcbdbets_file/1 | Returns true if the file Filename is a tcbdbets store, false otherwise. |
last/1 | Returns the last key stored in the table according to erlang term order, or the atom '$end_of_table' if the table is empty. |
lookup/2 | Returns a list of all objects with the key Key stored in the table. |
match/1 | Matches some objects stored in a table and returns a list of the bindings that match a given pattern in the same order as first/next traversal. |
match/2 | Like match/3, but matches all objects. |
match/3 | Matches some or all objects of the table and returns a list of the bindings that match Pattern in some unspecified order. |
match_delete/2 | Deletes all objects that match Pattern from the table, and returns the number of deleted objects. |
match_object/1 | Returns a list of some objects stored in a table that match a given pattern in first/next traversal order. |
match_object/2 | Returns a list of all objects of the table that match Pattern in some unspecified order. |
match_object/3 | Matches some or all objects stored in the table and returns a list of the objects that match Pattern in first/next traversal order. |
member/2 | Works like lookup/2, but does not return the objects. |
next/2 | Returns the key following Key in the table according to erlang term order, or '$end_of_table' if there is no next key. |
open_file/1 | Opens a table. |
prev/2 | Returns the key preceeding Key in the table according to erlang term order, or '$end_of_table' if there is no prev key. |
repair_continuation/2 | This function can be used to restore an opaque continuation returned by select/3 or select/1 if the continuation has passed through external term format (been sent between nodes or stored on disk). |
select/1 | Applies a match specification to some objects stored in a table and returns a list of the results. |
select/2 | Like select/3, but matches all objects. |
select/3 | Returns the results of applying the match specification MatchSpec to all or some objects stored in the table. |
select_delete/2 | Deletes each object from the table such that applying the match specification MatchSpec to the object returns the value true. |
sync/1 | Ensures that all updates made to the table are written to disk. |
to_ets/2 | Inserts the objects of the table into the Ets table Tab. |
traverse/2 | Applies Fun to each object stored in the table in some unspecified order. |
unlink/1 | Unlinks the port underlying the term store from the current process. |
update_counter/3 | Updates the object with key Key stored in the table of type set by adding Incr to the element at the Pos:th position. |
bchunk(TcBdbEts::tcbdbets(), Continuation::bchunk_continuation()) -> {bchunk_continuation(), data()} | '$end_of_table' | {error, Reason}
Returns a list of objects stored in a table. The exact representation of the returned objects is not public. The lists of data can be used for initializing a table by giving the value bchunk to the format option of the init_table/3 function. The Mnesia application uses this function for copying open tables.
close(TcBdbEts::tcbdbets()) -> ok | {error, Reason}
Close a tcbdbets.
delete(TcBdbEts::tcbdbets(), Key::any()) -> ok | {error, Reason}
Delete all records associated with Key.
delete_all_objects(TcBdbEts::tcbdbets()) -> ok | {error, Reason}
Deletes all objects from a table.
delete_object(TcBdbEts::tcbdbets(), Object::object()) -> ok | {error, Reason}
Deletes all instances of a given object from a table.. With bag semantics this can be used to delete some of the objects with a given key.
first(TcBdbEts::tcbdbets()) -> Key | '$end_of_table'
Returns the first key stored in the table according to erlang term order, or the atom '$end_of_table' if the table is empty.
foldl(Function::function(), Acc0::acc(), TcBdbEts::tcbdbets()) -> Acc1::acc() | {error, Reason}
Calls Function on successive elements of the table together with an extra argument AccIn. The order in which the elements of the table is erlang term order of key, and unspecified for objects with the same key (if type is not ordered_set). Function must return a new accumulator which is passed to the next call. Acc0 is returned if the table is empty.
foldr(Function::function(), Acc0::acc(), TcBdbEts::tcbdbets()) -> Acc1::acc() | {error, Reason}
Calls Function on successive elements of the table together with an extra argument AccIn. The order in which the elements of the table is reverse erlang term order of key, and unspecified for objects with the same key (if type is not ordered_set). Function must return a new accumulator which is passed to the next call. Acc0 is returned if the table is empty.
from_ets(TcBdbEts::tcbdbets(), Tab::ets_table()) -> ok | {error, Reason}
Deletes all objects of the table and then inserts all the objects of the Ets table Tab. The order in which the objects are inserted is not specified. Since ets:safe_fixtable/2 is called the Ets table must be public or owned by the calling process.
info(TcBdbEts::tcbdbets()) -> [info()] | undefined
Returns information about the table as a list of { Item, Value } tuples.
info(TcBdbEts::tcbdbets(), Item::what()) -> Value | undefined
Returns the information associated with Item for the table.
init_table(TcBdbEts::tcbdbets(), InitFun::initfun()) -> ok | {error, Reason}
Equivalent to init_table(tcbdbets(), initfun(), [{format, term}]).
init_table(TcBdbEts::tcbdbets(), InitFun::initfun(), Options::[option()]) -> ok | {error, Reason}
Replaces the existing objects of the table with objects created by calling the input function InitFun, see below. The reason for using this function rather than calling insert/2 is that of efficiency. (TODO: does that apply here?)
When called with the argument read the function InitFun is assumed to return end_of_input when there is no more input, or { Objects, Fun }, where Objects is a list of objects and Fun is a new input function. Any other value Value is returned as an error { error, { init_fun, Value } }. Each input function will be called exactly once, and should an error occur, the last function is called with the argument close, the reply of which is ignored.
If the type of the table is ordered_set and there is more than one object with a given key, one of the objects is chosen. This is not necessarily the last object with the given key in the sequence of objects returned by the input functions. Extra objects should be avoided, or the file will be unnecessarily fragmented. This holds also for duplicated objects stored in tables of type bag.
The Options argument is a list of { Key, Val } tuples where the following values are allowed:
* { format, Format }. Specifies the format of the objects returned by the function InitFun. If Format is term (the default), InitFun is assumed to return a list of tuples. If Format is bchunk, InitFun is assumed to return Data as returned by bchunk/2.insert(TcBdbEts::tcbdbets(), Object::objects()) -> ok | {error, Reason}
Inserts one or more objects into the table. If there already exists an object with a key comparing equal to the key of some of the given objects and the table type is ordered_set, the old object will be replaced.
insert_new(TcBdbEts::tcbdbets(), Object::objects()) -> true | false | {error, Reason}
Inserts one or more objects into the table. If there already exists some object with a key matching the key of any of the given objects the table is not updated and false is returned, otherwise the objects are inserted and true returned.
is_compatible_bchunk_format(TcBdbEts::tcbdbets(), Format::bchunk_format()) -> bool()
Returns true if it would be possible to initialize the table, using init_table/3 with the option { format, bchunk }, with objects read with bchunk/2 from some table T such that calling info (T, bchunk_format) returns Format.
is_tcbdbets_file(Filename::iodata()) -> true | false | {error, Reason}
Returns true if the file Filename is a tcbdbets store, false otherwise.
last(TcBdbEts::tcbdbets()) -> Key | '$end_of_table'
Returns the last key stored in the table according to erlang term order, or the atom '$end_of_table' if the table is empty.
lookup(TcBdbEts::tcbdbets(), Key::any()) -> [Object] | {error, Reason}
Returns a list of all objects with the key Key stored in the table. If the table is of type ordered_set, the function returns either the empty list or a list with one object, as there cannot be more than one object with a given key. The order of objects returned is unspecified.
match(Continuation::match_continuation()) -> {[match()], match_continuation()} | '$end_of_table' | {error, Reason}
Matches some objects stored in a table and returns a list of the bindings that match a given pattern in the same order as first/next traversal. The table, the pattern, and the number of objects that are matched are all defined by Continuation, which has been returned by a prior call to match/1, match/2, or match/3. When all objects of the table have been matched, '$end_of_table' is returned.
match(TcBdbEts::tcbdbets(), Pattern::pattern()) -> [match()] | {error, Reason}
Like match/3, but matches all objects.
match(TcBdbEts::tcbdbets(), Pattern::pattern(), N::integer()) -> {[match()], match_continuation()} | '$end_of_table' | {error, Reason}
Matches some or all objects of the table and returns a list of the bindings that match Pattern in some unspecified order. See ets(3) for a description of patterns.
A tuple of the bindings and a continuation is returned, unless the table is empty, in which case '$end_of_table' is returned. The continuation is to be used when matching further objects by calling match/1.
All objects with the same key are always matched at the same time which implies that, unless type is ordered_set, more than N matches may sometimes be matched.
The result is in the same order as in a first/next traversal.match_delete(TcBdbEts::tcbdbets(), Pattern::pattern()) -> N | {error, Reason}
Deletes all objects that match Pattern from the table, and returns the number of deleted objects. See ets(3) for a description of patterns.
If the keypos'th element of Pattern is bound, only the objects with the right key are matched.match_object(Continuation::match_object_cont()) -> {[object()], match_object_cont()} | {error, Reason}
Returns a list of some objects stored in a table that match a given pattern in first/next traversal order. The table, the pattern, and the number of objects that are matched are all defined by Continuation, which has been returned by a prior call to match_object/1 or match_object/3.
When all objects of the table have been matched, '$end_of_table' is returned.match_object(TcBdbEts::tcbdbets(), Pattern::pattern()) -> [object()] | {error, Reason}
Returns a list of all objects of the table that match Pattern in some unspecified order. See ets(3) for a description of patterns.
If the keypos'th element of Pattern is unbound, all objects of the table are matched. If the keypos'th element of Pattern is bound, only the objects with the right key are matched.match_object(TcBdbEts::tcbdbets(), Pattern::pattern(), Max::integer()) -> {[object()], match_object_cont} | '$end_of_table' | {error, Reason}
Matches some or all objects stored in the table and returns a list of the objects that match Pattern in first/next traversal order. See ets(3) for a description of patterns.
A list of objects and a continuation is returned, unless the table is empty, in which case '$end_of_table' is returned. The continuation is to be used when matching further objects by calling match_object/1.
All objects with the same key are always matched at the same time which implies that, unless type is ordered_set, more than N objects may sometimes be matched.member(TcBdbEts::tcbdbets(), Key::any()) -> true | false | {error, Reason}
Works like lookup/2, but does not return the objects. The function returns true if one or more elements of the table has the key Key, false otherwise.
next(TcBdbEts::tcbdbets(), Key::any()) -> any() | '$end_of_table'
Returns the key following Key in the table according to erlang term order, or '$end_of_table' if there is no next key.
Should an error occur, the process is exited with an error tuple {error, Reason}.
Use first/1 to find the first key in the table.open_file(Args::[arg()]) -> {ok, tcbdbets()} | {error, Reason}
Opens a table. An empty table is created if no file exists.
The Args argument is a list of { Key, Val } tuples where the following values are recognized: * { access, access () }: either read or read_write; default read_write * { file, iodata () }: required * { keypos, integer () }, the position of the element of each object to be used as key. The default value is 1. The ability to explicitly state the key position is most convenient when we want to store Erlang records in which the first position of the record is the name of the record type. * { type, type () }, the type of the table (ordered_set or ordered_duplicate_bag). The default value is ordered_set. * async_write: if indicated, async versions of update operations will be used. * Other tuples indicated above: same interpretation as tcbdb:open/2. NB: The tcbdb:open/2 options [ term_store, large, nolock ] are always present.prev(TcBdbEts::tcbdbets(), Key::any()) -> any() | '$end_of_table'
Returns the key preceeding Key in the table according to erlang term order, or '$end_of_table' if there is no prev key.
Should an error occur, the process is exited with an error tuple {error, Reason}.
Use last/1 to find the last key in the table.repair_continuation(Continuation::select_continuation(), MatchSpec::matchspec()) -> select_continuation()
This function can be used to restore an opaque continuation returned by select/3 or select/1 if the continuation has passed through external term format (been sent between nodes or stored on disk).
The reason for this function is that continuation terms contain compiled match specifications and therefore will be invalidated if converted to external term format. Given that the original match specification is kept intact, the continuation can be restored, meaning it can once again be used in subsequent select/1 calls even though it has been stored on disk or on another node.
See also ets(3) for further explanations and examples.select(Continuation::select_continuation()) -> {[Match], select_continuation()} | '$end_of_table' | {error, Reason}
Applies a match specification to some objects stored in a table and returns a list of the results. The table, the match specification, and the number of objects that are matched are all defined by Continuation, which has been returned by a prior call to select/1, select/2, or select/3.
When all objects of the table have been matched, '$end_of_table' is returned.select(TcBdbEts::tcbdbets(), MatchSpec::matchspec()) -> [match()] | {error, Reason}
Like select/3, but matches all objects.
select(TcBdbEts::tcbdbets(), MatchSpec::matchspec(), N::integer()) -> {[match()], select_continuation()} | '$end_of_table' | {error, Reason}
Returns the results of applying the match specification MatchSpec to all or some objects stored in the table. The order of the objects is not specified. See the ERTS User's Guide for a description of match specifications.
If the keypos'th element of MatchSpec is unbound, the match specification is applied to all objects of the table. If the keypos'th element is bound, the match specification is applied to the objects with the right key(s) only.select_delete(TcBdbEts::tcbdbets(), MatchSpec::matchspec()) -> N | {error, Reason}
Deletes each object from the table such that applying the match specification MatchSpec to the object returns the value true. See the ERTS User's Guide for a description of match specifications. Returns the number of deleted objects. If the keypos'th element of MatchSpec is bound, the match specification is applied to the objects with the right key(s) only.
sync(TcBdbEts::tcbdbets()) -> ok | {error, Reason}
Ensures that all updates made to the table are written to disk.
to_ets(TcBdbEts::tcbdbets(), Tab::ets_table()) -> ets_table() | {error, Reason}
Inserts the objects of the table into the Ets table Tab. Elements are inserted in erlang term order of their keys, and is unspecified for records with the same key (when type is not ordered_set). The existing objects of the Ets table are kept unless overwritten.
traverse(TcBdbEts::tcbdbets(), Function::traverse_func()) -> Acc | {error, Reason}
Applies Fun to each object stored in the table in some unspecified order. Different actions are taken depending on the return value of Fun. The following Fun return values are allowed:
continue Continue to perform the traversal. For example, the following function can be used to print out the contents of a table:
fun(X) -> io:format("~p~n", [X]), continue end.
{continue, Val} Continue the traversal and accumulate Val. The following function is supplied in order to collect all objects of a table in a list:
fun(X) -> {continue, X} end.
{done, Value} Terminate the traversal and return [Value | Acc].
Any other value returned by Fun terminates the traversal and is immediately returned.unlink(TcBdbEts::tcbdbets()) -> true
Unlinks the port underlying the term store from the current process.
update_counter(TcBdbEts::tcbdbets(), Key::any(), Increment::increment()) -> integer()
Updates the object with key Key stored in the table of type set by adding Incr to the element at the Pos:th position. The new counter value is returned. If no position is specified, the element directly following the key is updated.
TcBdbEts must be of type ordered_set, the key must exist, and the position being updated cannot be the key position. Errors are indicated via exceptions with this routine.
Another caveat: bignums currently cannot be used as counter fields, and if there is underflow or overflow the value will be silently incorrect.
Exits (throws an exception) if preconditions are violated.Generated by EDoc, Mar 2 2009, 02:06:45.