Expand description
Change Data Capture (CDC) Stream support.
Emits mutations to a Redis Stream for external replication agents.
The stream key is {redis_prefix}__local__:cdc where __local__ indicates
node-local infrastructure that should not be replicated itself.
§Stream Format
§PUT operation
XADD {prefix}__local__: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}__local__: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 suffix (appended to redis_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.