{
"type": "record",
"name": "Event",
"namespace": "io.rustcdc",
"doc": "Canonical CDC event envelope — rustcdc envelope_version=1",
"fields": [
{
"name": "before",
"type": ["null", "bytes"],
"default": null,
"doc": "JSON-encoded before-image. null for INSERT events."
},
{
"name": "after",
"type": ["null", "bytes"],
"default": null,
"doc": "JSON-encoded after-image. null for DELETE events."
},
{
"name": "op",
"type": {
"type": "enum",
"name": "Operation",
"namespace": "io.rustcdc",
"symbols": ["INSERT", "UPDATE", "DELETE", "READ", "SCHEMA_CHANGE", "TRUNCATE"],
"doc": "CRUD operation that produced this event."
}
},
{
"name": "source",
"type": {
"type": "record",
"name": "SourceMetadata",
"namespace": "io.rustcdc",
"fields": [
{"name": "source_name", "type": "string", "doc": "Logical connector name"},
{"name": "offset", "type": "string", "doc": "Source-specific durable position"},
{"name": "timestamp", "type": "long", "doc": "Source timestamp in ms since epoch"}
]
}
},
{
"name": "ts",
"type": "long",
"doc": "Event timestamp in milliseconds since Unix epoch."
},
{
"name": "schema",
"type": ["null", "string"],
"default": null,
"doc": "Database schema name. null when unknown."
},
{
"name": "table",
"type": "string",
"doc": "Table name that produced the event."
},
{
"name": "primary_key",
"type": {"type": "array", "items": "string"},
"default": [],
"doc": "Ordered list of primary key column names."
},
{
"name": "snapshot",
"type": ["null", {
"type": "record",
"name": "SnapshotMetadata",
"namespace": "io.rustcdc",
"fields": [
{"name": "snapshot_id", "type": "string"},
{"name": "chunk_index", "type": "int"},
{"name": "is_last_chunk", "type": "boolean"}
]
}],
"default": null,
"doc": "Snapshot phase metadata. null outside snapshot."
},
{
"name": "transaction",
"type": ["null", {
"type": "record",
"name": "TransactionMetadata",
"namespace": "io.rustcdc",
"fields": [
{"name": "tx_id", "type": "long"},
{"name": "total_events", "type": "int"},
{"name": "event_index", "type": "int"}
]
}],
"default": null,
"doc": "Transaction metadata. null for single-event transactions."
},
{
"name": "envelope_version",
"type": "int",
"default": 1,
"doc": "Canonical envelope schema version. Currently always 1."
},
{
"name": "before_is_key_only",
"type": "boolean",
"default": false,
"doc": "True when 'before' contains only primary-key columns (PostgreSQL DEFAULT REPLICA IDENTITY on UPDATE or DELETE). Always false for INSERT, READ, SCHEMA_CHANGE, TRUNCATE, and all non-PostgreSQL events."
}
]
}