pub struct AckToken { /* private fields */ }Expand description
A token representing a batch of events that requires acknowledgement.
When an event batch is successfully written to a sink (or dropped intentionally by a transform), this token is triggered to notify the original source that it can commit the batch (e.g., commit Kafka offsets).
Implementations§
Source§impl AckToken
impl AckToken
Sourcepub fn new(notifier: Arc<dyn BatchNotifier>) -> Self
pub fn new(notifier: Arc<dyn BatchNotifier>) -> Self
Creates a new AckToken wrapping the given notifier.
Sourcepub fn split(self, n: usize) -> Vec<AckToken>
pub fn split(self, n: usize) -> Vec<AckToken>
Splits this token into n tokens.
The underlying notifier will only be called after all n tokens have been acknowledged.
This is used by the Fanout mechanism to ensure all downstream components have processed
the batch before acknowledging it to the source.
If n is 0, the original token is effectively acknowledged immediately.
If n is 1, it returns itself.
Sourcepub fn ack(self)
pub fn ack(self)
Acknowledges the batch.
Only when all split tokens have been acknowledged will the underlying notifier be triggered.
Sourcepub fn is_acknowledged(&self) -> bool
pub fn is_acknowledged(&self) -> bool
Returns true if this token has been fully acknowledged.
Trait Implementations§
impl Eq for AckToken
Auto Trait Implementations§
impl Freeze for AckToken
impl !RefUnwindSafe for AckToken
impl Send for AckToken
impl Sync for AckToken
impl Unpin for AckToken
impl UnsafeUnpin for AckToken
impl !UnwindSafe for AckToken
Blanket Implementations§
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
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.