rafted_value v0.1.1 RaftedValue.Logs

Summary

Functions

Type-aware getter for followers

Type-aware setter for followers

Type-aware getter for i_committed

Type-aware setter for i_committed

Type-aware getter for i_max

Type-aware setter for i_max

Type-aware getter for i_min

Type-aware setter for i_min

Type-aware getter for map

Type-aware setter for map

Creates a new instance of Elixir.RaftedValue.Logs 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

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

Types

t :: %RaftedValue.Logs{followers: Croma.TypeGen.Nilable.RaftedValue.FollowerIndices.t, i_committed: RaftedValue.LogIndex.t, i_max: RaftedValue.LogIndex.t, i_min: RaftedValue.LogIndex.t, map: RaftedValue.LogsMap.t}

Functions

add_entry(logs, config, f)
append_entries(logs, members, entries, i_leader_commit, config)
candidate_log_up_to_date?(a0, candidate_log_info)

Specs

candidate_log_up_to_date?(RaftedValue.Logs.t, RaftedValue.LogInfo.t) :: boolean
commit_to_latest(logs, config)
contain_given_prev_log?(a0, a1)

Specs

contain_given_prev_log?(RaftedValue.Logs.t, {any, any}) :: boolean
decrement_next_index_of_follower(logs, follower_pid)

Specs

decrement_next_index_of_follower(RaftedValue.Logs.t, pid) :: t
elected_leader(logs, members, term, config)
followers(logs)

Specs

followers(t) :: Croma.TypeGen.Nilable.RaftedValue.FollowerIndices.t

Type-aware getter for followers.

followers(s, field)

Specs

followers(t, Croma.TypeGen.Nilable.RaftedValue.FollowerIndices.t) :: t

Type-aware setter for followers.

i_committed(logs)

Specs

i_committed(t) :: RaftedValue.LogIndex.t

Type-aware getter for i_committed.

i_committed(s, field)

Specs

i_committed(t, RaftedValue.LogIndex.t) :: t

Type-aware setter for i_committed.

i_max(logs)

Specs

Type-aware getter for i_max.

i_max(s, field)

Specs

Type-aware setter for i_max.

i_min(logs)

Specs

Type-aware getter for i_min.

i_min(s, field)

Specs

Type-aware setter for i_min.

last_committed_entry(a0)

Specs

last_committed_entry(RaftedValue.Logs.t) :: RaftedValue.LogEntry.t
last_entry(a0)
make_append_entries_req(logs, term, follower_pid)

Specs

make_append_entries_req(RaftedValue.Logs.t, RaftedValue.TermNumber.t, pid) ::
  {:ok, RaftedValue.RPC.AppendEntriesRequest.t} |
  {:too_old, t} |
  :error
map(logs)

Specs

Type-aware getter for map.

map(s, field)

Specs

Type-aware setter for map.

new(dict)

Specs

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

Creates a new instance of Elixir.RaftedValue.Logs 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_lonely_leader()

Specs

new_for_lonely_leader :: t
new_for_new_follower(last_committed_entry)

Specs

new_for_new_follower(RaftedValue.LogEntry.t) :: t
prepare_to_add_follower(logs, term, new_follower, config)
prepare_to_remove_follower(logs, term, follower_to_remove, config)
set_follower_index(logs, a1, current_term, follower_pid, i_replicated, config)
update(s, dict)

Specs

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

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

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.