pub struct LocalBackgroundTaskHost { /* private fields */ }Expand description
Tokio-backed background task host shared across runtime sessions.
Trait Implementations§
Source§impl BackgroundTaskHost for LocalBackgroundTaskHost
impl BackgroundTaskHost for LocalBackgroundTaskHost
fn register<'life0, 'async_trait>(
&'life0 self,
request: BackgroundTaskRegisterRequest,
) -> Pin<Box<dyn Future<Output = Result<BackgroundTaskRecord, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
update: BackgroundTaskUpdate,
) -> Pin<Box<dyn Future<Output = Result<BackgroundTaskRecord, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
outcome: BackgroundTaskCompletion,
) -> Pin<Box<dyn Future<Output = Result<BackgroundTaskRecord, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn request_cancel<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
reason: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<BackgroundTaskRecord, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Option<BackgroundTaskRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
filter: BackgroundTaskFilter,
) -> Pin<Box<dyn Future<Output = Vec<BackgroundTaskRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn transfer<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 str,
new_scope: BackgroundTaskScope,
) -> Pin<Box<dyn Future<Output = Result<BackgroundTaskRecord, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe( &self, filter: BackgroundTaskFilter, ) -> BoxStream<'static, BackgroundTaskEvent>
Source§fn spawn_managed<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
spec: BackgroundTaskRegistration,
task: PluginSessionTask,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn spawn_managed<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
spec: BackgroundTaskRegistration,
task: PluginSessionTask,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Spawn a tokio-backed background task and register it under
spec.id.
Local host owns the Tokio future and can abort it via cancel_managed.Source§fn register_external<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
spec: BackgroundTaskRegistration,
cancel: Option<LocalBackgroundTaskCancel>,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn register_external<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
spec: BackgroundTaskRegistration,
cancel: Option<LocalBackgroundTaskCancel>,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Register an externally-owned task (e.g. a subagent session) so it
shows up in
list_managed. The local host does not hold a JoinHandle;
if cancel is supplied it will be invoked when the registry receives
a cancel request, otherwise cancellation only updates bookkeeping.fn unregister_external<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
task_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn mark_terminal<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
task_id: &'life2 str,
state: BackgroundTaskState,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn mark_terminal<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
task_id: &'life2 str,
state: BackgroundTaskState,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Update the state of a registered task to a terminal value.
No-op if the task is unknown or already terminal.
Source§fn mark_live_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
task_id: &'life2 str,
state: BackgroundTaskState,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn mark_live_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
task_id: &'life2 str,
state: BackgroundTaskState,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Transition a still-live task between the non-terminal
Running
and Waiting states. Used by subagents to reflect whether the
session is actively working on a task or waiting for a
follow-up. No-op if the task is unknown or already terminal.Source§fn cancel_managed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
task_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn cancel_managed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
task_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Cancel a tokio-backed task by id. No-op for externally-owned entries;
callers should also mark those terminal via
mark_terminal.Source§fn list_managed<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Vec<BackgroundTaskRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_managed<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Vec<BackgroundTaskRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Read-only snapshot of every registered task for the session.
Source§fn get_managed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
task_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<BackgroundTaskRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_managed<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
task_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<BackgroundTaskRecord>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Look up a single task’s metadata.
Source§fn transfer_managed<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
from_session_id: &'life1 str,
to_session_id: &'life2 str,
task_ids: &'life3 [String],
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn transfer_managed<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
from_session_id: &'life1 str,
to_session_id: &'life2 str,
task_ids: &'life3 [String],
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Move still-registered tasks from one session scope to another.
Source§fn cancel_all_managed<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<BackgroundTaskRecord>, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel_all_managed<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<BackgroundTaskRecord>, PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Cancel every live task in a session scope and return updated snapshots.
Auto Trait Implementations§
impl !Freeze for LocalBackgroundTaskHost
impl !RefUnwindSafe for LocalBackgroundTaskHost
impl Send for LocalBackgroundTaskHost
impl Sync for LocalBackgroundTaskHost
impl Unpin for LocalBackgroundTaskHost
impl UnsafeUnpin for LocalBackgroundTaskHost
impl !UnwindSafe for LocalBackgroundTaskHost
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