API Reference Capstan v#0.1.0

Copy Markdown View Source

Modules

Framework-agnostic Elixir CDC consumer for MySQL row-based binary-log replication, delivering committed transactions to a pluggable sink with fail-closed, transaction-granularity delivery: the checkpoint advances only after the sink has durably applied a transaction (ADR-0003). In C1's lib-owned checkpoint mode this is at-least-once — a crash between the sink write and the checkpoint re-delivers the transaction on restart (a bounded duplicate window). Effect-once delivery is the sink-owned atomic path (the sink persisting its write and the position together), which C1 validates but does not yet run — see Capstan.Sink and ADR-0004.

The three-terminator fold — a pure assembler over a %Capstan.Binlog.Event{} stream (ADR-0003; the owning GenServer is Capstan.AssemblerServer).

The composition point: the GenServer that turns a Capstan.Connection's frame stream into durable, fail-closed, at-least-once delivery (lib-owned checkpoint mode — the checkpoint advances only after the sink's {:ok, _}, so a crash in between re-delivers; see Capstan and ADR-0004. Effect-once is the deferred sink-owned atomic path).

Per-type binlog event body decoder — the second decode layer, over Capstan.Binlog.Event.

Binlog event header parse + CRC32 integrity check — the first decode layer.

Decodes a full row image from the Capstan.Binlog.Decoder's raw tuple and the resolved %Capstan.Binlog.TableMap{}.

A fully-decoded MySQL TABLE_MAP_EVENT body.

The table_id%Capstan.Binlog.TableMap{} registry — the schema-resolution core (ADR-0002).

Casts one column's raw row-image bytes to an Elixir term, and owns the per-column metadata-width split of a TABLE_MAP's raw column_metadata blob.

A single row change within a Capstan.Transaction.

The lib-owned checkpoint persistence contract.

A process-lifetime Capstan.CheckpointStore reference implementation.

Option validation and the fail-closed server-precondition gate.

The socket-owning GenServer: handshake, auth, the fail-closed gap gate, the dump, and frame forwarding.

A typed, value-free error — the boundary normaliser that scrubs a raw driver / socket error, exception, or reason tuple to a stable atom reason (Rule 1, design § Rule 1 / F11).

MySQL GTID-set algebra — the dedup correctness core.

Pipeline entry — the per-mode Sink validation and the child-spec wiring for one supervised pipeline (a Capstan.CheckpointStore process, a Capstan.AssemblerServer, and a Capstan.Connection).

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

MySQL replication commands and text-resultset decoding.

MySQL connection handshake, authentication and TLS upgrade.

MySQL client/server protocol framing.

A DDL change: the self-committing DDL transaction's structured effect (ADR-0003).

The consumer behaviour: a capstan pipeline delivers committed transactions and DDL schema changes to a sink and, in sink-owned checkpoint mode, reads the durable processed position back through checkpoint/0.

The pipeline supervisor: it owns one pipeline's checkpoint store, Capstan.AssemblerServer, and Capstan.Connection, wired so the Connection's :receiver is the AssemblerServer PID.

Value-free telemetry emission. Provides the metadata allowlist for "no row values and no passwords in telemetry" (Rule 1): event/3 routes through validate!/1, which raises on any key outside the allowlist, so a stray row value or password cannot ride a payload emitted through this module.

A decoded, committed transaction delivered to a Sink.