ViewstampedReplication.Replica (viewstamped_replication v0.1.0)

Copy Markdown View Source

Supervised effect interpreter for one VSR replica.

The GenServer is the serialization boundary for protocol state. Storage and transport adapters remain process-free and their state is owned here.

Summary

Types

t()

@type t() :: %ViewstampedReplication.Replica{
  bootstrap: term(),
  configuration: term(),
  protocol_state: term(),
  state_machine: term(),
  state_machine_state: term(),
  storage: term(),
  storage_state: term(),
  timers: term(),
  transport: term(),
  transport_state: term()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

deliver(group_id, replica_id, envelope)

@spec deliver(term(), term(), ViewstampedReplication.Protocol.Envelope.t()) ::
  :ok | {:error, :not_found}

primary(group_id, replica_id)

@spec primary(term(), term()) :: {:ok, term()} | {:error, :not_found}

snapshot(group_id, replica_id)

@spec snapshot(term(), term()) :: :ok | {:error, term()}

start_link(opts)

status(group_id, replica_id)

@spec status(term(), term()) :: {:ok, map()} | {:error, :not_found}

submit(replica, route, request)

@spec submit(pid() | term(), term(), ViewstampedReplication.Request.t()) :: :ok

whereis(group_id, replica_id)

@spec whereis(term(), term()) :: pid() | nil