pub async fn recv(
duplex: &mut Duplex,
) -> Result<Option<ReplicationEvent>, FaucetError>Available on crate features
source-postgres-cdc and source-rest only.Expand description
Receive the next meaningful replication event from the server.
Returns:
Ok(Some(event))— the nextReplicationEventthat the caller should handle. This includesReplicationEvent::XLogData,ReplicationEvent::Begin,ReplicationEvent::Commit, andReplicationEvent::Message. Callers (Task 9+) can match on the full event type to observe transaction boundaries.Ok(None)— stream ended cleanly (slot stopped, stop LSN reached, orDuplexwas shut down).Err(_)— network / protocol error.
ReplicationEvent::KeepAlive events are absorbed here. We deliberately
do not advance the applied-LSN to the server’s wal_end on a keepalive
(the previous behaviour): that position is not yet durable downstream, and
advertising it as confirmed_flush_lsn would authorise Postgres to recycle
WAL for changes the consumer never persisted — a crash in that window loses
data (#78/#1). The applied-LSN is advanced only from the durable bookmark,
via send_status_update at the start of each run; the library keeps
sending its periodic Standby Status Updates (carrying that durable
position) to hold the connection open. ReplicationEvent::StoppedAt is
converted to Ok(None).