pub struct SourceHandle { /* private fields */ }Expand description
Scripts and observes a MemorySource. Cloneable; all clones address
the same source.
Implementations§
Source§impl SourceHandle
impl SourceHandle
Sourcepub fn assign_lanes(&self, lanes: &[(LaneId, PartitionId)])
pub fn assign_lanes(&self, lanes: &[(LaneId, PartitionId)])
Queue an assignment event: the source’s next
poll_events returns
SourceEvent::LanesAssigned with one MemoryLane per pair.
§Panics
Panics on duplicate lane ids (within the call or against currently active lanes) or on a partition that is already served by an active lane — both would be runtime bugs in a real deployment.
Sourcepub fn revoke_lanes(&self, lanes: &[LaneId]) -> DrainBarrierProbe
pub fn revoke_lanes(&self, lanes: &[LaneId]) -> DrainBarrierProbe
Queue a revocation event for lanes and return a probe over its
DrainBarrier. The barrier expects one arrival per revoked
lane (a pipeline thread owning several of them arrives once per
lane it stops).
§Panics
Panics if any lane is not currently active.
Sourcepub fn push(
&self,
partition: PartitionId,
key: Option<&[u8]>,
payload: &[u8],
) -> i64
pub fn push( &self, partition: PartitionId, key: Option<&[u8]>, payload: &[u8], ) -> i64
Queue one payload on partition with timestamp_ms equal to the
assigned offset. Returns that offset. Pushing to a partition that
has no active lane yet is allowed — payloads wait.
Sourcepub fn push_at(
&self,
partition: PartitionId,
key: Option<&[u8]>,
payload: &[u8],
timestamp_ms: Option<i64>,
) -> i64
pub fn push_at( &self, partition: PartitionId, key: Option<&[u8]>, payload: &[u8], timestamp_ms: Option<i64>, ) -> i64
push with an explicit event timestamp.
Sourcepub fn push_many<I, P>(&self, partition: PartitionId, payloads: I) -> Vec<i64>
pub fn push_many<I, P>(&self, partition: PartitionId, payloads: I) -> Vec<i64>
Queue several keyless payloads; returns their offsets.
Sourcepub fn committed(&self) -> Vec<(PartitionId, i64)>
pub fn committed(&self) -> Vec<(PartitionId, i64)>
Every watermark ever passed to Source::commit, in call order
(flattened).
Sourcepub fn last_committed(&self, partition: PartitionId) -> Option<i64>
pub fn last_committed(&self, partition: PartitionId) -> Option<i64>
The most recent committed position for partition, if any.
Sourcepub fn wait_committed(
&self,
partition: PartitionId,
offset: i64,
timeout: Duration,
) -> bool
pub fn wait_committed( &self, partition: PartitionId, offset: i64, timeout: Duration, ) -> bool
Block until partition’s most recent committed offset reaches at least
offset, or timeout elapses; returns whether the target was met.
The blocking counterpart to last_committed:
waking on each Source::commit rather than polling. Pass the
one-past-last watermark (e.g. last_offset + 1) to wait for every
pushed record to be durably committed.
Sourcepub fn paused_lanes(&self) -> Vec<LaneId>
pub fn paused_lanes(&self) -> Vec<LaneId>
Lanes currently paused via Source::pause, ascending.
Sourcepub fn flush_commits_calls(&self) -> usize
pub fn flush_commits_calls(&self) -> usize
How many times Source::flush_commits was called.
Sourcepub fn is_open(&self) -> bool
pub fn is_open(&self) -> bool
Whether Source::open has been called.
Trait Implementations§
Source§impl Clone for SourceHandle
impl Clone for SourceHandle
Source§fn clone(&self) -> SourceHandle
fn clone(&self) -> SourceHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more