ViewstampedReplication.Log (viewstamped_replication v0.1.0)

Copy Markdown View Source

An immutable, contiguous VSR operation log.

Summary

Types

t()

@type t() :: %ViewstampedReplication.Log{
  base_op_number: non_neg_integer(),
  entries: [ViewstampedReplication.LogEntry.t()]
}

Functions

append(log, entry)

@spec append(t(), ViewstampedReplication.LogEntry.t()) ::
  {:ok, t()} | {:error, term()}

append!(log, entry)

@spec append!(t(), ViewstampedReplication.LogEntry.t()) :: t()

compact(log, through_op_number)

@spec compact(t(), non_neg_integer()) :: {:ok, t()} | {:error, term()}

fetch(log, op_number)

@spec fetch(t(), pos_integer()) ::
  {:ok, ViewstampedReplication.LogEntry.t()} | :compacted | :error

fetch!(log, op_number)

last(log)

@spec last(t()) :: ViewstampedReplication.LogEntry.t() | nil

last_op_number(log)

@spec last_op_number(t()) :: non_neg_integer()

new()

@spec new() :: t()

new(entries)

@spec new([ViewstampedReplication.LogEntry.t()]) :: {:ok, t()} | {:error, term()}

new(base_op_number, entries)

@spec new(non_neg_integer(), [ViewstampedReplication.LogEntry.t()]) ::
  {:ok, t()} | {:error, term()}

suffix(log, after_op_number)

to_list(log)

@spec to_list(t()) :: [ViewstampedReplication.LogEntry.t()]

truncate_suffix(log, last_op_number)

@spec truncate_suffix(t(), non_neg_integer()) :: t()