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
impl PartnerRouter
Sourcepub fn new(adapters: BTreeMap<String, Box<dyn PartnerAdapter>>) -> Self
pub fn new(adapters: BTreeMap<String, Box<dyn PartnerAdapter>>) -> Self
Builds a router over the given endpoint-keyed adapters.
Sourcepub fn set_secret_query_keys(&self, keys: Vec<String>)
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.
Sourcepub fn adapter(&self, key: &str) -> Option<&dyn PartnerAdapter>
pub fn adapter(&self, key: &str) -> Option<&dyn PartnerAdapter>
The adapter registered under key, if any.
Every registered partner that owns a bound authority, as
(declared key, bound authority) pairs.
Sourcepub fn lane_key_for(&self, declared: &str, interpolated: &str) -> Option<String>
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.
Sourcepub fn wire_target(
&self,
declared_key: &str,
interpolated_uri: &str,
) -> Option<String>
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_keynames a registered partner AND carries the unroutable port-0 authority (the harness-declared form, ADR-0069 §8): rewrite only the authority ofinterpolated_urito that partner’s bound authority, preserving the interpolated path and query.declared_keynames 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.
Sourcepub async fn send(
&self,
declared: &str,
interpolated: &str,
msg: OutgoingMessage,
) -> Result<Option<Exchange>, TransportError>
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.
Sourcepub async fn receive(
&self,
declared: &str,
interpolated: &str,
deadline: Duration,
) -> Result<IncomingMessage, ReceiveError>
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§
impl !RefUnwindSafe for PartnerRouter
impl !UnwindSafe for PartnerRouter
impl Freeze for PartnerRouter
impl Send for PartnerRouter
impl Sync for PartnerRouter
impl Unpin for PartnerRouter
impl UnsafeUnpin for PartnerRouter
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§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