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.