Expand description
Change Data Capture (CDC) Stream support.
Emits mutations to a Redis Stream for external replication agents.
The stream key is {redis_prefix}:cdc - each node writes to its own stream.
Replication agents tail remote peers’ CDC streams to replicate changes.
§Stream Format
§PUT operation
XADD {prefix}:cdc MAXLEN ~ 100000 *
op "PUT"
key "uk.nhs.patient.12345"
hash "a1b2c3..." # content_hash for dedup
data <zstd(content)> # compressed payload
meta '{"content_type":"json","version":3,"updated_at":1735776000000}'§DELETE operation
XADD {prefix}:cdc MAXLEN ~ 100000 *
op "DEL"
key "uk.nhs.patient.12345"§Compression Strategy
Data is zstd-compressed before writing to the stream, unless it already has zstd magic bytes (to avoid double-compression).
Structs§
Enums§
- CdcField
Value - Field value types for CDC entries
- CdcOp
- CDC operation type
Constants§
- CDC_
STREAM_ SUFFIX - CDC stream key suffix (appended to redis_prefix). Convention: redis_prefix includes trailing colon (e.g., “redsqrl:”). Result: “redsqrl:cdc” or just “cdc” if no prefix.
Functions§
- cdc_
stream_ key - Build the full CDC stream key from an optional prefix
- is_
zstd_ compressed - Check if data appears to be zstd-compressed
- maybe_
compress - Compress data with zstd, unless it’s already zstd-compressed.
- maybe_
decompress - Decompress zstd data if it has the magic header, otherwise return as-is.