Module yz_solrq_drain_fsm

Behaviours: gen_fsm.

Data Types

drain_param()

drain_param() = {exchange_fsm_pid, pid()} | {yz_index_hashtree_update_params, {tree(), p(), short_preflist()}} | {drain_partition, n()}

drain_params()

drain_params() = [drain_param()]

n()

n() = pos_integer()

p()

p() = non_neg_integer()

short_preflist()

short_preflist() = {p(), n()}

tree()

tree() = pid()

Function Index

cancel/2Cancel a drain.
code_change/4
drain_already_in_progress/2Notify the drain FSM identified by DPid that the solrq associated with the specified Token has an existing drain request in progress and cannot perform another drain at this time.
drain_complete/2Notify the drain FSM identified by DPid that the solrq associated with the specified Token has completed draining.
handle_event/3
handle_info/3
handle_sync_event/4
init/1
prepare/2We receive a start message in the prepare state when start_prepare/0 is called.
resume_workers/1
start_link/0Start the drain FSM process.
start_link/1 Creates a gen_fsm process which calls Module:init/1 to initialize.
start_prepare/1Start draining.
terminate/3
wait_for_drain_complete/2While in the wait state, we wait for drain_complete messages with accompanying tokens.
wait_for_snapshot_complete/2
wait_for_yz_hashtree_updated/2

Function Details

cancel/2

cancel(DPid::pid(), Timeout::non_neg_integer()) -> ok | no_proc | timeout

Cancel a drain. This operation will result in sending a cancel message to each of the solrqs, putting them back into a batching state.

code_change/4

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

drain_already_in_progress/2

drain_already_in_progress(DPid, Token) -> any()

Notify the drain FSM identified by DPid that the solrq associated with the specified Token has an existing drain request in progress and cannot perform another drain at this time.

NB. This function is typically called from each solrq.

drain_complete/2

drain_complete(DPid::pid(), Token::reference()) -> ok

Notify the drain FSM identified by DPid that the solrq associated with the specified Token has completed draining. Note that the solrq will remain in the wait_for_drain_complete state until it receives a drain_complete message back from the specified FSM.

NB. This function is typically called from each solrq.

handle_event/3

handle_event(Event, StateName, State) -> any()

handle_info/3

handle_info(Info, StateName, State) -> any()

handle_sync_event/4

handle_sync_event(Event, From, StateName, State) -> any()

init/1

init(Params) -> any()

prepare/2

prepare(X1, State) -> any()

We receive a start message in the prepare state when start_prepare/0 is called. This will initiate a drain on all the solrqs. This gives us a list of references (tokens) we wait for while in the wait state, the state in which we immediate move into.

resume_workers/1

resume_workers(Pid) -> any()

start_link/0

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

Start the drain FSM process. Note that the drain FSM will immediately go into the prepare state, but it will not start draining until start_prepate/0 is called.

start_link/1

start_link(Params::drain_params()) -> {ok, pid()} | ignore | {error, Reason::term()}

Creates a gen_fsm process which calls Module:init/1 to initialize. To ensure a synchronized start-up procedure, this function does not return until Module:init/1 has returned.

start_prepare/1

start_prepare(DPid::pid()) -> no_proc | timeout | term()

Start draining. This operation will send a start message to this FSM with a start message, which in turn will initiate drains on all of the solrqs.

NB. This function is typically called from the drain manager.

terminate/3

terminate(Reason, StateName, State) -> any()

wait_for_drain_complete/2

wait_for_drain_complete(X1, State) -> any()

While in the wait state, we wait for drain_complete messages with accompanying tokens. When we have received all of the tokens, we are done, and the FSM terminates normally. Otherwise, we keep waiting.

wait_for_snapshot_complete/2

wait_for_snapshot_complete(X1, State) -> any()

wait_for_yz_hashtree_updated/2

wait_for_yz_hashtree_updated(X1, State) -> any()


Generated by EDoc