pub trait TaskBackend: Send + Sync {
// Required methods
fn enqueue<'life0, 'async_trait>(
&'life0 self,
task: Box<dyn Task>,
) -> Pin<Box<dyn Future<Output = Result<TaskId, TaskExecutionError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn dequeue<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<TaskId>, TaskExecutionError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_status<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<TaskStatus, TaskExecutionError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn update_status<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
status: TaskStatus,
) -> Pin<Box<dyn Future<Output = Result<(), TaskExecutionError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_task_data<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<Option<SerializedTask>, TaskExecutionError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn backend_name(&self) -> &str;
}Available on crate feature
tasks and non-WebAssembly only.Expand description
Trait for task queue backends that handle enqueueing, dequeueing, and status tracking.
Required Methods§
Sourcefn enqueue<'life0, 'async_trait>(
&'life0 self,
task: Box<dyn Task>,
) -> Pin<Box<dyn Future<Output = Result<TaskId, TaskExecutionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn enqueue<'life0, 'async_trait>(
&'life0 self,
task: Box<dyn Task>,
) -> Pin<Box<dyn Future<Output = Result<TaskId, TaskExecutionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Enqueues a task and returns its assigned ID.
Sourcefn dequeue<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<TaskId>, TaskExecutionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn dequeue<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<TaskId>, TaskExecutionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Dequeues the next available task ID, if any.
Sourcefn get_status<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<TaskStatus, TaskExecutionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_status<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<TaskStatus, TaskExecutionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Retrieves the current status of a task by its ID.
Sourcefn update_status<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
status: TaskStatus,
) -> Pin<Box<dyn Future<Output = Result<(), TaskExecutionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn update_status<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
status: TaskStatus,
) -> Pin<Box<dyn Future<Output = Result<(), TaskExecutionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Updates the status of a task.
Sourcefn get_task_data<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<Option<SerializedTask>, TaskExecutionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_task_data<'life0, 'async_trait>(
&'life0 self,
task_id: TaskId,
) -> Pin<Box<dyn Future<Output = Result<Option<SerializedTask>, TaskExecutionError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Get serialized task data by task ID
Returns the task data if found, None otherwise.
Sourcefn backend_name(&self) -> &str
fn backend_name(&self) -> &str
Returns the name of this backend implementation.