pub struct ReplicatedRecord {
pub topic: String,
pub partition: PartitionIndex,
pub offset: Offset,
pub timestamp: Timestamp,
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 [krabka_connect] runtime.
Replication keeps its full source envelope here. The specialized target sink
consumes the offset and the provenance metadata, in addition to the generic
[krabka_connect::ConnectRecord] routing fields.
Fields§
§topic: StringThe source topic name.
partition: PartitionIndexThe source partition index.
offset: OffsetThe source offset (0-based).
timestamp: TimestampRecord 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, apply filtering and loop-guard logic, then enqueue produce calls for the accepted records.
The sink drops a record, and does not buffer it, when:
valueisNone, that is, a tombstone or no payload.- The identity-naming loop-guard fires: the
__krabka_originheader of the record matches our ownsource_alias. - The residency gate blocks the topic for the zones of the target.
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
Self: 'async_trait,
'life0: 'async_trait,
fn begin<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
puts that follow, up
to the next commit or abort. The
runtime calls this 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
Self: 'async_trait,
'life0: 'async_trait,
fn commit<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn abort<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn abort<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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 sink writes no
further records. 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 in every other case.
§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, when there is 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 method once before the first poll
and passes the position that it loaded from the durable checkpoint store
on the target. Each position entry maps the key
"<topic>-<partition>" to [OffsetValue::Long](next_offset), the
value that checkpoint wrote as last_consumed + 1.
This method decodes each key back into (topic, partition) and hands the
offset to the seek of the
consumer.
The consumer holds each seek as pending. It materialises the seek at
the top of the first poll that sees the partition assigned, after the
post-assignment offset prime of the group but before any Fetch. The
sought offset is therefore the offset that the consumer fetches. A
restart then resumes from the last fully-committed record and does
not re-read the topic from offset 0. No record below the sought offset is
re-delivered and no record above it is skipped, so there is no data gap.
An at-least-once flow can re-deliver a batch after a crash between the
sink flush and checkpoint save. An exactly-once flow writes this same
position inside the target producer transaction, so output and recovery
position become visible together.
This method skips a malformed key with a warning and does not fail the
restore. A malformed key has no -, or a non-integer partition or
offset. 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. The close sends LeaveGroup, so a
restarted replicator can rejoin the group immediately and does not wait
out the session timeout of the departed member.
§Errors
Returns [ConnectError::Backend] if the consumer fails to close cleanly.
§fn acknowledge<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_offset: &'life1 SourceOffset,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn acknowledge<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_offset: &'life1 SourceOffset,
) -> Pin<Box<dyn Future<Output = Result<(), ConnectError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
offset is durable end-to-end. Read moreimpl 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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);