Struct apalis_core::storage::StorageWorker
source · pub struct StorageWorker<T, S: Storage<Output = T>, H> { /* private fields */ }Available on crate feature
storage only.Expand description
A queue represents a consumer of a Storage.
A [Service] must be provided to be called when a new job is detected.
Implementations§
Trait Implementations§
source§impl<T, S, H, F> Handler<StorageWorkerPulse> for StorageWorker<T, S, H>where
S: Storage<Output = T> + Unpin + Send + Sync + 'static,
T: Job + Send + 'static,
H: Service<JobRequest<T>, Response = JobResult, Error = JobError, Future = F> + Unpin + Send + 'static,
F: Future<Output = Result<JobResult, JobError>> + Send,
impl<T, S, H, F> Handler<StorageWorkerPulse> for StorageWorker<T, S, H>where
S: Storage<Output = T> + Unpin + Send + Sync + 'static,
T: Job + Send + 'static,
H: Service<JobRequest<T>, Response = JobResult, Error = JobError, Future = F> + Unpin + Send + 'static,
F: Future<Output = Result<JobResult, JobError>> + Send,
source§impl<T, S, H, F> Worker for StorageWorker<T, S, H>where
S: JobStream<Job = T> + Storage + Unpin + Storage<Output = T> + Send + 'static + Sync,
T: Job + Send + 'static,
H: Service<JobRequest<T>, Response = JobResult, Error = JobError, Future = F> + Unpin + Send + 'static,
F: Future<Output = Result<JobResult, JobError>> + Send,
impl<T, S, H, F> Worker for StorageWorker<T, S, H>where
S: JobStream<Job = T> + Storage + Unpin + Storage<Output = T> + Send + 'static + Sync,
T: Job + Send + 'static,
H: Service<JobRequest<T>, Response = JobResult, Error = JobError, Future = F> + Unpin + Send + 'static,
F: Future<Output = Result<JobResult, JobError>> + Send,
source§fn on_start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Available on crate feature
worker only.At start hook of worker
source§fn on_stop<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_stop<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 mut Context<Self>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Available on crate feature
worker only.At stop hook of worker
source§fn consume(&mut self) -> JobStreamResult<Self::Job>
fn consume(&mut self) -> JobStreamResult<Self::Job>
Available on crate feature
worker only.Returns a streams of jobs for the worker to consume
source§fn service(&mut self) -> &mut Self::Service
fn service(&mut self) -> &mut Self::Service
Available on crate feature
worker only.Returns the service that handles the job
source§fn handle_job<'life0, 'async_trait>(
&'life0 mut self,
job: JobRequest<Self::Job>
) -> Pin<Box<dyn Future<Output = Result<JobResult, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_job<'life0, 'async_trait>(
&'life0 mut self,
job: JobRequest<Self::Job>
) -> Pin<Box<dyn Future<Output = Result<JobResult, JobError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Available on crate feature
worker only.The way the worker will handle a job
source§fn manage<'life0, 'async_trait>(
&'life0 mut self,
_msg: WorkerManagement
) -> Pin<Box<dyn Future<Output = Result<WorkerStatus, WorkerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn manage<'life0, 'async_trait>(
&'life0 mut self,
_msg: WorkerManagement
) -> Pin<Box<dyn Future<Output = Result<WorkerStatus, WorkerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Available on crate feature
worker only.Manage a worker
Auto Trait Implementations§
impl<T, S, H> RefUnwindSafe for StorageWorker<T, S, H>where
H: RefUnwindSafe,
S: RefUnwindSafe,
impl<T, S, H> Send for StorageWorker<T, S, H>where
H: Send,
S: Send,
impl<T, S, H> Sync for StorageWorker<T, S, H>where
H: Sync,
S: Sync,
impl<T, S, H> Unpin for StorageWorker<T, S, H>where
H: Unpin,
S: Unpin,
impl<T, S, H> UnwindSafe for StorageWorker<T, S, H>where
H: UnwindSafe,
S: UnwindSafe,
Blanket Implementations§
source§impl<T, W> Actor for Wwhere
T: 'static + Send,
W: 'static + Worker<Job = T> + Handler<JobRequestWrapper<T>>,
impl<T, W> Actor for Wwhere
T: 'static + Send,
W: 'static + Worker<Job = T> + Handler<JobRequestWrapper<T>>,
source§fn on_start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut Context<W>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
W: 'async_trait,
Available on crate feature worker only.
fn on_start<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut Context<W>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
W: 'async_trait,
worker only.At start hook of actor
source§fn on_stop<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut Context<W>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
W: 'async_trait,
Available on crate feature worker only.
fn on_stop<'life0, 'life1, 'async_trait>(
&'life0 mut self,
ctx: &'life1 mut Context<W>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
W: 'async_trait,
worker only.At stop hook of actor
source§fn mailbox_capacity(&self) -> usize
fn mailbox_capacity(&self) -> usize
Available on crate feature
worker only.Capacity of worker queue
source§fn preinit(self) -> InitializedActor<Self>
fn preinit(self) -> InitializedActor<Self>
Available on crate feature
worker only.Initilize actor with its address.
source§fn preinit_default() -> InitializedActor<Self>where
Self: Default,
fn preinit_default() -> InitializedActor<Self>where
Self: Default,
Available on crate feature
worker only.Initialize actor with default values
source§impl<M, S> ContextHandler<M> for Swhere
M: 'static + Message + Send,
S: Handler<M>,
impl<M, S> ContextHandler<M> for Swhere
M: 'static + Message + Send,
S: Handler<M>,
source§fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
__arg1: &'life1 mut Context<S>,
msg: M
) -> Pin<Box<dyn Future<Output = <S as ContextHandler<M>>::Result> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
S: 'async_trait,
fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
__arg1: &'life1 mut Context<S>,
msg: M
) -> Pin<Box<dyn Future<Output = <S as ContextHandler<M>>::Result> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
S: 'async_trait,
Available on crate feature
worker only.Message handler