Skip to main content

ApprovalBroker

Struct ApprovalBroker 

pub struct ApprovalBroker { /* private fields */ }
Expand description

Authorization + quorum layer over resolve_gate. Holds NO copy of the approval policy/group config - it resolves every policy and membership decision from the engine’s live [sop.approval] at use-time (single source of truth), so a config reload cannot leave the broker deciding on stale rules. It carries only the identity-resolution seam and the route adapter.

Implementations§

Source§

impl ApprovalBroker

Source

pub fn new( resolver: Arc<dyn ApprovalIdentityResolver>, route: Arc<dyn ApprovalRouteAdapter>, ) -> ApprovalBroker

Build with an explicit identity resolver and route adapter.

Source

pub fn with_route(route: Arc<dyn ApprovalRouteAdapter>) -> ApprovalBroker

Build with the config-backed local resolver and the given route adapter. Policies/groups are read from the engine’s live config at resolve-time, so there is no per-broker config to keep in sync.

Source

pub fn disabled() -> ApprovalBroker

A broker with the local resolver and a no-op route. With no [sop.approval] policy in the engine config resolve behaves exactly like resolve_gate (the engine default, so behavior is unchanged until a policy is configured).

Source

pub fn escalation_route( &self, cfg: &SopApprovalConfig, policy_name: &str, ) -> Option<String>

The explicit escalation route for a named policy (Phase 10), read from live config. An empty string is treated the same as None; callers that deliver a timeout notice must use escalation_delivery_route to apply the request-route fallback promised by the config contract.

Source

pub fn deliver_escalation(&self, route: &str, notice: &GateNotice<'_>)

Deliver an escalation notice to a route (best-effort).

Source

pub fn request_route( &self, cfg: &SopApprovalConfig, policy_name: &str, ) -> Option<String>

The request route for a named policy: the channel the INITIAL approval request is delivered to when a run parks at a gate this policy governs. Read from live config; an empty string is treated as None (no out-of-band request notice), matching the config contract. This is a DISTINCT lifecycle event from escalation_route - the request fires on park, the escalation only if the gate later times out.

Source

pub fn escalation_delivery_route( &self, cfg: &SopApprovalConfig, policy_name: &str, ) -> Option<String>

The route a timeout escalation actually delivers to: an explicit escalation route when present, otherwise the initial request route. None means the policy has no out-of-band route to re-surface.

Source

pub fn reply_routes( &self, cfg: &SopApprovalConfig, policy_name: &str, ) -> Vec<String>

Every route that can receive approval reply instructions for a policy’s current gate. The request route is first; a distinct effective escalation route follows. Text fallback admission uses this exact set so it cannot drift from timeout delivery semantics.

Source

pub fn deliver_request(&self, route: &str, notice: &GateNotice<'_>)

Deliver the initial approval-request notice to a route (best-effort). Fired when a run parks at a policied gate; a delivery failure never blocks or clears the gate (the gate is the source of truth, this is only a notice).

Source

pub fn resolve( &self, engine: &mut SopEngine, run_id: &str, decision: ApprovalDecision, principal: ApprovalPrincipal, ) -> Result<BrokerOutcome, Error>

Resolve a gate through the broker: enforce membership + quorum, then call the chokepoint. engine is the authoritative gate owner; the broker only decides whether (and when) to reach resolve_gate.

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.

§

impl<T> Instrument for T

§

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

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

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

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

§

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
§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

§

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

§

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