Skip to main content

WorkerFactory

Trait WorkerFactory 

Source
pub trait WorkerFactory: MaybeSend + MaybeSync {
    // Required methods
    fn kind(&self) -> WorkerKind;
    fn create(&self) -> Box<dyn Worker>;

    // Provided method
    fn event_interest(
        &self,
    ) -> Option<(EventFilter<InternalEvent>, Option<usize>)> { ... }
}

Required Methods§

Source

fn kind(&self) -> WorkerKind

Source

fn create(&self) -> Box<dyn Worker>

Create a new worker

Provided Methods§

Source

fn event_interest(&self) -> Option<(EventFilter<InternalEvent>, Option<usize>)>

The events that wake the worker: public event kinds plus an internal predicate, and the subscription’s buffer depth (None drops nothing). None when no event wakes it.

Implementors§

Source§

impl<Context> WorkerFactory for xmtp_mls::groups::commit_log::Factory<Context>
where Context: XmtpSharedContext + 'static,

Source§

impl<Context> WorkerFactory for xmtp_mls::core::config_refresh::Factory<Context>
where Context: CoreContext + 'static,

Source§

impl<Context, Handlers> WorkerFactory for xmtp_mls::worker::tasks::Factory<Context, Handlers>
where Context: CoreContext + 'static, Handlers: TaskHandlers<Context> + Default + 'static,