pub struct FileTaskRegistry { /* private fields */ }Expand description
JSON-file-backed TaskRegistry.
This backend is meant for local app use: durable across short-lived process launches, simple to inspect, and dependency-free. It is not a multi-writer database; concurrent writers can still race at the file level.
Implementations§
Source§impl FileTaskRegistry
impl FileTaskRegistry
Sourcepub fn new(path: impl Into<PathBuf>) -> Result<Self, PeError>
pub fn new(path: impl Into<PathBuf>) -> Result<Self, PeError>
Create a registry backed by path with the default lifecycle.
Sourcepub fn with_lifecycle(
path: impl Into<PathBuf>,
lifecycle: impl TaskLifecycle + 'static,
) -> Result<Self, PeError>
pub fn with_lifecycle( path: impl Into<PathBuf>, lifecycle: impl TaskLifecycle + 'static, ) -> Result<Self, PeError>
Create a registry backed by path with a custom lifecycle.
Trait Implementations§
Source§impl TaskRegistry for FileTaskRegistry
impl TaskRegistry for FileTaskRegistry
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 FileTaskRegistry
impl !RefUnwindSafe for FileTaskRegistry
impl !UnwindSafe for FileTaskRegistry
impl Send for FileTaskRegistry
impl Sync for FileTaskRegistry
impl Unpin for FileTaskRegistry
impl UnsafeUnpin for FileTaskRegistry
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