rafted_value v0.3.1 RaftedValue.Persistence View Source

Link to this section Summary

Functions

Type-aware getter for dir

Type-aware setter for dir

Type-aware getter for latest_snapshot_metadata

Type-aware setter for latest_snapshot_metadata

Type-aware getter for log_expansion_factor

Type-aware setter for log_expansion_factor

Type-aware getter for log_fd

Type-aware setter for log_fd

Type-aware getter for log_size_written

Type-aware setter for log_size_written

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

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

Type-aware getter for snapshot_writer

Type-aware setter for snapshot_writer

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

Link to this section Types

Link to this type t() View Source
t() :: %RaftedValue.Persistence{dir: Croma.String.t, latest_snapshot_metadata: Croma.TypeGen.Nilable.RaftedValue.Persistence.SnapshotMetadata.t, log_expansion_factor: Croma.Number.t, log_fd: Croma.TypeGen.Nilable.Croma.Tuple.t, log_size_written: Croma.NonNegInteger.t, snapshot_writer: Croma.TypeGen.Nilable.Croma.Pid.t}

Link to this section Functions

Type-aware getter for dir.

Type-aware setter for dir.

Link to this function find_log_files_containing_uncommitted_entries(dir, i_committed) View Source
find_log_files_containing_uncommitted_entries(Path.t, RaftedValue.LogIndex.t) :: [Path.t]
Link to this function latest_snapshot_metadata(persistence) View Source
latest_snapshot_metadata(t) :: Croma.TypeGen.Nilable.RaftedValue.Persistence.SnapshotMetadata.t

Type-aware getter for latest_snapshot_metadata.

Link to this function latest_snapshot_metadata(s, field) View Source
latest_snapshot_metadata(t, Croma.TypeGen.Nilable.RaftedValue.Persistence.SnapshotMetadata.t) :: t

Type-aware setter for latest_snapshot_metadata.

Link to this function log_compaction_runnable?(a0) View Source
log_compaction_runnable?(RaftedValue.Persistence.t) :: boolean
Link to this function log_expansion_factor(persistence) View Source
log_expansion_factor(t) :: Croma.Number.t

Type-aware getter for log_expansion_factor.

Link to this function log_expansion_factor(s, field) View Source
log_expansion_factor(t, Croma.Number.t) :: t

Type-aware setter for log_expansion_factor.

Type-aware getter for log_fd.

Type-aware setter for log_fd.

Link to this function log_size_written(persistence) View Source
log_size_written(t) :: Croma.NonNegInteger.t

Type-aware getter for log_size_written.

Link to this function log_size_written(s, field) View Source
log_size_written(t, Croma.NonNegInteger.t) :: t

Type-aware setter for log_size_written.

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

Link to this function new_with_disk_snapshot(dir, factor, meta, entry_restore) View Source
Link to this function new_with_initial_snapshotting(dir, factor, snapshot) View Source
new_with_initial_snapshotting(Path.t, number, RaftedValue.Snapshot.t) :: t
Link to this function new_with_snapshot_sent_from_leader(dir, factor, snapshot) View Source
new_with_snapshot_sent_from_leader(Path.t, number, RaftedValue.Snapshot.t) :: t
Link to this function read_last_log_index(dir) View Source
read_last_log_index(Path.t) :: nil | RaftedValue.LogIndex.t
Link to this function snapshot_writer(persistence) View Source
snapshot_writer(t) :: Croma.TypeGen.Nilable.Croma.Pid.t

Type-aware getter for snapshot_writer.

Link to this function snapshot_writer(s, field) View Source
snapshot_writer(t, Croma.TypeGen.Nilable.Croma.Pid.t) :: t

Type-aware setter for snapshot_writer.

Link to this function switch_log_file_and_spawn_snapshot_writer(persistence, snapshot, index_next) View Source
switch_log_file_and_spawn_snapshot_writer(RaftedValue.Persistence.t, RaftedValue.Snapshot.t, RaftedValue.LogIndex.t) :: t
Link to this function unset_snapshot_metadata(p) View Source
unset_snapshot_metadata(t) :: t

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

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.

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

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

Link to this function write_log_entries(p, entries) View Source