pub struct TaskStore { /* private fields */ }Expand description
Thread-safe task storage
Implementations§
Source§impl TaskStore
impl TaskStore
Sourcepub fn create_task(
&self,
tool_name: &str,
arguments: Value,
ttl: Option<u64>,
) -> (String, CancellationToken)
pub fn create_task( &self, tool_name: &str, arguments: Value, ttl: Option<u64>, ) -> (String, CancellationToken)
Create and store a new task
Returns the task ID and a cancellation token for the spawned work.
Sourcepub fn get_task_full(
&self,
task_id: &str,
) -> Option<(TaskStatus, Option<CallToolResult>, Option<String>)>
pub fn get_task_full( &self, task_id: &str, ) -> Option<(TaskStatus, Option<CallToolResult>, Option<String>)>
Get full task data by ID (for internal use)
Sourcepub fn list_tasks(&self, status_filter: Option<TaskStatus>) -> Vec<TaskInfo>
pub fn list_tasks(&self, status_filter: Option<TaskStatus>) -> Vec<TaskInfo>
List all tasks, optionally filtered by status
Sourcepub fn update_progress(
&self,
task_id: &str,
progress: f64,
message: Option<String>,
) -> bool
pub fn update_progress( &self, task_id: &str, progress: f64, message: Option<String>, ) -> bool
Update task progress
Sourcepub fn require_input(&self, task_id: &str, message: &str) -> bool
pub fn require_input(&self, task_id: &str, message: &str) -> bool
Mark a task as requiring input
Sourcepub fn complete_task(&self, task_id: &str, result: CallToolResult) -> bool
pub fn complete_task(&self, task_id: &str, result: CallToolResult) -> bool
Mark a task as completed with a result
Sourcepub fn fail_task(&self, task_id: &str, error: &str) -> bool
pub fn fail_task(&self, task_id: &str, error: &str) -> bool
Mark a task as failed with an error
Sourcepub fn cancel_task(
&self,
task_id: &str,
reason: Option<&str>,
) -> Option<TaskStatus>
pub fn cancel_task( &self, task_id: &str, reason: Option<&str>, ) -> Option<TaskStatus>
Cancel a task
Sourcepub fn cleanup_expired(&self) -> usize
pub fn cleanup_expired(&self) -> usize
Remove expired tasks (call periodically for cleanup)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaskStore
impl RefUnwindSafe for TaskStore
impl Send for TaskStore
impl Sync for TaskStore
impl Unpin for TaskStore
impl UnwindSafe for TaskStore
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