Module rkvs
May 2, 2015 ยท View on GitHub
Data Types
fold_options()
fold_options() = [{start_key, key()} | {end_key, key()} | {gt, key()} | {gte, key()} | {lt, key()} | {lte, key()} | {max, integer()} | {fill_cache, true | false}]
key()
key() = term()
keys()
keys() = [key()]
kvs()
kvs() = [{key(), value()}]
ops_kvs()
ops_kvs() = [{put, key(), value()} | {delete, key(), value()}]
value()
value() = term()
Function Index
| clear/2 | delete the value associated to the key. |
| clear_range/4 | delete all K/Vs in a range. |
| close/1 | close a storage. |
| contains/2 | is the key exists in the storage. |
| destroy/1 | close a storage and remove all the data. |
| fold/4 | fold all K/Vs with a function
Additionnaly you can pass the following options:
|
| fold_keys/4 | fold all keys with a function same parameters as in the fold function. |
| get/2 | get the value associated to the key. |
| is_empty/1 | Returns true if this backend contains any values; otherwise returns false. |
| open/2 | open a storage, amd pass options to the backend. |
| put/3 | store the value associated to the key. |
| scan/4 | retrieve a list of Key/Value in a range. |
| write_batch/2 | do multiple operations on the backend. |
Function Details
clear/2
clear(Engine::engine(), Key::key()) -> ok | {error, term()}
delete the value associated to the key
clear_range/4
clear_range(Engine::engine(), Start::key(), End::key(), Max::integer()) -> ok | {error, term()}
close/1
close(Engine::engine()) -> ok | {error, any()}
contains/2
contains(Engine::engine(), Key::key()) -> true | false
is the key exists in the storage
destroy/1
destroy(Engine::engine()) -> ok | {error, any()}
close a storage and remove all the data
fold/4
fold(Engine::engine(), Fun::function(), Acc0::any(), Opts::fold_options()) -> any() | {error, term()}
fold all K/Vs with a function Additionnaly you can pass the following options:
-
'gt', (greater than), 'gte' (greather than or equal): define the lower bound of the range to fold. Only the records where the key is greater (or equal to) will be given to the function.
-
'lt' (less than), 'lte' (less than or equal): define the higher bound of the range to fold. Only the records where the key is less than (or equal to) will be given to the function
-
'start_key', 'end_key', legacy to 'gte', 'lte'
-
'max' (default=0), the maximum of records to fold before returning the resut
-
'fill_cache' (default is true): should be the data cached in memory?
fold_keys/4
fold_keys(Engine::engine(), Fun::function(), Acc0::any(), Opts::fold_options()) -> any() | {error, term()}
fold all keys with a function same parameters as in the fold function.
get/2
get(Engine::engine(), Key::key()) -> any() | {error, term()}
get the value associated to the key
is_empty/1
is_empty(Engine::engine()) -> boolean() | {error, term()}
Returns true if this backend contains any values; otherwise returns false.
open/2
open(Name::binary(), Options::list()) -> {ok, engine()} | {error, any()}
open a storage, amd pass options to the backend. The following optinos can be used:
-
'backend': default is rkvs_ets, folowin backend are provided in rkvs: rkvs_ets, rkvs_leveldb, rkvs_rocksdb, rkvs_hanoidb, rvs_bitcask.
-
'db_opts': backend options, refers to the backend doc for them
-
'key_encoding': to encode the key. defautl is raw (binary). can be term, {term, Opts} or sext
-
'value_encoding': to encode the value. defautl is term. can be term, {term, Opts} or sext
put/3
put(Engine::engine(), Key::key(), Value::value()) -> ok | {error, term()}
store the value associated to the key.
scan/4
scan(Engine::engine(), Start::key(), End::key(), Max::integer()) -> kvs() | {error, term()}
retrieve a list of Key/Value in a range
write_batch/2
write_batch(Engine::engine(), Ops::ops_kvs()) -> ok | {error, term()}
do multiple operations on the backend.