Expand description
Redis Stream consumer for CDC events.
Tails a peer’s cdc stream and parses events.
§Stream Trimming
Redis streams can be trimmed via MAXLEN or MINID to bound memory.
If our cursor points to an entry older than the oldest in the stream,
we’ve “fallen behind” and missed events. This module detects this and
returns a StreamTrimmed result so callers can:
- Log a warning (potential data gap)
- Reset cursor to oldest available entry
- Emit a metric for alerting
§Content Hash Validation
When a PUT event includes a hash field, we verify that the SHA256
of the decompressed data matches. This detects corruption from:
- Network bit flips
- Compression bugs
- Malicious peers
Structs§
- CdcEvent
- A parsed CDC event from the stream.
- CdcMeta
- Metadata from a CDC PUT event.
- Stream
Tailer - Stream tailer for a single peer’s CDC stream.
Enums§
- CdcOp
- CDC operation type.
- Read
Result - Result of reading from a stream, accounting for trim scenarios.
Functions§
- calculate_
lag_ ms - Calculate the time lag in milliseconds between two stream IDs.
- compare_
stream_ ids - Compare two Redis stream IDs.
- maybe_
decompress - Decompress zstd data if it has the magic header, otherwise return as-is.
- parse_
stream_ id_ timestamp - Parse the timestamp (milliseconds since epoch) from a stream ID.