pub struct InMemoryTaskRegistry { /* private fields */ }Expand description
In-memory task registry backed by HashMap + Mutex.
Thread-safe via interior mutability. All tasks and dependencies are stored in memory — lost on drop.
§Example
use pe_tasks::InMemoryTaskRegistry;
let registry = InMemoryTaskRegistry::new();Implementations§
Source§impl InMemoryTaskRegistry
impl InMemoryTaskRegistry
Sourcepub fn with_lifecycle(lifecycle: impl TaskLifecycle + 'static) -> Self
pub fn with_lifecycle(lifecycle: impl TaskLifecycle + 'static) -> Self
Create with a custom lifecycle.
Trait Implementations§
Source§impl Default for InMemoryTaskRegistry
impl Default for InMemoryTaskRegistry
Source§impl TaskRegistry for InMemoryTaskRegistry
impl TaskRegistry for InMemoryTaskRegistry
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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).
Auto Trait Implementations§
impl !Freeze for InMemoryTaskRegistry
impl !RefUnwindSafe for InMemoryTaskRegistry
impl !UnwindSafe for InMemoryTaskRegistry
impl Send for InMemoryTaskRegistry
impl Sync for InMemoryTaskRegistry
impl Unpin for InMemoryTaskRegistry
impl UnsafeUnpin for InMemoryTaskRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more