Skip to main content

Checkpointer

Struct Checkpointer 

Source
pub struct Checkpointer { /* private fields */ }
Expand description

Aggregates batch resolutions into per-partition committable watermarks.

use etl_core::checkpoint::{AckStatus, Checkpointer};
use etl_core::record::PartitionId;

let mut cp = Checkpointer::new();
let p = PartitionId(0);
cp.begin_epoch(&[p], 1);
let mut issuer = cp.handle();

let ack = issuer.issue(p, 99); // batch covering offsets ..=99
drop(ack); // all records delivered

cp.drain();
assert_eq!(cp.take_watermarks(), vec![(p, 100)]);
assert_eq!(cp.take_watermarks(), vec![]); // idempotent until new acks

Implementations§

Source§

impl Checkpointer

Source

pub fn new() -> Self

A checkpointer with no assignment. Call begin_epoch when the source reports its first assignment.

Source

pub fn handle(&self) -> AckIssuer

An issuer handle for a pipeline thread.

Source

pub fn begin_epoch(&mut self, partitions: &[PartitionId], epoch: u32)

Start a new assignment epoch covering exactly partitions. Every rebalance bumps the epoch; in-flight batches from earlier epochs resolve as stale and their offsets are re-delivered by the source (at-least-once). Epochs must be strictly increasing.

Ordering contract: the runtime calls this before distributing the new assignment’s lanes to pipeline threads, so issuers observe the new epoch before issuing for it.

Source

pub fn revoke(&mut self, partitions: &[PartitionId])

Drop tracking for revoked partitions mid-epoch (partial revocation or shutdown). Later resolutions for them are discarded as stale. A partition revoked this way can only return in a new epoch.

Source

pub fn drain(&mut self) -> DrainStats

Apply all pending registrations and resolutions.

Two passes exploit the causal order guaranteed by AckIssuer (registration is sent before the batch’s AckRef exists): a resolution whose registration has not been drained yet is retried once after re-draining registrations; if it is still unknown, the driver is buggy and the resolution is counted and dropped.

Source

pub fn take_watermarks(&mut self) -> Vec<(PartitionId, i64)>

Watermarks that advanced since the last call: (partition, committable offset) pairs ready for Source::commit. Empty when nothing moved — callers skip the commit entirely.

Source

pub fn pending(&self, partition: PartitionId) -> usize

Unadvanced batches for one partition (backpressure trigger).

Source

pub fn max_pending(&self) -> usize

The largest per-partition pending count.

Source

pub fn stalled_partitions(&self) -> Vec<(PartitionId, Instant)>

Partitions whose watermark is permanently stalled behind a failed batch, with the stall start (health-probe input).

Trait Implementations§

Source§

impl Debug for Checkpointer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Checkpointer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,