rafted_value v0.11.1 RaftedValue.Logs View Source
Link to this section 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 RaftedValue.Logs by using the given dict
.
A variant of new/1
which returns t
or raise if validation fails.
Updates an existing instance of RaftedValue.Logs 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
t()
View Source
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()
}
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() }
Link to this section Functions
add_entry(logs, persistence, f)
View Source
add_entry(
RaftedValue.Logs.t(),
nil | RaftedValue.Persistence.t(),
(RaftedValue.LogIndex.t() -> RaftedValue.LogEntry.t())
) :: {t(), RaftedValue.LogEntry.t()}
add_entry( RaftedValue.Logs.t(), nil | RaftedValue.Persistence.t(), (RaftedValue.LogIndex.t() -> RaftedValue.LogEntry.t()) ) :: {t(), RaftedValue.LogEntry.t()}
add_entry_on_add_follower(logs, term, new_follower, persistence)
View Source
add_entry_on_add_follower(
RaftedValue.Logs.t(),
RaftedValue.TermNumber.t(),
pid(),
nil | RaftedValue.Persistence.t()
) :: {t(), RaftedValue.LogEntry.t()}
add_entry_on_add_follower( RaftedValue.Logs.t(), RaftedValue.TermNumber.t(), pid(), nil | RaftedValue.Persistence.t() ) :: {t(), RaftedValue.LogEntry.t()}
add_entry_on_elected_leader(logs, members, term, persistence)
View Source
add_entry_on_elected_leader(
RaftedValue.Logs.t(),
RaftedValue.Members.t(),
RaftedValue.TermNumber.t(),
nil | RaftedValue.Persistence.t()
) :: {t(), RaftedValue.LogEntry.t()}
add_entry_on_elected_leader( RaftedValue.Logs.t(), RaftedValue.Members.t(), RaftedValue.TermNumber.t(), nil | RaftedValue.Persistence.t() ) :: {t(), RaftedValue.LogEntry.t()}
add_entry_on_remove_follower(logs, term, follower_to_remove, persistence)
View Source
add_entry_on_remove_follower(
RaftedValue.Logs.t(),
RaftedValue.TermNumber.t(),
pid(),
nil | RaftedValue.Persistence.t()
) :: {t(), RaftedValue.LogEntry.t()}
add_entry_on_remove_follower( RaftedValue.Logs.t(), RaftedValue.TermNumber.t(), pid(), nil | RaftedValue.Persistence.t() ) :: {t(), RaftedValue.LogEntry.t()}
add_entry_on_restored_from_files(logs, term)
View Source
add_entry_on_restored_from_files(t(), RaftedValue.TermNumber.t()) ::
{t(), RaftedValue.LogEntry.t()}
add_entry_on_restored_from_files(t(), RaftedValue.TermNumber.t()) :: {t(), RaftedValue.LogEntry.t()}
append_entries(logs, members0, entries, i_leader_commit, persistence)
View Source
append_entries(
RaftedValue.Logs.t(),
RaftedValue.Members.t(),
[RaftedValue.LogEntry.t()],
RaftedValue.LogIndex.t(),
nil | RaftedValue.Persistence.t()
) ::
{t(), RaftedValue.Members.t(), [RaftedValue.LogEntry.t()],
[RaftedValue.LogEntry.t()]}
append_entries( RaftedValue.Logs.t(), RaftedValue.Members.t(), [RaftedValue.LogEntry.t()], RaftedValue.LogIndex.t(), nil | RaftedValue.Persistence.t() ) :: {t(), RaftedValue.Members.t(), [RaftedValue.LogEntry.t()], [RaftedValue.LogEntry.t()]}
candidate_log_up_to_date?(arg0, candidate_log_info)
View Source
candidate_log_up_to_date?(RaftedValue.Logs.t(), RaftedValue.LogInfo.t()) ::
boolean()
candidate_log_up_to_date?(RaftedValue.Logs.t(), RaftedValue.LogInfo.t()) :: boolean()
commit_to_latest(logs, persistence)
View Source
commit_to_latest(RaftedValue.Logs.t(), nil | RaftedValue.Persistence.t()) ::
{t(), [RaftedValue.LogEntry.t()]}
commit_to_latest(RaftedValue.Logs.t(), nil | RaftedValue.Persistence.t()) :: {t(), [RaftedValue.LogEntry.t()]}
contain_given_prev_log?(arg0, arg1)
View Source
contain_given_prev_log?(RaftedValue.Logs.t(), {any(), any()}) :: boolean()
contain_given_prev_log?(RaftedValue.Logs.t(), {any(), any()}) :: boolean()
decrement_next_index_of_follower(logs, follower_pid)
View Source
decrement_next_index_of_follower(RaftedValue.Logs.t(), pid()) :: t()
decrement_next_index_of_follower(RaftedValue.Logs.t(), pid()) :: t()
followers(logs)
View Source
followers(t()) :: Croma.TypeGen.Nilable.RaftedValue.FollowerIndices.t()
followers(t()) :: Croma.TypeGen.Nilable.RaftedValue.FollowerIndices.t()
Type-aware getter for followers.
followers(s, field) View Source
Type-aware setter for followers.
i_committed(logs)
View Source
i_committed(t()) :: RaftedValue.LogIndex.t()
i_committed(t()) :: RaftedValue.LogIndex.t()
Type-aware getter for i_committed.
i_committed(s, field)
View Source
i_committed(t(), RaftedValue.LogIndex.t()) :: t()
i_committed(t(), RaftedValue.LogIndex.t()) :: t()
Type-aware setter for i_committed.
i_max(logs)
View Source
i_max(t()) :: RaftedValue.LogIndex.t()
i_max(t()) :: RaftedValue.LogIndex.t()
Type-aware getter for i_max.
i_max(s, field)
View Source
i_max(t(), RaftedValue.LogIndex.t()) :: t()
i_max(t(), RaftedValue.LogIndex.t()) :: t()
Type-aware setter for i_max.
i_min(logs)
View Source
i_min(t()) :: RaftedValue.LogIndex.t()
i_min(t()) :: RaftedValue.LogIndex.t()
Type-aware getter for i_min.
i_min(s, field)
View Source
i_min(t(), RaftedValue.LogIndex.t()) :: t()
i_min(t(), RaftedValue.LogIndex.t()) :: t()
Type-aware setter for i_min.
last_committed_entry(arg0)
View Source
last_committed_entry(RaftedValue.Logs.t()) :: RaftedValue.LogEntry.t()
last_committed_entry(RaftedValue.Logs.t()) :: RaftedValue.LogEntry.t()
last_entry(arg0)
View Source
last_entry(RaftedValue.Logs.t()) :: RaftedValue.LogEntry.t()
last_entry(RaftedValue.Logs.t()) :: RaftedValue.LogEntry.t()
make_append_entries_req(logs, term, follower_pid, now)
View Source
make_append_entries_req(
RaftedValue.Logs.t(),
RaftedValue.TermNumber.t(),
pid(),
integer()
) ::
{:ok, RaftedValue.RPC.AppendEntriesRequest.t()} | {:too_old, t()} | :error
make_append_entries_req( RaftedValue.Logs.t(), RaftedValue.TermNumber.t(), pid(), integer() ) :: {:ok, RaftedValue.RPC.AppendEntriesRequest.t()} | {:too_old, t()} | :error
map(logs)
View Source
map(t()) :: RaftedValue.LogsMap.t()
map(t()) :: RaftedValue.LogsMap.t()
Type-aware getter for map.
map(s, field)
View Source
map(t(), RaftedValue.LogsMap.t()) :: t()
map(t(), RaftedValue.LogsMap.t()) :: t()
Type-aware setter for map.
new(dict)
View Source
new(term()) :: Croma.Result.t(t())
new(term()) :: Croma.Result.t(t())
Creates a new instance of RaftedValue.Logs 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.
new!(dict) View Source
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(last_committed_entry, entries_to_append)
View Source
new_for_lonely_leader(
RaftedValue.LogEntry.t(),
Enum.t(RaftedValue.LogEntry.t())
) :: t()
new_for_lonely_leader( RaftedValue.LogEntry.t(), Enum.t(RaftedValue.LogEntry.t()) ) :: t()
new_for_new_follower(last_committed_entry)
View Source
new_for_new_follower(RaftedValue.LogEntry.t()) :: t()
new_for_new_follower(RaftedValue.LogEntry.t()) :: t()
set_follower_index(logs, arg1, current_term, follower_pid, i_replicated, persistence)
View Source
set_follower_index(
RaftedValue.Logs.t(),
RaftedValue.Members.t(),
RaftedValue.TermNumber.t(),
pid(),
RaftedValue.LogIndex.t(),
nil | RaftedValue.Persistence.t()
) :: {t(), [RaftedValue.LogEntry.t()]}
set_follower_index( RaftedValue.Logs.t(), RaftedValue.Members.t(), RaftedValue.TermNumber.t(), pid(), RaftedValue.LogIndex.t(), nil | RaftedValue.Persistence.t() ) :: {t(), [RaftedValue.LogEntry.t()]}
set_follower_index_as_snapshot_last_index(logs, arg1, follower_pid, arg3)
View Source
set_follower_index_as_snapshot_last_index(
RaftedValue.Logs.t(),
RaftedValue.Members.t(),
pid(),
RaftedValue.Persistence.SnapshotMetadata.t()
) :: t()
set_follower_index_as_snapshot_last_index( RaftedValue.Logs.t(), RaftedValue.Members.t(), pid(), RaftedValue.Persistence.SnapshotMetadata.t() ) :: t()
update(s, dict)
View Source
update(t(), Dict.t()) :: Croma.Result.t(t())
update(t(), Dict.t()) :: Croma.Result.t(t())
Updates an existing instance of RaftedValue.Logs 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}
.
update!(s, dict) View Source
A variant of update/2
which returns t
or raise if validation fails.
In other words, update/2
followed by Croma.Result.get!/1
.
valid?(value) View Source
Checks if the given value belongs to t/0
or not.