Skip to main content

Worker

Trait Worker 

Source
pub trait Worker:
    MaybeSend
    + MaybeSync
    + 'static {
    // Required methods
    fn kind(&self) -> WorkerKind;
    fn run_tasks<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn NeedsDbReconnect>>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;

    // Provided methods
    fn set_subscription(
        &mut self,
        _subscription: Arc<Subscription<InternalEvent>>,
    ) { ... }
    fn sync_metrics(&self) -> Option<Arc<WorkerMetrics<SyncMetric>>> { ... }
    fn boxed(self) -> Box<dyn Worker>
       where Self: Sized { ... }
    fn spawn(
        self: Box<Self>,
        cancel: CancellationToken,
    ) -> Instrumented<Pin<Box<dyn Future<Output = WorkerKind> + Send>>> { ... }
}

Required Methods§

Source

fn kind(&self) -> WorkerKind

Source

fn run_tasks<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn NeedsDbReconnect>>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Provided Methods§

Source

fn set_subscription(&mut self, _subscription: Arc<Subscription<InternalEvent>>)

Source

fn sync_metrics(&self) -> Option<Arc<WorkerMetrics<SyncMetric>>>

The metrics of the device-sync worker; no other worker has any.

Source

fn boxed(self) -> Box<dyn Worker>
where Self: Sized,

Box the worker, erasing its type

Source

fn spawn( self: Box<Self>, cancel: CancellationToken, ) -> Instrumented<Pin<Box<dyn Future<Output = WorkerKind> + Send>>>

Implementors§

Source§

impl<Context> Worker for ConfigurationWorker<Context>
where Context: CoreContext + 'static,

Source§

impl<Context> Worker for HmacEpochWorker<Context>
where Context: CoreContext + 'static,

Source§

impl<Context> Worker for CommitLogWorker<Context>
where Context: XmtpSharedContext + 'static,

Source§

impl<Context> Worker for SyncWorker<Context>
where Context: XmtpSharedContext + 'static,

Source§

impl<Context> Worker for DisappearingMessagesWorker<Context>
where Context: CoreContext + 'static,

Source§

impl<Context, Handlers> Worker for TaskWorker<Context, Handlers>
where Context: CoreContext + 'static, Handlers: TaskHandlers<Context> + 'static,