DBKV (dbkv v0.2.3) View Source
A disk-based key-value store built on top of :dets
.
Inspired by CubDB's intuitive API.
Link to this section Summary
Types
Match Specifications. See https://erlang.org/doc/man/dets.html#type-match_spec
Functions
Returns all entries from table
.
Applies fun
to each entry stored in table
in some unspecified order.
Closes a table. Only processes that have opened a table are allowed to close it. All open tables must be closed before the system is stopped.
Decrements a number field by one.
Deletes the entry in table
for a specific key
.
Deletes all entries from table
.
Deletes entries from table
where the key is with the specified range. By default, the range is
inclusive. The range boundaries can be excluded by setting :min_inclusive
or :max_inclusive
to false
.
Deletes each entry from table
such that applying match_spec
to the entry returns true
.
Returns the number of deleted entries.
Delete all entries from table
where the key is less than or equal to max_key
.
The boundary can be excluded by setting inclusive
to false
.
Delete all entries from table
where the value is less than or equal to max_value
.
The boundary can be excluded by setting inclusive
to false
.
Delete all entries from table
where the key is greater than or equal to min_key
.
The boundary can be excluded by setting inclusive
to false
.
Delete all entries from table
where the value is greater than or equal to min_value
.
The boundary can be excluded by setting inclusive
to false
.
Delete all entries from table
where the value is equal to value
.
Deletes entries from table
where the valye is with the specified range. By default, the range is
inclusive. The range boundaries can be excluded by setting :min_inclusive
or :max_inclusive
to false
.
Gets the value for a specific key
in table
.
Returns whether the given key
exists in table
.
Increments a number field by one.
Returns information about table
.
Replaces the existing entries of table
with entries
.
Returns all keys from table
.
Opens a table. An empty :dets
table is created if no file exists.
Returns whether table
is open.
Puts the given value
under key
in table
.
Puts the given value
under key
unless the entry key
already exists in table
.
Returns a specified range of entries from table
. By default, the range is inclusive. The range
boundaries can be excluded by setting :min_inclusive
or :max_inclusive
to false
.
Returns the results of applying match_spec
to all or n
entries stored in table
.
Returns all entries from table
where the key is less than or equal to max_key
.
The boundary can be excluded by setting inclusive
to false
.
Returns all entries from table
where the value is less than or equal to max_value
.
The boundary can be excluded by setting inclusive
to false
.
Returns all entries from table
where the key is greater than or equal to min_key
.
The boundary can be excluded by setting inclusive
to false
.
Returns all entries from table
where the value is greater than or equal to min_value
.
The boundary can be excluded by setting inclusive
to false
.
Returns all entries from table
where the value is equal to value
.
Returns a specified range of entries from table
. By default, the range is inclusive.
The range boundaries can be excluded by setting :min_inclusive
or :max_inclusive
to false
.
Returns the size of the collection in table
.
Updates the key
in table
with the given function.
Returns all values from table
.
Link to this section Types
Specs
Specs
Specs
Match Specifications. See https://erlang.org/doc/man/dets.html#type-match_spec
Specs
Specs
t() :: atom()
Link to this section Functions
Specs
Returns all entries from table
.
Specs
Applies fun
to each entry stored in table
in some unspecified order.
Specs
Closes a table. Only processes that have opened a table are allowed to close it. All open tables must be closed before the system is stopped.
Specs
Decrements a number field by one.
Specs
Deletes the entry in table
for a specific key
.
Specs
Deletes all entries from table
.
Specs
Deletes entries from table
where the key is with the specified range. By default, the range is
inclusive. The range boundaries can be excluded by setting :min_inclusive
or :max_inclusive
to false
.
Specs
delete_by_match_spec(t(), match_spec()) :: integer() | {:error, any()}
Deletes each entry from table
such that applying match_spec
to the entry returns true
.
Returns the number of deleted entries.
Specs
Delete all entries from table
where the key is less than or equal to max_key
.
The boundary can be excluded by setting inclusive
to false
.
Specs
Delete all entries from table
where the value is less than or equal to max_value
.
The boundary can be excluded by setting inclusive
to false
.
Specs
Delete all entries from table
where the key is greater than or equal to min_key
.
The boundary can be excluded by setting inclusive
to false
.
Specs
Delete all entries from table
where the value is greater than or equal to min_value
.
The boundary can be excluded by setting inclusive
to false
.
Specs
Delete all entries from table
where the value is equal to value
.
Specs
Deletes entries from table
where the valye is with the specified range. By default, the range is
inclusive. The range boundaries can be excluded by setting :min_inclusive
or :max_inclusive
to false
.
Specs
Gets the value for a specific key
in table
.
Specs
Returns whether the given key
exists in table
.
Specs
Increments a number field by one.
Specs
Returns information about table
.
Specs
Replaces the existing entries of table
with entries
.
Specs
Returns all keys from table
.
Specs
open(dbkv_options()) :: {:ok, t()} | {:error, any()}
Opens a table. An empty :dets
table is created if no file exists.
The optional argument is a keyword list of options:
name
: a name of the table (defaults toDBKV
)data_dir
: the directory path where the database files will be stored (defaults to"tmp"
)
Specs
Returns whether table
is open.
Specs
Puts the given value
under key
in table
.
Specs
Puts the given value
under key
unless the entry key
already exists in table
.
Specs
Returns a specified range of entries from table
. By default, the range is inclusive. The range
boundaries can be excluded by setting :min_inclusive
or :max_inclusive
to false
.
Specs
select_by_match_spec(t(), match_spec(), non_neg_integer()) :: [any()] | {:error, any()}
Returns the results of applying match_spec
to all or n
entries stored in table
.
Specs
Returns all entries from table
where the key is less than or equal to max_key
.
The boundary can be excluded by setting inclusive
to false
.
Specs
Returns all entries from table
where the value is less than or equal to max_value
.
The boundary can be excluded by setting inclusive
to false
.
Specs
Returns all entries from table
where the key is greater than or equal to min_key
.
The boundary can be excluded by setting inclusive
to false
.
Specs
Returns all entries from table
where the value is greater than or equal to min_value
.
The boundary can be excluded by setting inclusive
to false
.
Specs
Returns all entries from table
where the value is equal to value
.
Specs
Returns a specified range of entries from table
. By default, the range is inclusive.
The range boundaries can be excluded by setting :min_inclusive
or :max_inclusive
to false
.
Specs
Returns the size of the collection in table
.
Specs
Updates the key
in table
with the given function.
If key
is present in table
then the existing value
is passed to fun
and its result is
used as the updated value of key
. If key
is not present in table
, default
is inserted as
the value of key
. The default value will not be passed through the update function.
Specs
Returns all values from table
.