rafted_value v0.11.1 RaftedValue.LeaderHook behaviour View Source
A behaviour module for hooks that are invoked in leader.
Note that there are cases where hooks are invoked multiple times for a single event due to leader change.
Link to this section Summary
Callbacks
Hook to be called when a command submitted by RaftedValue.command/4
is committed.
Hook to be called when a new leader is elected in a consensus group.
Hook to be called when a new follower is added to a consensus group
by RaftedValue.start_link/2
with :join_existing_consensus_group
specified.
Hook to be called when a follower is removed from a consensus group by RaftedValue.remove_follower/2
.
Hook to be called when a query given by RaftedValue.query/3
is executed.
Hook to be called when a new leader restores its state from snapshot & log files.
Link to this section Types
neglected()
View Source
neglected() :: any()
neglected() :: any()
Link to this section Callbacks
on_command_committed(data_before_command, command_arg, command_ret, data_after_command)
View Source
on_command_committed(
data_before_command :: RaftedValue.Data.data(),
command_arg :: RaftedValue.Data.command_arg(),
command_ret :: RaftedValue.Data.command_ret(),
data_after_command :: RaftedValue.Data.data()
) :: neglected()
on_command_committed( data_before_command :: RaftedValue.Data.data(), command_arg :: RaftedValue.Data.command_arg(), command_ret :: RaftedValue.Data.command_ret(), data_after_command :: RaftedValue.Data.data() ) :: neglected()
Hook to be called when a command submitted by RaftedValue.command/4
is committed.
on_elected(arg1)
View Source
on_elected(RaftedValue.Data.data()) :: neglected()
on_elected(RaftedValue.Data.data()) :: neglected()
Hook to be called when a new leader is elected in a consensus group.
on_follower_added(arg1, pid)
View Source
on_follower_added(RaftedValue.Data.data(), pid()) :: neglected()
on_follower_added(RaftedValue.Data.data(), pid()) :: neglected()
Hook to be called when a new follower is added to a consensus group
by RaftedValue.start_link/2
with :join_existing_consensus_group
specified.
on_follower_removed(arg1, pid)
View Source
on_follower_removed(RaftedValue.Data.data(), pid()) :: neglected()
on_follower_removed(RaftedValue.Data.data(), pid()) :: neglected()
Hook to be called when a follower is removed from a consensus group by RaftedValue.remove_follower/2
.
on_query_answered(data, query_arg, query_ret)
View Source
on_query_answered(
data :: RaftedValue.Data.data(),
query_arg :: RaftedValue.Data.query_arg(),
query_ret :: RaftedValue.Data.query_ret()
) :: neglected()
on_query_answered( data :: RaftedValue.Data.data(), query_arg :: RaftedValue.Data.query_arg(), query_ret :: RaftedValue.Data.query_ret() ) :: neglected()
Hook to be called when a query given by RaftedValue.query/3
is executed.
on_restored_from_files(arg1)
View Source
on_restored_from_files(RaftedValue.Data.data()) :: neglected()
on_restored_from_files(RaftedValue.Data.data()) :: neglected()
Hook to be called when a new leader restores its state from snapshot & log files.