Expand description
RFC-019 Stage A/B/C — cross-backend stream-cursor subscription surface (shared primitives).
This module defines the StreamCursor every subscribe_*
method accepts, plus the codec helpers backends use to
encode/decode their native stream positions (Valkey (ms, seq),
Postgres event_id). Family-specific typed event enums + per-
family subscription aliases live in crate::stream_events.
Four-family allow-list (RFC-019 §Open Questions #5, owner- adjudicated 2026-04-24): new families require an RFC amendment.
Structs§
- Stream
Cursor - Opaque, backend-versioned cursor. Consumers persist the bytes, hand
them back on resume. The first byte MUST encode a backend-family +
version prefix so cursors stay stable across backend upgrades
(Valkey:
0x01, Postgres:0x02, …). The remainder is backend- specific.
Constants§
- POSTGRES_
CURSOR_ PREFIX - Postgres family prefix byte.
- VALKEY_
CURSOR_ PREFIX - Valkey family prefix byte (RFC-019 §Backend Semantics Appendix).
Functions§
- decode_
postgres_ event_ cursor - Decode a Postgres event cursor back to
event_id.None= start-from-tail. - decode_
valkey_ cursor - Decode a Valkey cursor back to
(ms, seq). ReturnsNonefor the empty / tail-from-now cursor. ReturnsErrfor malformed bytes (wrong prefix, truncated). - encode_
postgres_ event_ cursor - Encode a Postgres
event_id(i64, fromff_completion_event) into a cursor. - encode_
valkey_ cursor - Encode a Valkey stream id
(ms, seq)into a cursor.