Skip to main content

TaskRegistry

Trait TaskRegistry 

Source
pub trait TaskRegistry: Send + Sync {
Show 14 methods // Required methods fn create<'life0, 'async_trait>( &'life0 self, task: Task, ) -> Pin<Box<dyn Future<Output = Result<Task, PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<Option<Task>, PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update<'life0, 'life1, 'async_trait>( &'life0 self, task: &'life1 Task, ) -> Pin<Box<dyn Future<Output = Result<Task, PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn delete<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<bool, PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn restore<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<bool, PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn update_status<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, status: TaskStatus, result: Option<Value>, error: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<Task, PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 TaskFilter, ) -> Pin<Box<dyn Future<Output = Result<Vec<Task>, PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_subtasks<'life0, 'life1, 'async_trait>( &'life0 self, parent_id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<Vec<Task>, PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_tree<'life0, 'life1, 'async_trait>( &'life0 self, root_id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<Vec<Task>, PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn add_dependency<'life0, 'async_trait>( &'life0 self, dep: TaskDependency, ) -> Pin<Box<dyn Future<Output = Result<(), PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn remove_dependency<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, task_id: &'life1 TaskId, depends_on_id: &'life2 TaskId, ) -> Pin<Box<dyn Future<Output = Result<(), PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_dependencies<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskDependency>, PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_dependents<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskDependency>, PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_ready_tasks<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Task>, PeError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Async task storage with CRUD, queries, and dependency management.

All operations are async and return Result<T, PeError>. Implementations must be Send + Sync for use across async tasks.

Required Methods§

Source

fn create<'life0, 'async_trait>( &'life0 self, task: Task, ) -> Pin<Box<dyn Future<Output = Result<Task, PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a new task. Returns the created task with generated ID.

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<Option<Task>, PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a task by ID. Returns None if not found or deleted.

Source

fn update<'life0, 'life1, 'async_trait>( &'life0 self, task: &'life1 Task, ) -> Pin<Box<dyn Future<Output = Result<Task, PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update an existing task. Returns the updated task.

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<bool, PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Soft-delete a task (sets deleted_at). Returns true if found.

Source

fn restore<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<bool, PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Restore a soft-deleted task. Returns true if found in trash.

Source

fn update_status<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 TaskId, status: TaskStatus, result: Option<Value>, error: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<Task, PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update task status (with lifecycle validation).

Source

fn list<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 TaskFilter, ) -> Pin<Box<dyn Future<Output = Result<Vec<Task>, PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List tasks matching a filter.

Source

fn get_subtasks<'life0, 'life1, 'async_trait>( &'life0 self, parent_id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<Vec<Task>, PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get direct subtasks of a parent.

Source

fn get_tree<'life0, 'life1, 'async_trait>( &'life0 self, root_id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<Vec<Task>, PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the full subtask tree (recursive) rooted at a task.

Source

fn add_dependency<'life0, 'async_trait>( &'life0 self, dep: TaskDependency, ) -> Pin<Box<dyn Future<Output = Result<(), PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Add a dependency edge. Rejects if it would create a cycle.

Source

fn remove_dependency<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, task_id: &'life1 TaskId, depends_on_id: &'life2 TaskId, ) -> Pin<Box<dyn Future<Output = Result<(), PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove a dependency edge.

Source

fn get_dependencies<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskDependency>, PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all dependencies of a task (what it depends on).

Source

fn get_dependents<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 TaskId, ) -> Pin<Box<dyn Future<Output = Result<Vec<TaskDependency>, PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get all dependents of a task (what depends on it).

Source

fn get_ready_tasks<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Task>, PeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get all tasks that are ready to execute (no incomplete Blocks deps).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§