Skip to main content

InterventionRouter

Struct InterventionRouter 

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

Routes an operator’s neutral command to the worker owning the target attempt, gating on the worker’s advertised capabilities first (NOI-6).

Implementations§

Source§

impl InterventionRouter

Source

pub fn new( registry: ConnectedWorkerRegistry, owners: AttemptOwnerIndex, transport: Arc<dyn InterventionTransport>, ) -> Self

Build a router over the connected-worker registry, the attempt-owner owners index, and the command transport.

Source

pub fn with_transcript_publisher( self, publisher: ActivityEventPublisher, ) -> Self

Install the transcript publisher an applied InjectMessage is teed into (as an operator User message on the target attempt’s durable stream). Retention here is best-effort at this seam: a publish failure is logged and the Applied ack still returned, exactly like the worker-ingress tap.

Source

pub fn owners(&self) -> &AttemptOwnerIndex

The attempt-owner index the router resolves through, so the dispatch path can bind/release ownership on the same index.

Source

pub async fn route( &self, command: InterventionCommand, ) -> Result<InterventionOutcome, ServerError>

Route one operator command to the owning worker, returning the neutral ack.

Resolves the owning worker for the command’s (workflow, activity, attempt). A missing owner or a registry entry that has since disconnected is the attempt-scoped no-op (InterventionOutcome::stale_target). When the owning worker does not advertise the command’s primitive, the router refuses it at the server (InterventionOutcome::capability_not_supported) and NEVER sends it. Otherwise it pushes over the transport and returns the worker’s ack. A transport fault (the connection dropped mid-route) is mapped to a stale-target no-op — the target is unreachable, which is exactly the too-late class from the operator’s view.

§Errors

Returns ServerError::LockPoisoned only if the registry lock is poisoned.

Source

pub fn capabilities_for( &self, key: &AttemptKey, ) -> Result<Option<InterventionCapabilities>, ServerError>

The advertised capability set of the worker currently owning key, if any — what the ops console reads to decide which controls to offer (NOI-7).

§Errors

Returns ServerError::LockPoisoned if the registry lock is poisoned.

Source

pub fn intervenable_attempts( &self, workflow_id: &WorkflowId, ) -> Result<Vec<(AttemptKey, InterventionCapabilities)>, ServerError>

Every live, intervenable attempt of workflow_id paired with its owning worker’s advertised InterventionCapabilities — the enumeration the ops console reads to pick a target and gate controls (NOI-7).

Only attempts with a LIVE owner appear: a finished or superseded attempt has no owner entry and is not enumerated. An attempt whose owner has since disconnected (present in the index but gone from the registry) is likewise dropped, so the console never offers a control for an unreachable attempt. The capability set is the SAME advertised set the router gates route on, so the console and the server agree on exactly which primitives are supported.

§Errors

Returns ServerError::LockPoisoned if the registry lock is poisoned.

Trait Implementations§

Source§

impl Debug for InterventionRouter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoMaybeUndefined<T> for T

Source§

fn into_maybe_undefined(self) -> MaybeUndefined<T>

Converts this value into a three-state builder argument.
Source§

impl<T> IntoOption<T> for T

Source§

fn into_option(self) -> Option<T>

Converts this value into an optional builder argument.
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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