Module mnesia_rocksdb

rocksdb storage backend for Mnesia.

Behaviours: gen_server, mnesia_backend_type.

Description

rocksdb storage backend for Mnesia.

This module implements a mnesia backend callback plugin. It's specifically documented to try to explain the workings of backend plugins.

Data Types

alias()

alias() = atom()

data_tab()

data_tab() = atom()

error()

error() = {error, any()}

index_info()

index_info() = {index_pos(), index_type()}

index_pos()

index_pos() = integer() | {atom()}

index_tab()

index_tab() = {data_tab(), index, index_info()}

index_type()

index_type() = ordered

retainer_name()

retainer_name() = any()

retainer_tab()

retainer_tab() = {data_tab(), retainer, retainer_name()}

table()

table() = data_tab() | index_tab() | retainer_tab()

table_type()

table_type() = set | ordered_set | bag

Function Index

add_aliases/1
check_definition/4
close_table/2
code_change/3
create_schema/1
create_schema/2
create_table/3
decode_key/1
decode_key/2
decode_val/1
decode_val/3
default_alias/0
delete/3
delete_table/2
encode_key/1
encode_key/2
encode_val/1
encode_val/2
first/2
fixtable/3
handle_call/3
handle_cast/2
handle_info/2
index_is_consistent/3
info/3
init/1
init_backend/0Called by mnesia_schema in order to intialize the backend.
insert/3
is_index_consistent/2
ix_listvals/3
ix_prefixes/3
last/2
load_table/4
lookup/3
match_delete/3
next/3
prev/3
real_suffixes/0
receive_data/5
receive_done/4
receiver_first_message/4
register/0Equivalent to register(rocksdb_copies).
register/1Convenience function for registering a mnesia_rocksdb backend plugin.
remove_aliases/1
repair_continuation/2
select/1
select/3
select/4
semantics/2
sender_handle_info/5
sender_init/4
show_table/1A debug function that shows the rocksdb table content.
show_table/2
slot/3
start_proc/6
sync_close_table/2
terminate/2
tmp_suffixes/0
update_counter/4
validate_key/6
validate_record/6

Function Details

add_aliases/1

add_aliases(Aliases) -> any()

check_definition/4

check_definition(Alias, Tab, Nodes, Props) -> any()

close_table/2

close_table(Alias, Tab) -> any()

code_change/3

code_change(FromVsn, St, Extra) -> any()

create_schema/1

create_schema(Nodes) -> any()

create_schema/2

create_schema(Nodes, Aliases) -> any()

create_table/3

create_table(Alias, Tab, Props) -> any()

decode_key/1

decode_key(Key) -> any()

decode_key/2

decode_key(Key, Metadata) -> any()

decode_val/1

decode_val(Val) -> any()

decode_val/3

decode_val(Val, Key, Metadata) -> any()

default_alias/0

default_alias() -> any()

delete/3

delete(Alias, Tab, Key) -> any()

delete_table/2

delete_table(Alias, Tab) -> any()

encode_key/1

encode_key(Key) -> any()

encode_key/2

encode_key(Key, Metadata) -> any()

encode_val/1

encode_val(Val) -> any()

encode_val/2

encode_val(Val, Metadata) -> any()

first/2

first(Alias, Tab) -> any()

fixtable/3

fixtable(Alias, Tab, Bool) -> any()

handle_call/3

handle_call(M, From, St) -> any()

handle_cast/2

handle_cast(X1, St) -> any()

handle_info/2

handle_info(EXIT, St) -> any()

index_is_consistent/3

index_is_consistent(Alias, X2, Bool) -> any()

info/3

info(Alias, Tab, Item) -> any()

init/1

init(X1) -> any()

init_backend/0

init_backend() -> any()

Called by mnesia_schema in order to intialize the backend

This is called when the backend is registered with the first alias, or ...

See OTP issue #425 (16 Feb 2021). This callback is supposed to be called before first use of the backend, but unfortunately, it is only called at mnesia startup and when a backend module is registered MORE THAN ONCE. This means we need to handle this function being called multiple times.

The bug has been fixed as of OTP 24.0-rc3

If processes need to be started, this can be done using mnesia_ext_sup:start_proc(Name, Mod, F, Args [, Opts]) where Opts are parameters for the supervised child:

* restart (default: transient) * shutdown (default: 120000) * type (default: worker) * modules (default: [Mod])

insert/3

insert(Alias, Tab, Obj) -> any()

is_index_consistent/2

is_index_consistent(Alias, X2) -> any()

ix_listvals/3

ix_listvals(Tab, Pos, Obj) -> any()

ix_prefixes/3

ix_prefixes(Tab, Pos, Obj) -> any()

last/2

last(Alias, Tab) -> any()

load_table/4

load_table(Alias, Tab, LoadReason, Props) -> any()

lookup/3

lookup(Alias, Tab, Key) -> any()

match_delete/3

match_delete(Alias, Tab, Pat) -> any()

next/3

next(Alias, Tab, Key) -> any()

prev/3

prev(Alias, Tab, Key) -> any()

real_suffixes/0

real_suffixes() -> any()

receive_data/5

receive_data(Data, Alias, Tab, Sender, State) -> any()

receive_done/4

receive_done(Alias, Tab, Sender, State) -> any()

receiver_first_message/4

receiver_first_message(Pid, Msg, Alias, Tab) -> any()

register/0

register() -> {ok, alias()} | {error, term()}

Equivalent to register(rocksdb_copies).

register/1

register(Alias::alias()) -> {ok, alias()} | error()

Convenience function for registering a mnesia_rocksdb backend plugin

The function used to register a plugin is mnesia_schema:add_backend_type(Alias, Module) where Module implements a backend_type behavior. Alias is an atom, and is used in the same way as ram_copies etc. The default alias is rocksdb_copies.

remove_aliases/1

remove_aliases(Aliases) -> any()

repair_continuation/2

repair_continuation(Cont, Ms) -> any()

select/1

select(Cont) -> any()

select/3

select(Alias, Tab, Ms) -> any()

select/4

select(Alias, IxTab, Ms, Limit) -> any()

semantics/2

semantics(Alias, X2) -> any()

sender_handle_info/5

sender_handle_info(Msg, Alias, Tab, ReceiverPid, Cont) -> any()

sender_init/4

sender_init(Alias, Tab, RemoteStorage, Pid) -> any()

show_table/1

show_table(Tab) -> any()

A debug function that shows the rocksdb table content

show_table/2

show_table(Tab, Limit) -> any()

slot/3

slot(Alias, Tab, Pos) -> any()

start_proc/6

start_proc(Alias, Tab, Type, ProcName, Props, RdbOpts) -> any()

sync_close_table/2

sync_close_table(Alias, Tab) -> any()

terminate/2

terminate(Reason, St) -> any()

tmp_suffixes/0

tmp_suffixes() -> any()

update_counter/4

update_counter(Alias, Tab, C, Val) -> any()

validate_key/6

validate_key(Alias, Tab, RecName, Arity, Type, Key) -> any()

validate_record/6

validate_record(Alias, Tab, RecName, Arity, Type, Obj) -> any()


Generated by EDoc