Skip to main content

ErasedBackgroundTaskSpec

Trait ErasedBackgroundTaskSpec 

Source
pub trait ErasedBackgroundTaskSpec<State, Task, Config, Context, Kind, Lane, PayloadEnvelope, ResultEnvelope, Error>: Sync
where Task: TaskRecord<Kind>, Kind: Copy + Eq + Debug + Display + Send + Sync + 'static, Lane: Copy + Eq + Debug + Send + Sync + 'static,
{ // Required methods fn step_specs(&self) -> &'static [TaskStepSpec]; fn lane(&self) -> Lane; fn max_attempts(&self, runtime_config: &Config) -> i32; fn decode_payload(&self, task: &Task) -> Result<PayloadEnvelope>; fn decode_result(&self, task: &Task) -> Result<Option<ResultEnvelope>>; fn retry_class(&self, error: &Error) -> TaskRetryClass; fn process<'a>( &self, state: &'a State, task: &'a Task, context: Context, ) -> TaskProcessFuture<'a, Error>; }
Expand description

Object-safe task spec used by registries and dispatchers.

Required Methods§

Source

fn step_specs(&self) -> &'static [TaskStepSpec]

Initial step specs for this task kind.

Source

fn lane(&self) -> Lane

Dispatch lane used by this task kind.

Source

fn max_attempts(&self, runtime_config: &Config) -> i32

Maximum attempts for new tasks of this kind.

Source

fn decode_payload(&self, task: &Task) -> Result<PayloadEnvelope>

Decodes the product task payload envelope.

Source

fn decode_result(&self, task: &Task) -> Result<Option<ResultEnvelope>>

Decodes the product task result envelope.

Source

fn retry_class(&self, error: &Error) -> TaskRetryClass

Classifies a task failure for retry behavior.

Source

fn process<'a>( &self, state: &'a State, task: &'a Task, context: Context, ) -> TaskProcessFuture<'a, Error>

Processes the task.

Implementors§

Source§

impl<S, State, Task, Config, Context, Kind, Lane, PayloadEnvelope, ResultEnvelope, Error> ErasedBackgroundTaskSpec<State, Task, Config, Context, Kind, Lane, PayloadEnvelope, ResultEnvelope, Error> for TaskSpecAdapter<S>
where S: BackgroundTaskSpec<State, Task, Config, Context, Error, Kind = Kind, Lane = Lane, PayloadEnvelope = PayloadEnvelope, ResultEnvelope = ResultEnvelope> + Sync, Task: TaskRecord<Kind>, Kind: Copy + Eq + Debug + Display + Send + Sync + 'static, Lane: Copy + Eq + Debug + Send + Sync + 'static,