raft_kv v0.1.1 RaftKV.Shard.Hook View Source

Link to this section Summary

Functions

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 Functions

Link to this function on_command_committed(data_before, command_arg, command_ret, data_after) View Source
on_command_committed(
  :uninitialized | RaftKV.Shard.t(),
  RaftedValue.Data.command_arg(),
  RaftedValue.Data.command_ret(),
  :uninitialized | RaftKV.Shard.t()
) :: any()

Hook to be called when a command submitted by RaftedValue.command/4 is committed.

Callback implementation for RaftedValue.LeaderHook.on_command_committed/4.

Link to this function on_elected(data) View Source
on_elected(:uninitialized | RaftKV.Shard.t()) :: any()

Hook to be called when a new leader is elected in a consensus group.

Callback implementation for RaftedValue.LeaderHook.on_elected/1.

Link to this function on_follower_added(data, pid) View Source
on_follower_added(:uninitialized | RaftKV.Shard.t(), pid()) :: any()

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.

Callback implementation for RaftedValue.LeaderHook.on_follower_added/2.

Link to this function on_follower_removed(data, pid) View Source
on_follower_removed(:uninitialized | RaftKV.Shard.t(), pid()) :: any()

Hook to be called when a follower is removed from a consensus group by RaftedValue.remove_follower/2.

Callback implementation for RaftedValue.LeaderHook.on_follower_removed/2.

Link to this function on_query_answered(data, query_arg, query_ret) View Source
on_query_answered(
  :uninitialized | RaftKV.Shard.t(),
  RaftedValue.Data.query_arg(),
  RaftedValue.Data.query_ret()
) :: any()

Hook to be called when a query given by RaftedValue.query/3 is executed.

Callback implementation for RaftedValue.LeaderHook.on_query_answered/3.

Link to this function on_restored_from_files(data) View Source
on_restored_from_files(:uninitialized | RaftKV.Shard.t()) :: any()

Hook to be called when a new leader restores its state from snapshot & log files.

Callback implementation for RaftedValue.LeaderHook.on_restored_from_files/1.