Skip to main content

PartnerRouter

Struct PartnerRouter 

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

Dispatches adapter calls by declared endpoint key to the endpoint-keyed adapter map it wraps, and owns the shared http client lane (feature http).

Sends split into two keys — the declared endpoint string and the interpolated wire address — and http-scheme sends route through the router’s own ClientLane (camel-component-http, feature http): a declared :0 harness key dials the partner’s bound address, a dynamic reference resolves by interpolated authority, and a plain string dials its literal URI — no Unbound failure for http schemes. Non-http schemes dispatch to the registered adapter as before: an endpoint URI with no registered adapter fails the send at the transport (TransportError::Unbound) and the receive at the transport too (ReceiveError::Transport) — no partner exists that could ever deliver, the failure is apparatus class, and the call never hangs.

Receives are client-role-first: a roundtrip parked by the router’s own client lane wins over the partner adapter’s server-role arrivals.

Implementations§

Source§

impl PartnerRouter

Source

pub fn new(adapters: BTreeMap<String, Box<dyn PartnerAdapter>>) -> Self

Builds a router over the given endpoint-keyed adapters.

Source

pub fn set_secret_query_keys(&self, keys: Vec<String>)

Stores the secret-marked query-key set (ADR-0051) and fans it out to every redaction site: kept here for partner-validate mismatch rendering, set on the router-owned http client lane and on every registered adapter for their receive-timeout diagnostics. The set crosses the CLI→harness boundary as plain strings, derived from the booted context’s component metadata.

Source

pub fn adapter(&self, key: &str) -> Option<&dyn PartnerAdapter>

The adapter registered under key, if any.

Source

pub fn authorities(&self) -> Vec<(String, String)>

Every registered partner that owns a bound authority, as (declared key, bound authority) pairs.

Source

pub fn lane_key_for(&self, declared: &str, interpolated: &str) -> Option<String>

The lane key a receive under (declared, interpolated) reads: the declared string itself when it names a registered partner key (lane reads by declared key, today’s behavior); otherwise the registered key of the partner whose bound authority equals the interpolated URI’s authority. None when neither resolves (plain strings): the caller falls back to the declared string.

Source

pub fn wire_target( &self, declared_key: &str, interpolated_uri: &str, ) -> Option<String>

The wire target a send under (declared_key, interpolated_uri) dials, when it differs from plain literal dialing.

  • declared_key names a registered partner AND carries the unroutable port-0 authority (the harness-declared form, ADR-0069 §8): rewrite only the authority of interpolated_uri to that partner’s bound authority, preserving the interpolated path and query.
  • declared_key names no partner but the interpolated URI’s authority equals a bound partner’s authority: return that partner’s authority rewrite (path preserved) — the resolved URI for a dynamic reference.
  • Anything else — a routable declared key (a partner registered under its own bound address, or under a foreign endpoint as a client-role vehicle) or an address no partner owns — is None: the caller dials the interpolated URI literally.
Source

pub async fn send( &self, declared: &str, interpolated: &str, msg: OutgoingMessage, ) -> Result<Option<Exchange>, TransportError>

Sends msg under the two-key contract: dispatch by declared endpoint key, dial by resolved address (see the type docs for the http cases). The synchronous reply of a context-stimulus direct: send travels back in the Ok slot; every partner path answers None.

Source

pub async fn receive( &self, declared: &str, interpolated: &str, deadline: Duration, ) -> Result<IncomingMessage, ReceiveError>

Receives under the two-key contract, client-role-first: derive the lane key (Self::lane_key_for, falling back to the declared string for plain strings), return a roundtrip parked by the router’s own client lane when one exists — probed under the composite of the lane key and the interpolated reference’s own path (path-aware parking, bd rc-cr5yf), so a receive drains its own path’s roundtrip and never another path’s — and otherwise delegate the server-role receive to the adapter registered under that key. TransportError::Unbound only when neither a parked roundtrip nor a registered adapter exists.

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> 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
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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> 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, !>

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