Skip to main content

Module cdc

Module cdc 

Source
Expand description

Change Data Capture (CDC) — stream of database change events.

Exposes entity mutations (insert, update, delete) as a pollable event stream. Consumers poll with a cursor (LSN) to receive new events since their last position.

Structs§

CdcBuffer
CDC event buffer — circular buffer of change events.
CdcStats
CDC buffer statistics.
ChangeEvent
A single change event.
ChangeRecord
KvWatchEvent
A committed single-key KV change surfaced by WATCH.
RangeAuthority
Issue #991 — the range-authority watermark a replica or recovery target holds for a single range: the minimum term and ownership epoch it will accept for that range’s user-data changes.
RangeCatchupPlan
The result of filtering a slice of the shared logical stream down to one range’s catch-up work. apply holds indices into the input slice in ascending LSN order; resume is the position advanced past every applied record (persist it to make catch-up resumable); rejected lists the fenced records.
RangeProgressTracker
Tracks streaming progress for many ranges over the one physical WAL. A data member feeds every derived record through index_record to maintain each range’s primary frontier without splitting the log, and notes shipped/applied LSNs per range. Every range advances independently, so one lagging range does not skew another’s lag or failover eligibility.
RangeStreamPosition
The per-range resume position and authority watermark a range follower persists. A range replica restarting catch-up hands the primary this position so streaming resumes from applied_lsn for the range instead of replaying the whole shared WAL, and so the follower keeps fencing records from a deposed owner.
RangeStreamProgress
Independent streaming progress for one range over the shared physical WAL.
RangeStreamReject
A record that range catch-up refused, with the reason. Surfaced (rather than silently dropped) so the caller can count fenced records and tell a stale owner apart from a quiet range.

Enums§

ChangeOperation
RangeAdmitError
Why a RangeAuthority rejected a record (issue #991).
RangeStreamDecision
Why a single record was routed the way it was during range catch-up.

Functions§

change_record_from_entity
classify_range_record
Route a single record relative to a range’s resume position. Routing order: other-range first (cheapest, most common), then already-applied, then the authority fence — so a record we have already applied is skipped without being treated as a fence violation, while a fresh stale-owner write is rejected.
plan_range_catchup
Filter a slice of the shared logical stream (ascending by LSN) into the catch-up plan for a single range, resuming from position. Only records stamped for position.range_id, past its resume LSN, and clearing its authority fence are selected; the returned resume position has been advanced past them so a follower can persist it and continue.
public_item_kind
server_json_to_wire_json
wire_json_to_server_json