Skip to content

Module hb_store_rocksdb.erl

A process wrapper over rocksdb storage.

Behaviours: gen_server, hb_store.

Description

Replicates functionality of the hb_fs_store module.

Encodes the item types with the help of prefixes, see encode_value/2 and decode_value/1

Data Types

key()


key() = binary() | list()

value()


value() = binary() | list()

value_type()


value_type() = link | raw | group

Function Index

add_path/3Add two path components together.
code_change/3
collect/1*
collect/2*
convert_if_list/1*
decode_value/1*
do_read/2*
do_resolve/3*
do_write/3*Write given Key and Value to the database.
enabled/0Returns whether the RocksDB store is enabled.
encode_value/2*
ensure_dir/2*
ensure_dir/3*
ensure_list/1*Ensure that the given filename is a list, not a binary.
handle_call/3
handle_cast/2
handle_info/2
init/1
join/1*
list/0List all items registered in rocksdb store.
list/2Returns the full list of items stored under the given path.
make_group/2Creates group under the given path.
make_link/3
maybe_append_key_to_group/2*
maybe_convert_to_binary/1*
maybe_create_dir/3*
open_rockdb/1*
path/2Return path.
read/2Read data by the key.
reset/1
resolve/2Replace links in a path with the target of the link.
scope/1Return scope (local).
start/1
start_link/1Start the RocksDB store.
stop/1
terminate/2
type/2Get type of the current item.
write/3Write given Key and Value to the database.

Function Details

add_path/3

add_path(Opts, Path1, Path2) -> any()

Add two path components together. // is not used

code_change/3

code_change(OldVsn, State, Extra) -> any()

collect/1 *

collect(Iterator) -> any()

collect/2 *

collect(Iterator, Acc) -> any()

convert_if_list/1 *

convert_if_list(Value) -> any()

decode_value/1 *


decode_value(X1::binary()) -> {value_type(), binary()}


do_read/2 *

do_read(Opts, Key) -> any()

do_resolve/3 *

do_resolve(Opts, FinalPath, Rest) -> any()

do_write/3 *


do_write(Opts, Key, Value) -> Result
  • Opts = map()
  • Key = key()
  • Value = value()
  • Result = ok | {error, any()}

Write given Key and Value to the database

enabled/0

enabled() -> any()

Returns whether the RocksDB store is enabled.

encode_value/2 *


encode_value(X1::value_type(), Value::binary()) -> binary()


ensure_dir/2 *

ensure_dir(DBHandle, BaseDir) -> any()

ensure_dir/3 *

ensure_dir(DBHandle, CurrentPath, Rest) -> any()

ensure_list/1 *

ensure_list(Value) -> any()

Ensure that the given filename is a list, not a binary.

handle_call/3

handle_call(Request, From, State) -> any()

handle_cast/2

handle_cast(Request, State) -> any()

handle_info/2

handle_info(Info, State) -> any()

init/1

init(Dir) -> any()

join/1 *

join(Key) -> any()

list/0

list() -> any()

List all items registered in rocksdb store. Should be used only for testing/debugging, as the underlying operation is doing full traversal on the KV storage, and is slow.

list/2


list(Opts, Path) -> Result
  • Opts = any()
  • Path = any()
  • Result = {ok, [string()]} | {error, term()}

Returns the full list of items stored under the given path. Where the path child items is relevant to the path of parentItem. (Same as in hb_store_fs).

make_group/2


make_group(Opts, Key) -> Result
  • Opts = any()
  • Key = binary()
  • Result = ok | {error, already_added}

Creates group under the given path.

make_link/3


make_link(Opts::any(), Key1::key(), New::key()) -> ok


maybe_append_key_to_group/2 *

maybe_append_key_to_group(Key, CurrentDirContents) -> any()

maybe_convert_to_binary/1 *

maybe_convert_to_binary(Value) -> any()

maybe_create_dir/3 *

maybe_create_dir(DBHandle, DirPath, Value) -> any()

open_rockdb/1 *

open_rockdb(RawDir) -> any()

path/2

path(Opts, Path) -> any()

Return path

read/2


read(Opts, Key) -> Result
  • Opts = map()
  • Key = key() | list()
  • Result = {ok, value()} | not_found | {error, {corruption, string()}} | {error, any()}

Read data by the key. Recursively follows link messages

reset/1


reset(Opts::[]) -> ok | no_return()


resolve/2


resolve(Opts, Path) -> Result
  • Opts = any()
  • Path = binary() | list()
  • Result = not_found | string()

Replace links in a path with the target of the link.

scope/1

scope(X1) -> any()

Return scope (local)

start/1

start(Opts) -> any()

start_link/1

start_link(Opts) -> any()

Start the RocksDB store.

stop/1


stop(Opts::any()) -> ok


terminate/2

terminate(Reason, State) -> any()

type/2


type(Opts, Key) -> Result
  • Opts = map()
  • Key = binary()
  • Result = composite | simple | not_found

Get type of the current item

write/3


write(Opts, Key, Value) -> Result
  • Opts = map()
  • Key = key()
  • Value = value()
  • Result = ok | {error, any()}

Write given Key and Value to the database