Skip to main content

SourceEvent

Enum SourceEvent 

Source
#[non_exhaustive]
pub enum SourceEvent<L> { LanesAssigned(Vec<L>), LanesAdded(Vec<L>), LanesRevoked { lanes: Vec<LaneId>, barrier: DrainBarrier, }, LanesRetired { lanes: Vec<LaneId>, }, Idle, CommitReady { partitions: Vec<PartitionId>, }, Drained, }
Expand description

Control-plane event returned by Source::poll_events.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

LanesAssigned(Vec<L>)

New lanes were assigned; the runtime distributes them across pipeline threads. The source bumps its assignment epoch first.

§

LanesAdded(Vec<L>)

Additional lanes join the current assignment epoch; existing lanes are untouched and their in-flight batches keep resolving. A feed reader emits this for each unit part it takes up, so a routine gain never drains flowing lanes (contrast SourceEvent::LanesAssigned, whose eager-rebalance contract replaces the full lane set). Lane ids must be new (never reuse an id from this source’s lifetime), and each lane’s partition must be above every partition admitted to the epoch so far, revoked and retired ones included, so a revoked or retired partition returns only in a new epoch.

§

LanesRevoked

Lanes are being revoked. The runtime trips the DrainBarrier for the owning threads, which stop the lanes, flush in-flight records, and arrive; the source completes the revocation (final synchronous commit included) only after DrainBarrier::wait returns.

Fields

§lanes: Vec<LaneId>

Which lanes to stop.

§barrier: DrainBarrier

Barrier the owning pipeline threads arrive at once drained.

§

LanesRetired

Lanes whose work is finished are leaving the assignment: their input is fully delivered, acknowledged, and committed (e.g. a feed unit part whose last record was acknowledged and settled), so by contract nothing unflushed or uncommitted can exist behind them. The runtime removes them without a drain barrier, so there is no pipeline stall. Sources must use SourceEvent::LanesRevoked instead whenever any in-flight data or uncommitted acknowledgment may remain.

Fields

§lanes: Vec<LaneId>

The finished lanes.

§

Idle

Nothing happened within the timeout.

§

CommitReady

A hint that a commit outside the periodic tick is worthwhile now for the named partitions: their lanes have decided end-of-input, and the source cannot finalize their unit of work (e.g. settle a feed unit part, freeing its held-unit slot) until the acked watermark reaches it through Source::commit. The runtime responds by committing those partitions only (flowing partitions keep the periodic tick) at a tightened cadence for one commit interval, then on each control-plane poll that finds a partition’s acked watermark advanced, while any of its lanes remains assigned. The periodic tick still commits them and retries a failed commit. A partition leaves when its lanes are retired or revoked, or a new assignment begins. This is a latency optimization; correctness does not depend on it, and sources that never emit it get the periodic cadence.

Fields

§partitions: Vec<PartitionId>

Partitions whose final acks are worth chasing.

§

Drained

The source has permanently exhausted its input: every lane has yielded its final batch and will only ever return Ok(None) again. Bounded sources (backfills) emit this to request a graceful drain; the runtime flushes chains, drains sinks, runs a final synchronous commit, and exits with ExitState::Completed.

Contract: a source must not report Drained while any lane still holds unemitted data. A lane’s exhaustion may only be decided by a poll that returned Ok(None) after its final batch was consumed (the poll→push→poll sequencing on the owning thread then guarantees the final batch was fully pushed downstream). Emitting Drained is idempotent: sources should keep returning it once drained. Unbounded sources never emit it.

Trait Implementations§

Source§

impl<L: Debug> Debug for SourceEvent<L>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<L> Freeze for SourceEvent<L>
where Vec<L>: Freeze,

§

impl<L> RefUnwindSafe for SourceEvent<L>
where Vec<L>: RefUnwindSafe,

§

impl<L> Send for SourceEvent<L>
where Vec<L>: Send,

§

impl<L> Sync for SourceEvent<L>
where Vec<L>: Sync,

§

impl<L> Unpin for SourceEvent<L>
where Vec<L>: Unpin,

§

impl<L> UnsafeUnpin for SourceEvent<L>
where Vec<L>: UnsafeUnpin,

§

impl<L> UnwindSafe for SourceEvent<L>
where Vec<L>: UnwindSafe,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

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

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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