pub struct Driver { /* private fields */ }Expand description
Drives origin lifecycle work and cache expiration with caller-supplied time.
Returned by Producer::new. Poll on external activity or at the deadline
it returns, supplying nondecreasing instants. Route changes, track serving, linger,
failover, and teardown run here; the route table and announce cursors update
synchronously when a route is announced or retracted.
It holds no Producer clone, so it never keeps the origin alive. It
finishes once every owner is gone: each Producer clone, published
broadcast, and Dynamic. Read handles (Consumer, AnnounceConsumer)
are not owners. Dropping it aborts active fronts, rejects pending requests,
ends announcements, and makes subsequent producer mutations fail with
Error::Closed.
moq_tokio::origin::spawn handles construction and driving for Tokio callers.
Implementations§
Source§impl Driver
impl Driver
Sourcepub fn poll(
&mut self,
now: Instant,
waiter: &Waiter,
) -> Result<Option<Instant>, Error>
pub fn poll( &mut self, now: Instant, waiter: &Waiter, ) -> Result<Option<Instant>, Error>
Process ready origin work using caller-supplied monotonic time.
See crate::time::Driver for the contract. Finishes with
Error::Closed once every owner (a Producer clone, published
broadcast, or Dynamic) has dropped and the remaining lifecycle work
has drained.