rafted_value v0.1.1 RaftedValue.Election

Summary

Functions

Type-aware getter for leader_message_at

Type-aware setter for leader_message_at

Creates a new instance of Elixir.RaftedValue.Election by using the given dict and the default value of each field. Returns {:ok, valid_struct} or {:error, reason}. The values in the dict are validated by each field’s validate/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

Type-aware getter for timer

Type-aware setter for timer

Updates an existing instance of Elixir.RaftedValue.Election with the given dict. The values in the dict are validated by each field’s validate/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 that the given dict is valid or not by using each field’s validate/1 function. Returns {:ok, valid_struct} or {:error, reason}

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

Type-aware getter for voted_for

Type-aware setter for voted_for

Type-aware getter for votes

Type-aware setter for votes

Types

t :: %RaftedValue.Election{leader_message_at: Croma.TypeGen.Nilable.Croma.Integer.t, timer: Croma.TypeGen.Nilable.Croma.Reference.t, voted_for: Croma.TypeGen.Nilable.Croma.Pid.t, votes: Croma.TypeGen.Nilable.RaftedValue.PidSet.t}

Functions

gain_vote(e, a1, voter)

Specs

gain_vote(RaftedValue.Election.t, RaftedValue.Members.t, pid) :: {t, boolean}
leader_message_at(election)

Specs

leader_message_at(t) :: Croma.TypeGen.Nilable.Croma.Integer.t

Type-aware getter for leader_message_at.

leader_message_at(s, field)

Specs

leader_message_at(t, Croma.TypeGen.Nilable.Croma.Integer.t) :: t

Type-aware setter for leader_message_at.

minimum_timeout_elapsed_since_last_leader_message?(a0, a1)

Specs

minimum_timeout_elapsed_since_last_leader_message?(RaftedValue.Election.t, RaftedValue.Config.t) :: boolean
new(dict)

Specs

new(Dict.t) :: Croma.Result.t(t)

Creates a new instance of Elixir.RaftedValue.Election by using the given dict and the default value of each field. Returns {:ok, valid_struct} or {:error, reason}. The values in the dict are validated by each field’s validate/1 function.

new!(dict)

Specs

new!(Dict.t) :: 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.

new_for_follower(config)

Specs

new_for_follower(RaftedValue.Config.t) :: t
new_for_leader()

Specs

new_for_leader :: t
reset_timer(e, config)
timer(election)

Specs

timer(t) :: Croma.TypeGen.Nilable.Croma.Reference.t

Type-aware getter for timer.

timer(s, field)

Specs

timer(t, Croma.TypeGen.Nilable.Croma.Reference.t) :: t

Type-aware setter for timer.

update(s, dict)

Specs

update(t, Dict.t) :: Croma.Result.t(t)

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

update!(s, dict)

Specs

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.

update_for_candidate(e, config)

Specs

update_for_candidate(RaftedValue.Election.t, RaftedValue.Config.t) :: t
update_for_follower(e, config)

Specs

update_for_follower(RaftedValue.Election.t, RaftedValue.Config.t) :: t
validate(dict)

Specs

validate(Dict.t) :: Croma.Result.t(t)

Checks that the given dict is valid or not by using each field’s validate/1 function. Returns {:ok, valid_struct} or {:error, reason}.

validate!(dict)

Specs

validate!(Dict.t) :: t

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

vote_for(e, candidate, config)

Specs

voted_for(election)

Specs

voted_for(t) :: Croma.TypeGen.Nilable.Croma.Pid.t

Type-aware getter for voted_for.

voted_for(s, field)

Specs

voted_for(t, Croma.TypeGen.Nilable.Croma.Pid.t) :: t

Type-aware setter for voted_for.

votes(election)

Specs

votes(t) :: Croma.TypeGen.Nilable.RaftedValue.PidSet.t

Type-aware getter for votes.

votes(s, field)

Specs

votes(t, Croma.TypeGen.Nilable.RaftedValue.PidSet.t) :: t

Type-aware setter for votes.