pub struct ControlRegistry { /* private fields */ }Expand description
The worker’s attempt back-index: maps a live SessionKey to its session
control leg, so a routed command reaches the exact in-flight attempt.
A session installs itself with Self::register when it starts and the
returned SessionGuard removes it on drop, so the index tracks exactly the
sessions running on this worker. It is cheap to clone (an Arc inside), so the
liminal serve loop and the session-spawn path share one index.
Implementations§
Source§impl ControlRegistry
impl ControlRegistry
Sourcepub fn register(
&self,
key: SessionKey,
control: UnboundedSender<ControlMessage>,
capabilities: InterventionCapabilities,
) -> SessionGuard
pub fn register( &self, key: SessionKey, control: UnboundedSender<ControlMessage>, capabilities: InterventionCapabilities, ) -> SessionGuard
Register a live session’s control leg under its key, returning a guard
whose drop deregisters it (so the index never routes to a gone session).
The control sender is the driver’s control channel (the receiver half is
handed to spawn_agent as its
control_receiver); capabilities is the session’s advertised neutral
primitive set, which the worker gates on before delivering a command.
Sourcepub async fn deliver(&self, command: InterventionCommand) -> InterventionOutcome
pub async fn deliver(&self, command: InterventionCommand) -> InterventionOutcome
Deliver one routed command to the session that owns its target, returning
the neutral InterventionOutcome ack.
Resolves the target session by (workflow, activity, attempt). When no live
session owns the target, returns InterventionOutcome::stale_target — the
attempt-scoped no-op. When the session’s advertised capabilities do not
include the command’s primitive, returns
InterventionOutcome::capability_not_supported WITHOUT delivering it (the
worker gate mirrors the server gate; a well-behaved server never sends an
unadvertised primitive, but the worker refuses one cleanly if it arrives).
Otherwise it delivers the command and awaits the driver’s ack.
Trait Implementations§
Source§impl Clone for ControlRegistry
impl Clone for ControlRegistry
Source§fn clone(&self) -> ControlRegistry
fn clone(&self) -> ControlRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ControlRegistry
impl Debug for ControlRegistry
Source§impl Default for ControlRegistry
impl Default for ControlRegistry
Source§fn default() -> ControlRegistry
fn default() -> ControlRegistry
Auto Trait Implementations§
impl Freeze for ControlRegistry
impl RefUnwindSafe for ControlRegistry
impl Send for ControlRegistry
impl Sync for ControlRegistry
impl Unpin for ControlRegistry
impl UnsafeUnpin for ControlRegistry
impl UnwindSafe for ControlRegistry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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