View Source RaftedValue.Leadership (rafted_value v0.11.2)

Link to this section Summary

Functions

Type-aware getter for follower_responded_times.

Type-aware setter for follower_responded_times.

Type-aware getter for heartbeat_timer.

Type-aware setter for heartbeat_timer.

Creates a new instance of RaftedValue.Leadership by using the given dict.

A variant of new/1 which returns t or raise if validation fails.

Type-aware getter for quorum_timer.

Type-aware setter for quorum_timer.

Type-aware getter for quorum_timer_started_at.

Type-aware setter for quorum_timer_started_at.

Updates an existing instance of RaftedValue.Leadership with the given dict. The values in the dict are validated by each field's valid?/1 function. Returns {:ok, valid_struct} or {:error, reason}.

A variant of update/2 which returns t or raise if validation fails. In other words, update/2 followed by Croma.Result.get!/1.

Checks if the given value belongs to t/0 or not.

Link to this section Types

@type t() :: %RaftedValue.Leadership{
  follower_responded_times: Croma.Map.t(),
  heartbeat_timer: Croma.Reference.t(),
  quorum_timer: Croma.Reference.t(),
  quorum_timer_started_at: RaftedValue.Monotonic.t()
}

Link to this section Functions

Link to this function

can_safely_remove?(l, members, follower, config)

View Source
@spec can_safely_remove?(t(), RaftedValue.Members.t(), pid(), RaftedValue.Config.t()) ::
  boolean()
Link to this function

follower_responded(l, members, follower, timestamp, config)

View Source
@spec follower_responded(
  t(),
  RaftedValue.Members.t(),
  pid(),
  RaftedValue.Monotonic.t(),
  RaftedValue.Config.t()
) :: t()
Link to this function

follower_responded_times(leadership)

View Source
@spec follower_responded_times(t()) :: Croma.Map.t()

Type-aware getter for follower_responded_times.

Link to this function

follower_responded_times(s, field)

View Source
@spec follower_responded_times(t(), Croma.Map.t()) :: t()

Type-aware setter for follower_responded_times.

Link to this function

heartbeat_timer(leadership)

View Source
@spec heartbeat_timer(t()) :: Croma.Reference.t()

Type-aware getter for heartbeat_timer.

Link to this function

heartbeat_timer(s, field)

View Source
@spec heartbeat_timer(t(), Croma.Reference.t()) :: t()

Type-aware setter for heartbeat_timer.

Link to this function

lease_expired?(arg0, arg1, arg2)

View Source
@spec lease_expired?(t(), RaftedValue.Members.t(), RaftedValue.Config.t()) ::
  boolean()
@spec new(term()) :: Croma.Result.t(t())

Creates a new instance of RaftedValue.Leadership by using the given dict.

Values associated with the struct field names are fetched from the given dict and then validated/converted with valid?/1/new/1. For missing fields default values (if any) are used.

Returns {:ok, valid_struct} when all fields are filled with valid values. Returns {:error, reason} if any error occurs (invalid value or no value is available).

See also moduledoc of Croma.Struct.

@spec new!(term()) :: t()

A variant of new/1 which returns t or raise if validation fails.

In other words, new/1 followed by Croma.Result.get!/1.

@spec new_for_leader(RaftedValue.Config.t()) :: t()
Link to this function

quorum_timer(leadership)

View Source
@spec quorum_timer(t()) :: Croma.Reference.t()

Type-aware getter for quorum_timer.

@spec quorum_timer(t(), Croma.Reference.t()) :: t()

Type-aware setter for quorum_timer.

Link to this function

quorum_timer_started_at(leadership)

View Source
@spec quorum_timer_started_at(t()) :: RaftedValue.Monotonic.t()

Type-aware getter for quorum_timer_started_at.

Link to this function

quorum_timer_started_at(s, field)

View Source
@spec quorum_timer_started_at(t(), RaftedValue.Monotonic.t()) :: t()

Type-aware setter for quorum_timer_started_at.

Link to this function

remove_follower_response_time_entry(leadership, follower)

View Source
@spec remove_follower_response_time_entry(t(), pid()) :: t()
Link to this function

reset_heartbeat_timer(l, config)

View Source
@spec reset_heartbeat_timer(t(), RaftedValue.Config.t()) :: t()
Link to this function

reset_quorum_timer(l, config)

View Source
@spec reset_quorum_timer(t(), RaftedValue.Config.t()) :: t()
@spec stop_timers(t()) :: :ok
Link to this function

unresponsive_followers(arg0, members, config)

View Source
@spec unresponsive_followers(
  t(),
  RaftedValue.Members.t(),
  RaftedValue.Config.t()
) :: [pid()]
@spec update(t(), Dict.t()) :: Croma.Result.t(t())

Updates an existing instance of RaftedValue.Leadership with the given dict. The values in the dict are validated by each field's valid?/1 function. Returns {:ok, valid_struct} or {:error, reason}.

@spec update!(t(), Dict.t()) :: t()

A variant of update/2 which returns t or raise if validation fails. In other words, update/2 followed by Croma.Result.get!/1.

@spec valid?(term()) :: boolean()

Checks if the given value belongs to t/0 or not.