Durable-state adapter contract used by a replica runtime.
Adapter state is owned by the replica process. Mutating callbacks return the updated adapter state so storage implementations do not need a process of their own.
Summary
Types
@type recovered_state() :: %{ configuration_hash: binary(), replica_id: term(), hard_state: map(), log: ViewstampedReplication.Log.t(), commit_number: non_neg_integer(), applied_number: non_neg_integer(), snapshot: term() | nil, client_table: map() }
Callbacks
@callback append( term(), ViewstampedReplication.LogEntry.t() | [ViewstampedReplication.LogEntry.t()] ) :: {:ok, term()} | {:error, term()}
@callback recover(term()) :: {:ok, recovered_state(), term()} | {:error, term()}
@callback set_applied(term(), non_neg_integer(), map()) :: {:ok, term()} | {:error, term()}
@callback set_commit_number(term(), non_neg_integer()) :: {:ok, term()} | {:error, term()}
@callback truncate_suffix(term(), non_neg_integer()) :: {:ok, term()} | {:error, term()}