Antd.PointerFinality (antd v0.4.1)

Copy Markdown View Source

The whole close group's view of where a pointer stands (pointer_finality). Check it before relying on a transfer: only status: :final means it is beyond dispute.

status is one of:

  • :open — no peer that answered holds a final state. counter is the counter a read would return, or nil if no state is corroborated.
  • :settling — one final state (state), not yet held by a majority.
  • :unconfirmed — one final state held by a majority, but not every peer of the group answered, so a rival could still exist.
  • :final — one final state, held by a majority, every peer answered, no rival seen. transferred_to is set when it is a transfer.
  • :forked — the owner signed two or more different final states. states lists them, most-held first; majority is the one a majority holds, which reads return, or nil.
  • {:unknown, status} — a status this SDK does not know yet, as the daemon sent it.

Unset values are nil on both transports: REST sends null, gRPC an empty string or an absent message.

Summary

Functions

True only for status: :final: the transfer is beyond dispute.

Parses the daemon's status string. A status this SDK does not know yet comes back as {:unknown, status}.

Types

status()

@type status() ::
  :open | :settling | :unconfirmed | :final | :forked | {:unknown, String.t()}

t()

@type t() :: %Antd.PointerFinality{
  address: String.t(),
  answered: non_neg_integer(),
  counter: non_neg_integer() | nil,
  group: non_neg_integer(),
  majority: Antd.PointerFinalState.t() | nil,
  state: Antd.PointerFinalState.t() | nil,
  states: [Antd.PointerFinalState.t()],
  status: status(),
  transferred_to: String.t() | nil
}

Functions

final?(pointer_finality)

@spec final?(t()) :: boolean()

True only for status: :final: the transfer is beyond dispute.

parse_status(other)

@spec parse_status(String.t()) :: status()

Parses the daemon's status string. A status this SDK does not know yet comes back as {:unknown, status}.