Capstan.Position (Capstan v0.1.0)

Copy Markdown View Source

A replication position: the processed GTID set plus diagnostic binlog coordinates.

gtid_set is AUTHORITATIVE and the ONLY persisted field (ADR-0001). file and pos are DIAGNOSTIC ONLY — never an ordering key. A scalar ordinal built from file/pos moves backward after failover or RESET BINARY LOGS AND GTIDS while the GTID set moves forward, so no ordinal field is exported.

to_persisted/1 and from_persisted/1 round-trip only gtid_set: persisting a Position and restoring it always yields file: nil, pos: nil, even when the original carried diagnostic coordinates. There is exactly one durable value.

Summary

Functions

Builds a Position from a persisted gtid_set string.

Returns the persisted representation of position — the gtid_set string alone.

Types

t()

@type t() :: %Capstan.Position{
  file: String.t() | nil,
  gtid_set: String.t(),
  pos: non_neg_integer() | nil
}

Functions

from_persisted(gtid_set)

@spec from_persisted(String.t()) :: t()

Builds a Position from a persisted gtid_set string.

file and pos are always nil — they are diagnostic-only and never survive persistence.

to_persisted(position)

@spec to_persisted(t()) :: String.t()

Returns the persisted representation of position — the gtid_set string alone.

file/pos are diagnostic and are never persisted.