pub struct ScriptedFeed { /* private fields */ }Expand description
A Feed whose deliveries, publish outcomes and call refusals are
scripted by the paired FeedScript. Build both with scripted_feed.
receive hands out scripted deliveries in the order they were scripted.
fail records the report and lets go of the delivery, and delivers
nothing again on its own: the script decides what the feed does next. A
call with a receipt the feed no longer holds returns
Gone and is recorded by
FeedScript::gone. A scripted refusal of that call is served before
this check. Its backend key is scripted,
so a pipeline it is passed to names scripted in its feed: section.
Trait Implementations§
Source§impl Debug for ScriptedFeed
impl Debug for ScriptedFeed
Source§impl Feed for ScriptedFeed
impl Feed for ScriptedFeed
Source§fn backend(&self) -> &str
fn backend(&self) -> &str
The key that names this backend in a
feed: section, such as
"memory". The runtime refuses a feed whose key differs from the
one the pipeline’s FeedSection names.Source§fn set_waker(&self, waker: FeedWaker)
fn set_waker(&self, waker: FeedWaker)
Hand the backend the waker it signals when a unit becomes ready to
receive, including one that arrived before this call, and after a
receive that takes some units and leaves others. A
receive that takes nothing sends no signal. Called before the first
receive; a later call replaces the waker.Source§fn receive(&self, max: usize) -> Result<Vec<Delivery>, FeedError>
fn receive(&self, max: usize) -> Result<Vec<Delivery>, FeedError>
Up to
max deliveries the backend has buffered, oldest first. Never
waits; returns an empty list when nothing is ready. Read moreSource§fn renew(&self, receipt: Receipt) -> Result<(), FeedError>
fn renew(&self, receipt: Receipt) -> Result<(), FeedError>
Mark a held unit as still in work. Read more
Source§fn acknowledge(&self, receipt: Receipt) -> Result<(), FeedError>
fn acknowledge(&self, receipt: Receipt) -> Result<(), FeedError>
Remove a unit from the feed as done. Only the ack rule decides when a
caller may send it. Read more
Source§fn fail(&self, receipt: Receipt, reason: &str) -> Result<(), FeedError>
fn fail(&self, receipt: Receipt, reason: &str) -> Result<(), FeedError>
Return a held unit that this reader could not process, so the feed
delivers it again. At the feed’s delivery cap the unit moves to its
dead-letter destination instead.
reason is for the feed’s logs. Read moreSource§fn publish(&self, unit: Unit) -> Confirmation ⓘ
fn publish(&self, unit: Unit) -> Confirmation ⓘ
Add a unit to the feed. The returned
Confirmation resolves once
the feed has stored the unit or refused it. A unit published twice is
delivered twice.Source§fn read_depth(&self, of: DepthOf) -> Option<DepthReading>
fn read_depth(&self, of: DepthOf) -> Option<DepthReading>
Count what the feed, or its dead-letter destination, holds. The
returned
DepthReading settles once the backend has read the
counts. Never waits. Read moreSource§fn hands_back(&self) -> bool
fn hands_back(&self) -> bool
Whether a stopping worker reads this feed’s units to the
STOP_RESERVE and hands back the rest, as the module docs’
“Stopping” order describes. Startup refuses a drain timeout no longer
than the reserve on a feed that answers true. The default returns
false.Source§fn stop_receiving(&self)
fn stop_receiving(&self)
Receive nothing more: the worker is stopping. Units already buffered
are the backend’s to give back. The default does nothing.
Source§fn hand_back(&self, receipt: Receipt) -> Result<(), FeedError>
fn hand_back(&self, receipt: Receipt) -> Result<(), FeedError>
Return a held unit for another reader to take at once. The
delivery does not count as a failure; a backend that counts
deliveries toward a dead-letter limit counts this one as it counts
any delivery. Read more
Source§fn close(&self, within: Duration) -> Option<Confirmation>
fn close(&self, within: Duration) -> Option<Confirmation>
Send what the backend still has queued and give up every unit still
held, within
within. Called once, after the pipeline’s final
commit. Never waits: the returned Confirmation settles when the
backend is done, and a caller stops waiting for it after within. Read moreSource§fn attach_metrics(&self, _cx: FeedMetricsCtx)
fn attach_metrics(&self, _cx: FeedMetricsCtx)
Receive the
Meter and per-partition setting for the backend’s own
metric families. Called before the source is handed the feed, once for
each pipeline that runs it, with that pipeline’s labels and that
pipeline’s metrics.per_partition_detail. Resolve handles here and keep
them, which &self leaves to interior mutability. Read moreAuto Trait Implementations§
impl Freeze for ScriptedFeed
impl RefUnwindSafe for ScriptedFeed
impl Send for ScriptedFeed
impl Sync for ScriptedFeed
impl Unpin for ScriptedFeed
impl UnsafeUnpin for ScriptedFeed
impl UnwindSafe for ScriptedFeed
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
Mutably borrows from an owned value. Read more