pub struct ReflectorWorker<P: Processor, S> { /* private fields */ }Expand description
A worker that drives a Reflector’s data source.
Consumes items from the source and feeds them through the processor into the reflector’s shared state. Until this worker runs, the reflector it was created with reports only the initial state its processor built.
The source is retained across restarts rather than being rebuilt, so a worker that fails and is restarted resumes from wherever the source left off. That matters for a source backed by a subscription: rebuilding it would drop whatever accumulated while the worker was down.
Register this worker as transient rather than with the permanent
default of Supervisor::add_worker. An exhausted source is terminal
here: the worker returns normally once the source ends, and the retained source means a restart would only feed
it the same dead source, exit immediately again, and burn through the supervisor’s restart budget. Transient
leaves it stopped instead, which is the intended outcome. A source that cannot end – a subscription held open
for the life of the process, say – never reaches this case, but nothing about the type guarantees that.
Trait Implementations§
Source§impl<P, S, I> Supervisable for ReflectorWorker<P, S>
impl<P, S, I> Supervisable for ReflectorWorker<P, S>
Source§fn initialize<'life0, 'async_trait>(
&'life0 self,
process_shutdown: ShutdownHandle,
) -> Pin<Box<dyn Future<Output = Result<SupervisorFuture, InitializationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 self,
process_shutdown: ShutdownHandle,
) -> Pin<Box<dyn Future<Output = Result<SupervisorFuture, InitializationError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn shutdown_strategy(&self) -> ShutdownStrategy
fn shutdown_strategy(&self) -> ShutdownStrategy
Source§fn wants_shutdown_signal(&self) -> bool
fn wants_shutdown_signal(&self) -> bool
Auto Trait Implementations§
impl<P, S> Freeze for ReflectorWorker<P, S>
impl<P, S> !RefUnwindSafe for ReflectorWorker<P, S>
impl<P, S> Send for ReflectorWorker<P, S>where
S: Send,
impl<P, S> Sync for ReflectorWorker<P, S>where
S: Send,
impl<P, S> Unpin for ReflectorWorker<P, S>
impl<P, S> !UnwindSafe for ReflectorWorker<P, S>
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Track for T
impl<T> Track for T
§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Tracked wrapper. Read more§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more