Module riak_core_metadata_hashtree

Behaviours: gen_server.

Data Types

metadata_key()

metadata_key() = any()

metadata_pkey()

metadata_pkey() = {metadata_prefix(), metadata_key()}

metadata_prefix()

metadata_prefix() = {binary() | atom(), binary() | atom()}

Function Index

code_change/3
compare/3Compare the local tree managed by this process with the remote tree also managed by a metadata hashtree process.
get_bucket/4Return the bucket for a node in the tree managed by this process running on Node.
handle_call/3
handle_cast/2
handle_info/2
init/1
insert/2Same as insert(PKey, Hash, false).
insert/3Insert a hash for a full-prefix and key into the tree managed by the process.
key_hashes/3Return the key hashes for a node in the tree managed by this process running on Node.
lock/0Locks the tree on this node for updating on behalf of the calling process.
lock/1Locks the tree on Node for updating on behalf of the calling process.
lock/2Lock the tree for updating.
prefix_hash/1Return the hash for the given prefix or full-prefix.
start_link/0Starts the process using start_link/1, passing in the directory where other cluster metadata is stored in platform_data_dir as the data root.
start_link/1Starts a registered process that manages a hashtree_tree for Cluster Metadata.
terminate/2
update/0Updates the tree on this node.
update/1Updates the tree on Node.

Function Details

code_change/3

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

compare/3

compare(RemoteFun::hashtree_tree:remote_fun(), HandlerFun::hashtree_tree:handler_fun(X), X) -> X

Compare the local tree managed by this process with the remote tree also managed by a metadata hashtree process. RemoteFun is used to access the buckets and segments of nodes in the remote tree and should usually call get_bucket/4 and key_hashes/3. HandlerFun is used to process the differences found between the two trees. HandlerAcc is passed to the first invocation of HandlerFun. Subsequent calls are passed the return value from the previous call. This function returns the return value from the last call to HandlerFun. hashtree_tree for more details on RemoteFun, HandlerFun and HandlerAcc.

get_bucket/4

get_bucket(Node::node(), Prefixes::hashtree_tree:tree_node(), Level::non_neg_integer(), Bucket::non_neg_integer()) -> orddict:orddict()

Return the bucket for a node in the tree managed by this process running on Node.

handle_call/3

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

handle_cast/2

handle_cast(Msg, State) -> any()

handle_info/2

handle_info(X1, State) -> any()

init/1

init(X1) -> any()

insert/2

insert(PKey::metadata_pkey(), Hash::binary()) -> ok

Same as insert(PKey, Hash, false).

insert/3

insert(PKey::metadata_pkey(), Hash::binary(), IfMissing::boolean()) -> ok

Insert a hash for a full-prefix and key into the tree managed by the process. If IfMissing is true the hash is only inserted into the tree if the key is not already present.

key_hashes/3

key_hashes(Node::node(), Prefixes::hashtree_tree:tree_node(), Segment::non_neg_integer()) -> orddict:orddict()

Return the key hashes for a node in the tree managed by this process running on Node.

lock/0

lock() -> ok | not_built | locked

Locks the tree on this node for updating on behalf of the calling process.

See also: lock/2.

lock/1

lock(Node::node()) -> ok | not_built | locked

Locks the tree on Node for updating on behalf of the calling process.

See also: lock/2.

lock/2

lock(Node::node(), Pid::pid()) -> ok | not_built | locked

Lock the tree for updating. This function must be called before updating the tree with update/0 or update/1. If the tree is not built or already locked then the call will fail and the appropriate atom is returned. Otherwise, aqcuiring the lock succeeds and ok is returned.

prefix_hash/1

prefix_hash(Prefix::metadata_prefix() | binary() | atom()) -> undefined | binary()

Return the hash for the given prefix or full-prefix

start_link/0

start_link() -> {ok, pid()} | ignore | {error, term()}

Starts the process using start_link/1, passing in the directory where other cluster metadata is stored in platform_data_dir as the data root.

start_link/1

start_link(DataRoot::file:filename()) -> {ok, pid()} | ignore | {error, term()}

Starts a registered process that manages a hashtree_tree for Cluster Metadata. Data for the tree is stored, for the lifetime of the process (assuming it shutdowns gracefully), in the directory DataRoot.

terminate/2

terminate(Reason, State) -> any()

update/0

update() -> ok | not_locked | not_built | ongoing_update

Updates the tree on this node.

See also: update/1.

update/1

update(Node::node()) -> ok | not_locked | not_built | ongoing_update

Updates the tree on Node. The tree must be locked using one of the lock functions. If the tree is not locked or built the update will not be started and the appropriate atom is returned. Although this function should not be called without a lock, if it is and the tree is being updated by the background tick then ongoing_update is returned. If the tree is built and a lock has been acquired then the update is started and ok is returned. The update is performed asynchronously and does not block the process that manages the tree (e.g. future inserts).


Generated by EDoc