krabka_replicator/record.rs
1//! The payload that travels through the connect runtime for one replicated record.
2
3use bytes::Bytes;
4
5use crate::ids::{Offset, PartitionIndex, Timestamp};
6
7/// One record from the source cluster, carried as the connect-value type `V`
8/// through the [`krabka_connect`] runtime.
9///
10/// Replication keeps its full source envelope here. The specialized target sink
11/// consumes the offset and the provenance metadata, in addition to the generic
12/// [`krabka_connect::ConnectRecord`] routing fields.
13#[derive(Debug, Clone, PartialEq, Eq)]
14pub struct ReplicatedRecord {
15 /// The source topic name.
16 pub topic: String,
17 /// The source partition index.
18 pub partition: PartitionIndex,
19 /// The source offset (0-based).
20 pub offset: Offset,
21 /// Record timestamp in epoch milliseconds.
22 pub timestamp: Timestamp,
23 /// Record key, or `None` for a null key.
24 pub key: Option<Bytes>,
25 /// Record value, or `None` for a tombstone.
26 pub value: Option<Bytes>,
27 /// Per-record headers in declaration order.
28 pub headers: Vec<(String, Option<Bytes>)>,
29}