rafted_value v0.10.3 RaftedValue.Election View Source

Link to this section Summary

Functions

Type-aware getter for leader_message_at

Type-aware setter for leader_message_at

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

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

Type-aware getter for timer

Type-aware setter for timer

Updates an existing instance of RaftedValue.Election 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

Type-aware getter for voted_for

Type-aware setter for voted_for

Type-aware getter for votes

Type-aware setter for votes

Link to this section Types

Link to this type t() View Source
t() :: %RaftedValue.Election{
  leader_message_at: Croma.TypeGen.Nilable.RaftedValue.Monotonic.t(),
  timer: Croma.TypeGen.Nilable.Croma.Reference.t(),
  voted_for: Croma.TypeGen.Nilable.Croma.Pid.t(),
  votes: Croma.TypeGen.Nilable.RaftedValue.PidSet.t()
}

Link to this section Functions

Link to this function leader_message_at(election) View Source
leader_message_at(t()) :: Croma.TypeGen.Nilable.RaftedValue.Monotonic.t()

Type-aware getter for leader_message_at.

Link to this function leader_message_at(s, field) View Source
leader_message_at(t(), Croma.TypeGen.Nilable.RaftedValue.Monotonic.t()) ::
  t()

Type-aware setter for leader_message_at.

Link to this function minimum_timeout_elapsed_since_last_leader_message?(a0, a1) View Source
minimum_timeout_elapsed_since_last_leader_message?(
  RaftedValue.Election.t(),
  RaftedValue.Config.t()
) :: boolean()

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

For missing fields, default/0 of each field type will be used.

Returns {:ok, valid_struct} or {:error, reason}. The values in the dict are validated by each field’s valid?/1 function.

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

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

Link to this function new_for_follower(config) View Source
new_for_follower(RaftedValue.Config.t()) :: t()
Link to this function new_for_leader() View Source
new_for_leader() :: t()

Type-aware getter for timer.

Type-aware setter for timer.

Updates an existing instance of RaftedValue.Election 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}.

Link to this function update!(s, dict) View Source
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.

Link to this function update_for_candidate(e, config) View Source
update_for_candidate(RaftedValue.Election.t(), RaftedValue.Config.t()) :: t()
Link to this function update_for_follower(e, config) View Source
update_for_follower(RaftedValue.Election.t(), RaftedValue.Config.t()) :: t()

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

Link to this function vote_for(e, candidate, config) View Source

Type-aware getter for voted_for.

Type-aware setter for voted_for.

Link to this function votes(election) View Source
votes(t()) :: Croma.TypeGen.Nilable.RaftedValue.PidSet.t()

Type-aware getter for votes.

Link to this function votes(s, field) View Source
votes(t(), Croma.TypeGen.Nilable.RaftedValue.PidSet.t()) :: t()

Type-aware setter for votes.