pub struct EpochStaging { /* private fields */ }Expand description
Commit-gated output staging for an exactly-once sink that has no external transaction of its
own (the Arrow file sink, the Flight sink) — the software analogue of the Kafka sink’s producer
transaction. on_data buffers into the open epoch; on_barrier seals it (pre-commit); commit
releases every sealed epoch up to the committed one for the sink to make visible. Nothing is
visible before its epoch commits, so a restart from the last committed checkpoint re-produces the
same rows (deterministic keys) and each committed row appears exactly once. Uncommitted
staged rows are dropped on stop — a replay re-emits them. (At-least-once sinks skip this and emit
in on_data, unchanged.)
Implementations§
Source§impl EpochStaging
impl EpochStaging
Sourcepub fn push(&mut self, batch: RecordBatch)
pub fn push(&mut self, batch: RecordBatch)
Buffer a batch into the epoch currently open (the one the next barrier will seal).
Sourcepub fn seal(&mut self, epoch: u64)
pub fn seal(&mut self, epoch: u64)
Seal the open epoch at its barrier: its batches become committable under epoch.
Sourcepub fn commit(&mut self, epoch: u64) -> Vec<RecordBatch>
pub fn commit(&mut self, epoch: u64) -> Vec<RecordBatch>
Release every sealed epoch <= epoch (commits are monotonic) for the sink to make visible.
Sourcepub fn drain_all(&mut self) -> Vec<RecordBatch>
pub fn drain_all(&mut self) -> Vec<RecordBatch>
Flush EVERYTHING still staged (sealed epochs in order, then the open tail) for a clean stop
— the sink calls this in on_eos. A clean Eos arrives only when every upstream source ended
cleanly (a crash never delivers it), and a bounded run reaching Eos has drained without a final
barrier over its tail; so this is the tail’s one committed emission. (An unbounded clean stop
commits its tail through the final coordinated epoch before Eos, so this finds nothing.)
Trait Implementations§
Source§impl Default for EpochStaging
impl Default for EpochStaging
Source§fn default() -> EpochStaging
fn default() -> EpochStaging
Auto Trait Implementations§
impl !RefUnwindSafe for EpochStaging
impl !UnwindSafe for EpochStaging
impl Freeze for EpochStaging
impl Send for EpochStaging
impl Sync for EpochStaging
impl Unpin for EpochStaging
impl UnsafeUnpin for EpochStaging
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more