INTRO
KVS module provides user level interface for console commands. It has discovery, data manipulation and retrival features. Under the hood it handles configurable run-time backends for each supported database.
You can change backend by setting application env. This behaves well even under the heavy load.
API
Data operations.
put(tuple()) -> ok | {error,any()}.
Stores the record.
get(atom(),any()) -> {ok,any()} | {error, not_found | duplicated }.
Retrieves the record.
delete(atom(),any()) -> ok | {error,any()}.
Deletes the data record.
index(atom(),any(),any()) -> list(tuple()).
Searches the record by an indexed field and a given value.
SEQ
Sequence table id_seq stores the counter per thing. The counters are global and atomic in each supported database. Sequences are used to generate unique names for records per distributed table. If names in the table are not unique, e.g. then count function may return a different value than the current sequence.
seq(atom(), integer()) -> integer().
Increments and returns id counter for the particular table.
count(atom()) -> integer().
Returns number of records in table.
SETUP
In sys.config you can specify main kvs backend module as dba parameter and list of modules containing metainfo/0 exported function. For the stream operations you can specify the stream kvs backend module dba_st parameter.
dir() -> list({'table',atom()}).
Returns actual tables.
This module may refer to: kvs_fs, kvs_mnesia, kvs_rocks, kvs_st, kvs_stream.