pub trait ErasedBackgroundTaskSpec<State, Task, Config, Context, Kind, Lane, PayloadEnvelope, ResultEnvelope, Error>: Syncwhere
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§
Sourcefn step_specs(&self) -> &'static [TaskStepSpec]
fn step_specs(&self) -> &'static [TaskStepSpec]
Initial step specs for this task kind.
Sourcefn max_attempts(&self, runtime_config: &Config) -> i32
fn max_attempts(&self, runtime_config: &Config) -> i32
Maximum attempts for new tasks of this kind.
Sourcefn decode_payload(&self, task: &Task) -> Result<PayloadEnvelope>
fn decode_payload(&self, task: &Task) -> Result<PayloadEnvelope>
Decodes the product task payload envelope.
Sourcefn decode_result(&self, task: &Task) -> Result<Option<ResultEnvelope>>
fn decode_result(&self, task: &Task) -> Result<Option<ResultEnvelope>>
Decodes the product task result envelope.
Sourcefn retry_class(&self, error: &Error) -> TaskRetryClass
fn retry_class(&self, error: &Error) -> TaskRetryClass
Classifies a task failure for retry behavior.
Sourcefn process<'a>(
&self,
state: &'a State,
task: &'a Task,
context: Context,
) -> TaskProcessFuture<'a, Error>
fn process<'a>( &self, state: &'a State, task: &'a Task, context: Context, ) -> TaskProcessFuture<'a, Error>
Processes the task.