Skip to main content

LocalBackgroundTaskHost

Struct LocalBackgroundTaskHost 

Source
pub struct LocalBackgroundTaskHost { /* private fields */ }
Expand description

Tokio-backed background task host shared across runtime sessions.

Trait Implementations§

Source§

impl BackgroundTaskHost for LocalBackgroundTaskHost

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

fn subscribe( &self, filter: BackgroundTaskFilter, ) -> BoxStream<'static, BackgroundTaskEvent>

Source§

fn spawn_hidden<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session_id: &'life1 str, _label: &'life2 str, task: PluginSessionTask, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn await_hidden<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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,

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,

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.
Source§

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,

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,

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,

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,

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,

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,

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,

Cancel every live task in a session scope and return updated snapshots.
Source§

impl Default for LocalBackgroundTaskHost

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more