pub struct SessionWakeQueue { /* private fields */ }Expand description
Per-session mid-turn wake queue behind the registry seam.
Feed it by registering it as a TaskTransitionObserver on an
crate::task_observer::ObservingTaskRegistry (or the server’s
DbSessionTaskRegistry). Drain it from the turn loop with Self::drain.
Implementations§
Source§impl SessionWakeQueue
impl SessionWakeQueue
pub fn new() -> Self
Sourcepub fn note_transition(
&self,
task: &SessionTask,
transition: TaskTransition,
) -> bool
pub fn note_transition( &self, task: &SessionTask, transition: TaskTransition, ) -> bool
Enqueue a wake for task’s owning session if its policy wakes on
transition. Returns true when a wake was enqueued.
Sourcepub fn drain(&self, session_id: SessionId) -> Vec<PendingWake>
pub fn drain(&self, session_id: SessionId) -> Vec<PendingWake>
Atomically remove and return all wakes queued for session_id.
This is the exactly-once claim point: a drained wake is gone from the queue and can never be delivered again.
Sourcepub fn pending_len(&self, session_id: SessionId) -> usize
pub fn pending_len(&self, session_id: SessionId) -> usize
Number of wakes currently queued for session_id (not consuming).
Sourcepub fn has_pending(&self, session_id: SessionId) -> bool
pub fn has_pending(&self, session_id: SessionId) -> bool
Whether any wake is queued for session_id (not consuming).
Trait Implementations§
Source§impl Default for SessionWakeQueue
impl Default for SessionWakeQueue
Source§fn default() -> SessionWakeQueue
fn default() -> SessionWakeQueue
Source§impl TaskTransitionObserver for SessionWakeQueue
The queue is a TaskTransitionObserver so it can be attached to the same
seam the server webhook dispatcher uses (EVE-729). Terminal and
awaiting-input transitions render at full fidelity from the snapshot; a
message transition renders from the snapshot’s progress/detail.
impl TaskTransitionObserver for SessionWakeQueue
The queue is a TaskTransitionObserver so it can be attached to the same
seam the server webhook dispatcher uses (EVE-729). Terminal and
awaiting-input transitions render at full fidelity from the snapshot; a
message transition renders from the snapshot’s progress/detail.
Source§fn on_transition<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 SessionTask,
transition: TaskTransition,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_transition<'life0, 'life1, 'async_trait>(
&'life0 self,
task: &'life1 SessionTask,
transition: TaskTransition,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Err is logged and
never fails the task operation that produced the transition.Auto Trait Implementations§
impl !Freeze for SessionWakeQueue
impl RefUnwindSafe for SessionWakeQueue
impl Send for SessionWakeQueue
impl Sync for SessionWakeQueue
impl Unpin for SessionWakeQueue
impl UnsafeUnpin for SessionWakeQueue
impl UnwindSafe for SessionWakeQueue
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request