Module db_prbr

DB back-end for DHT nodes storing prbr objects.

Copyright © 2013-2016 Zuse Institute Berlin,

Version: $Id$

Authors: Florian Schintke (schintke@zib.de), Nico Kruber (kruber@zib.de), Jan Fajerski (fajerski@zib.de).

Description

DB back-end for DHT nodes storing prbr objects.

Data Types

db()

db() = 
    {KeyValueDB :: term(),
     Subscribers :: db_ets:db(),
     SnaphotInfo ::
         {term() | false,
          LiveLockCount :: non_neg_integer(),
          SnapLockCount :: non_neg_integer()}}

db_as_list()

db_as_list() = [entry()]

entry()

entry() = tuple()

first element must be the key().

value()

value() = rdht_tx:encoded_value()

version()

version() = non_neg_integer()

Function Index

add_data/2Adds all db entry objects in the Data list.
check_config/0
close/1Closes the given DB (it may be recoverable using open/1 depending on the DB back-end).
close_and_delete/1Closes the given DB and deletes all contents (this DB can thus not be re-opened using open/1).
delete_entries/2Deletes all objects in the given Range or (if a function is provided) for which the FilterFun returns true from the DB.
delete_entry/2Removes all values with the given entry's key from the DB.
get/2Gets an entry from the DB.
get_changes/2Gets all db entries in the given interval which have (potentially) been changed or deleted (might return objects that have not changed but have been touched by one of the DB setters).
get_chunk2/7
get_entries/2Gets (non-empty) db entry objects in the given range.
get_load/1Returns the number of stored keys.
get_load/2Returns the number of stored keys in the given interval.
new/1Initializes a new database.
open/1Re-opens an existing database.
record_changes/2Adds the new interval to the interval to record changes for.
set/2
stop_record_changes/2Stops recording changes in the given interval and removes all such entries from the table of changed keys.
tab2list/1

Function Details

new/1

new(DBName :: nonempty_string() | atom() | tuple()) -> db()

Initializes a new database.

open/1

open(DB :: nonempty_string()) -> db()

Re-opens an existing database.

close/1

close(State :: db()) -> true

Closes the given DB (it may be recoverable using open/1 depending on the DB back-end).

close_and_delete/1

close_and_delete(State :: db()) -> true

Closes the given DB and deletes all contents (this DB can thus not be re-opened using open/1).

get_load/1

get_load(DB :: db()) -> Load :: integer()

Returns the number of stored keys.

get_load/2

get_load(DB :: db(), Interval :: intervals:interval()) ->
            Load :: integer()

Returns the number of stored keys in the given interval.

tab2list/1

tab2list(Table_name :: db()) -> [Entries :: entry()]

get/2

get(X1 :: db(), Key :: rt_chord:key()) -> entry() | {}

Gets an entry from the DB. If there is no entry with the given key, an empty entry will be returned.

set/2

set(DB :: db(), Entry :: entry()) -> db()

delete_entry/2

delete_entry(DB :: db(), Entry :: entry()) -> NewDB :: db()

Removes all values with the given entry's key from the DB.

get_chunk2/7

get_chunk2(DB :: db(),
           StartId :: rt_chord:key(),
           Interval :: intervals:interval(),
           FilterFun :: fun((entry()) -> boolean()),
           ValueFun :: fun((entry()) -> V),
           AddDataFun ::
               fun((Key :: rt_chord:key(),
                    {Acc :: [V],
                     RemainingChunkSize :: pos_integer()}) ->
                       {Acc :: [V],
                        RemainingChunkSize :: pos_integer()}),
           ChunkSize :: pos_integer() | all) ->
              {intervals:interval(), [V]}

add_data/2

add_data(DB :: db(), Data :: db_as_list()) -> NewDB :: db()

Adds all db entry objects in the Data list.

get_entries/2

get_entries(DB :: db(), Range :: intervals:interval()) ->
               db_as_list()

Gets (non-empty) db entry objects in the given range.

record_changes/2

record_changes(OldDB :: db(), NewInterval :: intervals:interval()) ->
                  NewDB :: db()

Adds the new interval to the interval to record changes for. Entries which have (potentially) changed can then be gathered by get_changes/1.

stop_record_changes/2

stop_record_changes(OldDB :: db(),
                    Interval :: intervals:interval()) ->
                       NewDB :: db()

Stops recording changes in the given interval and removes all such entries from the table of changed keys.

get_changes/2

get_changes(DB :: db(), Interval :: intervals:interval()) ->
               {Changed :: db_as_list(),
                Deleted :: [rt_chord:key()]}

Gets all db entries in the given interval which have (potentially) been changed or deleted (might return objects that have not changed but have been touched by one of the DB setters).

delete_entries/2

delete_entries(DB :: db(),
               RangeOrFun :: intervals:interval()
                           | fun((entry()) -> boolean())) ->
                  NewDB :: db()

Deletes all objects in the given Range or (if a function is provided) for which the FilterFun returns true from the DB.

check_config/0

check_config() -> boolean()


Generated by EDoc, Sep 11 2020, 15:25:03.