pub struct ReplicatedRecord {
pub topic: String,
pub partition: i32,
pub offset: i64,
pub timestamp: i64,
pub key: Option<Bytes>,
pub value: Option<Bytes>,
pub headers: Vec<(String, Option<Bytes>)>,
}Expand description
One record from the source cluster, carried as the connect-value type V
through the crabka_connect runtime.
Because crabka_connect::ConnectRecord has no topic/partition fields,
all envelope metadata is bundled here alongside the raw payload.
Fields§
§topic: StringThe source topic name.
partition: i32The source partition index.
offset: i64The source offset (0-based).
timestamp: i64Record timestamp in epoch milliseconds.
key: Option<Bytes>Record key, or None for a null key.
value: Option<Bytes>Record value, or None for a tombstone.
headers: Vec<(String, Option<Bytes>)>Per-record headers in declaration order.
Trait Implementations§
Source§impl Clone for ReplicatedRecord
impl Clone for ReplicatedRecord
Source§fn clone(&self) -> ReplicatedRecord
fn clone(&self) -> ReplicatedRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReplicatedRecord
impl Debug for ReplicatedRecord
impl Eq for ReplicatedRecord
Source§impl PartialEq for ReplicatedRecord
impl PartialEq for ReplicatedRecord
Source§fn eq(&self, other: &ReplicatedRecord) -> bool
fn eq(&self, other: &ReplicatedRecord) -> bool
self and other values to be equal, and is used by ==.Source§impl Sink<(), ReplicatedRecord> for TargetSink
impl Sink<(), ReplicatedRecord> for TargetSink
Source§fn put<'life0, 'async_trait>(
&'life0 mut self,
records: Vec<ConnectRecord<(), ReplicatedRecord>>,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 mut self,
records: Vec<ConnectRecord<(), ReplicatedRecord>>,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Accept a batch of replicated records, applying filtering and loop-guard logic, then enqueue produce calls for the accepted records.
Records are dropped (not buffered) when:
valueisNone(tombstone or no payload).- Identity-naming loop-guard fires: the record’s
__crabka_originheader matches our ownsource_alias. - Residency gate blocks the topic for the target’s zones.
Source§fn flush<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Await all pending produce acks, write offset-syncs to the target, and flush the producer.
Source§fn supports_transactions(&self) -> bool
fn supports_transactions(&self) -> bool
Source§fn begin<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn begin<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
puts that follow, up to
the next commit or abort. Called by
the runtime only when supports_transactions
is true and only before a non-empty batch. Default: no-op. Read moreSource§fn commit<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn commit<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Source§fn abort<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn abort<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Source§fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
close, no further records are written. Read moreSource§impl Source<(), ReplicatedRecord> for SourceConsumer
impl Source<(), ReplicatedRecord> for SourceConsumer
Source§fn poll<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<ConnectRecord<(), ReplicatedRecord>>, ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn poll<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<ConnectRecord<(), ReplicatedRecord>>, ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Poll the source cluster for the next record.
Returns Ok(None) when the consumer is momentarily caught up (the
runtime should back off and retry). Returns Ok(Some(_)) with the
next ReplicatedRecord otherwise.
§Errors
Returns ConnectError::Backend if the underlying consumer poll fails.
Source§fn checkpoint(&self) -> Option<SourceOffset>
fn checkpoint(&self) -> Option<SourceOffset>
Snapshot the current read positions for all partitions seen so far.
Returns None before the first successful poll (nothing to commit yet).
Source§fn seek<'life0, 'async_trait>(
&'life0 mut self,
offset: SourceOffset,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn seek<'life0, 'async_trait>(
&'life0 mut self,
offset: SourceOffset,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Restore the read position from a previously-checkpointed SourceOffset.
The runtime calls this once before the first poll, passing
the position loaded from the durable checkpoint store on the target. Each
position entry is keyed "<topic>-<partition>" →
OffsetValue::Long(next_offset) (the value checkpoint
wrote: last_consumed + 1). We decode each key back into (topic, partition) and hand the offset to the consumer’s
seek.
The consumer holds each seek as pending and materialises it at the top
of the first poll that sees the partition assigned — after the group’s
post-assignment offset prime, but before any Fetch — so the sought
offset is the one fetched. That makes restart resume from the last
fully-committed record rather than re-reading the topic from offset 0:
no record below the sought offset is re-delivered, and none above it is
skipped (no data gap). Delivery remains at-least-once — a crash
between a sink flush and the checkpoint save can re-deliver the in-flight
batch, but never lose a record.
A malformed key (no -, or a non-integer partition/offset) is skipped
with a warning rather than failing the restore: one corrupt entry must
not strand recovery for the partitions that decoded cleanly.
§Errors
Returns ConnectError::Backend if the consumer is already closed.
Source§fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close the underlying consumer, sending LeaveGroup so a restarted
replicator can rejoin the group immediately instead of waiting out the
departed member’s session timeout.
§Errors
Returns ConnectError::Backend if the consumer fails to close cleanly.
impl StructuralPartialEq for ReplicatedRecord
Auto Trait Implementations§
impl !Freeze for ReplicatedRecord
impl RefUnwindSafe for ReplicatedRecord
impl Send for ReplicatedRecord
impl Sync for ReplicatedRecord
impl Unpin for ReplicatedRecord
impl UnsafeUnpin for ReplicatedRecord
impl UnwindSafe for ReplicatedRecord
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.