Expand description
PostgreSQL logical replication I/O functions.
Provides low-level functions for connecting to PostgreSQL, managing
replication slots, and parsing/encoding replication wire messages.
§Architecture
- Control-plane connection (
connect,ensure_replication_slot): Feature-gated behindpostgres-cdc, usestokio-postgresfor slot management and metadata queries. - Replication streaming: WAL streaming uses
pgwire-replicationwhich implements theCopyBothsub-protocol natively. Seebuild_replication_config()for config conversion. - Wire format (
parse_replication_message,encode_standby_status,build_start_replication_query): Always available, retained as test utilities and protocol documentation.
§Wire Format
Replication messages inside CopyData frames:
XLogData(tagw): 25-byte header + WAL payloadPrimaryKeepalive(tagk): 18 bytes with WAL position and reply flagStandbyStatusUpdate(tagr): 34 bytes sent from client to server
Enums§
- Replication
Message - A message received from the
PostgreSQLreplication stream.
Functions§
- build_
replication_ config - Builds a [
pgwire_replication::ReplicationConfig] from aPostgresCdcConfig. - build_
start_ replication_ query - Builds the
START_REPLICATIONSQL command. - connect
- Connects to
PostgreSQLas a regular (control-plane) connection. - drop_
replication_ slot - Drop a
PostgreSQLlogical replication slot. - encode_
standby_ status - Encodes a standby status update message.
- ensure_
replication_ slot - Ensures the replication slot exists, creating it if necessary.
- parse_
replication_ message - Parses a raw replication message from byte data.