pub struct TargetSink { /* private fields */ }Expand description
A Sink that applies residency filtering, topic renaming, and
loop-guard logic before producing records to the target cluster.
On each flush it drains pending produce acknowledgements,
sets the downstream offset on each OffsetSync, and writes those syncs
back to the target’s offset-syncs topic (MM2-compatible).
Implementations§
Source§impl TargetSink
impl TargetSink
Sourcepub async fn start(params: SinkParams) -> Result<Self, ConnectError>
pub async fn start(params: SinkParams) -> Result<Self, ConnectError>
Build a TargetSink, ensure the offset-syncs topic exists, and connect
the producer to the target cluster.
§Errors
Returns ConnectError::Backend if the producer cannot connect or the
offset-syncs topic cannot be created.
Sourcepub fn drain_offset_syncs(&mut self) -> Vec<OffsetSync>
pub fn drain_offset_syncs(&mut self) -> Vec<OffsetSync>
Return and clear all completed OffsetSync records accumulated since
the last call (or since construction).
Trait Implementations§
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 more