command() = {command_type(), command_meta(), UserCommand::term(), command_reply_mode()} | {noop, command_meta(), CurrentMachineVersion::ra_machine:version()}
command_correlation() = integer() | reference()
command_meta() = #{from => from(), ts := integer()}
command_reply_mode() = after_log_append | await_consensus | {notify, command_correlation(), pid()} | noreply
command_type() = '$usr' | '$ra_join' | '$ra_leave' | '$ra_cluster_change' | '$ra_cluster'
config() = ra_server_config()
machine_conf() = {module, module(), InitConfig::map()} | {simple, simple_apply_fun(term()), InitialState::term()}
The machine configuration.
This is how ra knows which module to use to invoke the ra_machine callbacks
and the config to pass to the ra_machine:init/1
implementation.
The simple machine config is version that can only be used for simple state
machines that cannot access any of the advanced features.
ra_await_condition_fun() = fun((ra_msg(), ra_server_state()) -> {boolean(), ra_server_state()})
ra_effect() = ra_machine:effect() | ra_log:effect() | {reply, ra_reply_body()} | {reply, term(), ra_reply_body()} | {cast, ra_server_id(), term()} | {send_vote_requests, [{ra_server_id(), #request_vote_rpc{} | #pre_vote_rpc{}}]} | {send_rpc, ra_server_id(), #append_entries_rpc{}} | {send_snapshot, To::ra_server_id(), {Module::module(), Ref::term(), LeaderId::ra_server_id(), Term::ra_term()}} | {next_event, ra_msg()} | {next_event, cast, ra_msg()} | {notify, pid(), reference()} | {incr_metrics, Table::atom(), [{Pos::non_neg_integer(), Incr::integer()}]} | {record_leader_msg, ra_server_id()} | start_election_timeout
ra_effects() = [ra_effect()]
ra_event_formatter_fun() = fun((ra_server_id(), Evt::term()) -> term())
ra_msg() = #append_entries_rpc{} | {ra_server_id(), #append_entries_reply{}} | {ra_server_id(), #install_snapshot_result{}} | #request_vote_rpc{} | #request_vote_result{} | #pre_vote_rpc{} | #pre_vote_result{} | #install_snapshot_rpc{} | election_timeout | await_condition_timeout | {command, command()} | {commands, [command()]} | ra_log:event() | {consistent_query, term(), ra:query_fun()} | #heartbeat_rpc{} | {ra_server_id, #heartbeat_reply{}}
ra_reply_body() = #append_entries_reply{} | #request_vote_result{} | #install_snapshot_result{} | #pre_vote_result{}
ra_server_config() = #{id := ra_server_id(), uid := ra_uid(), cluster_name := ra_cluster_name(), log_init_args := ra_log:ra_log_init_args(), initial_members := [ra_server_id()], machine := machine_conf(), friendly_name => unicode:chardata(), metrics_key => term(), broadcast_time => non_neg_integer(), tick_timeout => non_neg_integer(), await_condition_timeout => non_neg_integer(), low_priority_commands_flush_size => non_neg_integer(), ra_event_formatter => {module(), atom(), [term()]}}
ra_server_state() = #{id := {ra_server_id(), ra_uid(), unicode:chardata()}, leader_id => maybe(ra_server_id()), cluster := ra_cluster(), cluster_change_permitted := boolean(), cluster_index_term := ra_idxterm(), pending_cluster_changes := [term()], previous_cluster => {ra_index(), ra_term(), ra_cluster()}, current_term := ra_term(), log := term(), voted_for => maybe(ra_server_id()), votes => non_neg_integer(), commit_index := ra_index(), last_applied := ra_index(), persisted_last_applied => ra_index(), stop_after => ra_index(), machine := ra_machine:machine(), machine_state := term(), machine_version := ra_machine:version(), machine_versions := [{ra_index(), ra_machine:version()}, ...], metrics_key := term(), effective_machine_version := ra_machine:version(), effective_machine_module := module(), aux_state => term(), condition => ra_await_condition_fun(), condition_timeout_changes => #{transition_to := ra_state(), effects := [ra_effect()]}, pre_vote_token => reference(), query_index := non_neg_integer(), queries_waiting_heartbeats := queue:queue({non_neg_integer(), consistent_query_ref()}), pending_consistent_queries := [consistent_query_ref()], commit_latency => maybe(non_neg_integer())}
ra_state() = leader | follower | candidate | pre_vote | await_condition | delete_and_terminate | terminating_leader | terminating_follower | recover | recovered | stop | receive_snapshot
simple_apply_fun(State) = fun((term(), State) -> State)
current_term(State::ra_server_state()) -> maybe(ra_term())
handle_aux(RaftState, Type, Cmd, State0) -> any()
handle_await_condition(Request_vote_rpc::ra_msg(), State::ra_server_state()) -> {ra_state(), ra_server_state(), ra_effects()}
handle_candidate(Request_vote_result::ra_msg() | election_timeout, State0::ra_server_state()) -> {ra_state(), ra_server_state(), ra_effects()}
handle_down(RaftState::ra_state(), Type::machine | snapshot_sender | snapshot_writer, Pid::pid(), Info::term(), State::ra_server_state()) -> {ra_state(), ra_server_state(), ra_effects()}
handle_follower(Append_entries_rpc::ra_msg(), State00::ra_server_state()) -> {ra_state(), ra_server_state(), ra_effects()}
handle_leader(Install_snapshot_rpc::ra_msg(), State0::ra_server_state()) -> {ra_state(), ra_server_state(), ra_effects()}
handle_pre_vote(Append_entries_rpc::ra_msg(), State0::ra_server_state()) -> {ra_state(), ra_server_state(), ra_effects()}
handle_receive_snapshot(Install_snapshot_rpc, State0) -> any()
handle_state_enter(RaftState::ra_state() | eol, State::ra_server_state()) -> {ra_server_state() | eol, ra_effects()}
id(X1::ra_server_state()) -> ra_server_id()
init(Config::ra_server_config()) -> ra_server_state()
is_fully_persisted(X1::ra_server_state()) -> boolean()
is_fully_replicated(State::ra_server_state()) -> boolean()
is_new(X1::ra_server_state()) -> boolean()
leader_id(State::ra_server_state()) -> maybe(ra_server_id())
log_fold(RaState::ra_server_state(), Fun::fun((term(), State) -> State), State) -> {ok, State, ra_server_state()} | {error, term(), ra_server_state()}
make_rpcs(State) -> any()
metrics(State::ra_server_state()) -> {atom(), ra_term(), ra_index(), ra_index(), ra_index(), ra_index(), non_neg_integer()}
name(ClusterName::ra_cluster_name(), UniqueSuffix::string()) -> atom()
overview(State::ra_server_state()) -> map()
persist_last_applied(State::ra_server_state()) -> ra_server_state()
process_new_leader_queries(State0::ra_server_state()) -> {ra_server_state(), [from()]}
read_at(Idx::ra_index(), RaState::ra_server_state()) -> {ok, term(), ra_server_state()} | {error, ra_server_state()}
recover(State0) -> any()
terminate(State::ra_server_state(), Reason::{shutdown, delete} | term()) -> ok
tick(X1::ra_server_state()) -> ra_effects()
uid(X1::ra_server_state()) -> ra_uid()
update_peer_status(PeerId::ra_server_id(), Status::ra_peer_status(), State::ra_server_state()) -> ra_server_state()
update_release_cursor(Index::ra_index(), MacState::term(), State::ra_server_state()) -> {ra_server_state(), ra_effects()}
Generated by EDoc