Crate task_deport
source ·Expand description
This module provides a trait for interacting with task storage. The storage allows tasks to be pushed to and popped from a queue, and also allows tasks to be set and retrieved by their UUID.
Re-exports
pub use memory::InMemoryTaskStorage;
pub use memory::InMemoryTaskStorageError;
pub use redis::RedisTaskStorage;
pub use redis::RedisTaskStorageError;
Modules
- In-memory implementation of TaskStorage trait. The storage allows tasks to be pushed to and popped from a queue, and also allows tasks to be set and retrieved by their UUID.
- Provides implementation of trait to store task into redis TODO: make sequental ops into atomic transaction
Structs
- A
Task
struct represents a single unit of work that will be processed by a worker. It contains data of typeD
, which is used by the worker during processing. TheTask
struct also includes fields for managing the task’s lifecycle, including the task’s UUID, the start and finish times, the number of retries, and any error messages.
Traits
- A trait that describes the necessary methods for task storage. This includes methods for acknowledging a task, getting a task by its UUID, setting a task, popping a task from the queue, and pushing a task into the queue. Whole functions should be non blocking. I.e. task_push should return None to be able to process situation when there is no tasks in queue on worker side.