pub struct UpstreamHandle { /* private fields */ }Expand description
A send-capable handle to one configured upstream: a dedicated pooled
hyper client plus observability. Cheap to share via Arc from the
UpstreamRegistry.
Implementations§
Source§impl UpstreamHandle
impl UpstreamHandle
Sourcepub fn connect_timeout(&self) -> Duration
pub fn connect_timeout(&self) -> Duration
Effective connect timeout (explicit or default).
Sourcepub fn happy_eyeballs(&self) -> Option<Duration>
pub fn happy_eyeballs(&self) -> Option<Duration>
Effective happy-eyeballs delay (DW-030); None = racing disabled.
Sourcepub fn read_timeout(&self) -> Option<Duration>
pub fn read_timeout(&self) -> Option<Duration>
Per-attempt read timeout (timeouts.read_ms), if configured.
Sourcepub fn write_timeout(&self) -> Option<Duration>
pub fn write_timeout(&self) -> Option<Duration>
Response-body inactivity timeout (timeouts.write_ms), if
configured.
Sourcepub fn retry_params(&self) -> &RetryParams
pub fn retry_params(&self) -> &RetryParams
Resolved retry parameters (DW-014). attempts == 0 = retries off.
Sourcepub fn hedge_params(&self) -> &HedgeParams
pub fn hedge_params(&self) -> &HedgeParams
Resolved hedge parameters (DW-063).
Sourcepub fn retry_budget(&self) -> &Arc<RetryBudget>
pub fn retry_budget(&self) -> &Arc<RetryBudget>
This upstream’s rolling-window retry budget (DW-014).
Sourcepub fn max_pending(&self) -> u32
pub fn max_pending(&self) -> u32
Effective pending cap (DW-015); 0 = unbounded queueing.
Sourcepub fn breaker(&self) -> &Arc<Breaker>
pub fn breaker(&self) -> &Arc<Breaker>
This upstream’s circuit breaker state (DW-015). Always present;
consult UpstreamHandle::breaker_params first — a None there
means the breaker is disabled and the state object is dormant.
Sourcepub fn breaker_params(&self) -> Option<&BreakerParams>
pub fn breaker_params(&self) -> Option<&BreakerParams>
Resolved breaker parameters (DW-015); None = breaker disabled.
Sourcepub fn connections_opened(&self) -> u64
pub fn connections_opened(&self) -> u64
Total connections established since the handle was built.
Sourcepub fn requests_sent(&self) -> u64
pub fn requests_sent(&self) -> u64
Total requests sent through the pool.
Sourcepub fn lb(&self) -> &Arc<UpstreamLb>
pub fn lb(&self) -> &Arc<UpstreamLb>
This upstream’s load balancer (endpoint set, algorithm, in-flight counters). Exposed for the TLS-passthrough path (which picks an endpoint the same way) and for tests.
Sourcepub fn hash_on(&self) -> Option<&HashOn>
pub fn hash_on(&self) -> Option<&HashOn>
DP-07 (#236): the hash-key source for this upstream’s
consistent-hash load balancer (ip_hash or maglev). None
means the client IP is used (the default).
Sourcepub fn set_locality_context(&self, ctx: LocalityContext)
pub fn set_locality_context(&self, ctx: LocalityContext)
DW-094 (Ent): set the edge’s locality context on this upstream’s load balancer. Called by the dataplane at startup to propagate the edge’s region/zone (from env vars or edge labels) to every upstream’s balancer.
Sourcepub fn tls_roots(&self) -> Option<&RootCertStore>
pub fn tls_roots(&self) -> Option<&RootCertStore>
The trust roots this upstream’s TLS connections verify against
(#121): None for plaintext http1 upstreams, the configured
trusted_ca_file bundle when set, else the webpki public set.
Active https health probes clone this so a probe and a proxied
request can never disagree about who to trust.
Sourcepub fn h3_handle(&self) -> Option<&Arc<H3UpstreamHandle>>
pub fn h3_handle(&self) -> Option<&Arc<H3UpstreamHandle>>
DW-108: the H3/QUIC upstream transport, when this upstream is
protocol: h3 AND the h3 cargo feature is enabled. The QUIC
active health probe reuses its TLS client config (trust roots +
h3 ALPN) so a probe and a proxied request trust the same roots.
None for non-H3 upstreams or when the feature is off.
Sourcepub fn protocol(&self) -> UpstreamProtocol
pub fn protocol(&self) -> UpstreamProtocol
The configured upstream protocol (DW-108). H3 selects the QUIC
transport; the other variants use the TCP/TLS pooled client.
Sourcepub async fn send<B>(
&self,
req: Request<B>,
) -> Result<Response<UpstreamBody>, UpstreamError>
pub async fn send<B>( &self, req: Request<B>, ) -> Result<Response<UpstreamBody>, UpstreamError>
Send a request through this upstream’s pool without a hash key
(algorithms other than ip_hash ignore the key anyway).
Sourcepub async fn send_with_hash_key<B>(
&self,
req: Request<B>,
hash_key: Option<&str>,
) -> Result<Response<UpstreamBody>, UpstreamError>
pub async fn send_with_hash_key<B>( &self, req: Request<B>, hash_key: Option<&str>, ) -> Result<Response<UpstreamBody>, UpstreamError>
Send a request through this upstream’s pool, dispatching via the
upstream’s load balancer (DW-011). hash_key is the client IP as a
string (used by ip_hash; ignored by the other algorithms). The
picked endpoint’s address:port becomes both the dialed URI’s
authority and the outbound Host header (replacing whatever the
caller set); the path and query are preserved verbatim. The picked
endpoint’s in-flight counter is held for the request/response-header
exchange (documented approximation: released when headers resolve,
not when the streaming body completes). The response body streams
(wrapped in UpstreamBody for the DW-014 write-timeout /
mid-body health reporting knobs; the wrapper is a frame-for-frame
passthrough when both are unset), so proxying (DW-009) can forward
it without buffering.
Sourcepub async fn send_with_hash_key_observed<B>(
&self,
req: Request<B>,
hash_key: Option<&str>,
picked: &mut Option<String>,
) -> Result<Response<UpstreamBody>, UpstreamError>
pub async fn send_with_hash_key_observed<B>( &self, req: Request<B>, hash_key: Option<&str>, picked: &mut Option<String>, ) -> Result<Response<UpstreamBody>, UpstreamError>
UpstreamHandle::send_with_hash_key with observability
(DW-021): the load-balancer pick runs under an upstream_pick
span (child of the caller’s upstream_attempt span) and the
picked endpoint’s address:port is written to picked when a
dispatch resolved (left None on the NoEndpoints guard), so the
proxy can attribute the attempt in its access log and the
upstream_attempts_total metric.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for UpstreamHandle
impl !RefUnwindSafe for UpstreamHandle
impl Send for UpstreamHandle
impl Sync for UpstreamHandle
impl Unpin for UpstreamHandle
impl !UnwindSafe for UpstreamHandle
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more