View Source cozodb_callback_monitor (cozodb v0.2.1)
A transient worker that is used to listen to certain plum_db events and allow watchers to wait (blocking the caller) for certain conditions. This is used by plum_db_app during the startup process to wait for the following conditions:
- Partition initisalisation – the worker subscribes to plum_db notifications
and keeps track of each partition initialisation until they are all
initialised (or failed to initilised) and replies to all watchers with a
ok' or
{error, FailedPartitions}', where FailedPartitions is a map() which keys are the partition number and the value is the reason for the failure. - Partition hashtree build – the worker subscribes to plum_db notifications
and keeps track of each partition hashtree until they are all
built (or failed to build) and replies to all watchers with a
ok' or
{error, FailedHashtrees}', where FailedHashtrees is a map() which keys are the partition number and the value is the reason for the failure.
A watcher is any process which calls the functions wait_for_partitions/0,1 and/or wait_for_hashtrees/0,1. Both functions will block the caller until the above conditions are met.
Summary
Types
Functions
-spec handle_call(term(), {pid(), term()}, state()) -> {reply, term(), state()} | {reply, term(), state(), non_neg_integer()} | {reply, term(), state(), {continue, term()}} | {noreply, state()} | {noreply, state(), non_neg_integer()} | {noreply, state(), {continue, term()}} | {stop, term(), term(), state()} | {stop, term(), state()}.
-spec init([]) -> {ok, state()} | {ok, state(), non_neg_integer() | infinity} | ignore | {stop, term()}.
-spec stop() -> ok.