ExRaft.StateMachine behaviour (ExRaft v0.1.0) View Source

Link to this section Summary

Link to this section Types

Specs

side_effect() :: {:mfa, mfa()}

Specs

state() :: any()

Link to this section Callbacks

Link to this callback

command?(command, state)

View Source (optional)

Specs

command?(command :: any(), state :: state()) :: boolean()
Link to this callback

handle_read(query, state)

View Source

Specs

handle_read(query :: any(), state :: state()) :: any()
Link to this callback

handle_system_write(atom, state)

View Source (optional)

Specs

handle_system_write(:config, state :: state()) ::
  {:ok, state()} | {:ok, state(), [side_effect()]}
Link to this callback

handle_write(command, state)

View Source

Specs

handle_write(command :: any(), state :: state()) ::
  {any(), state()} | {any(), state(), [side_effect()]}
Link to this callback

init(init_arg)

View Source (optional)

Specs

init(init_arg :: any()) :: {:ok, state()} | {:stop, any()}
Link to this callback

terminate(reason, state)

View Source (optional)

Specs

terminate(reason :: any(), state :: state()) :: :ok
Link to this callback

transition(to_state, state)

View Source (optional)

Specs

transition(to_state :: :follower | :candidate | :leader, state :: state()) ::
  any()