pub struct UpstreamRegistry { /* private fields */ }Expand description
The live set of upstreams, keyed by name. Owned by Control, OUTSIDE the swapped
ActiveConfig, so health state survives a reload (ADR 000017). The Mutex is contended only by
reconcile (on reload) and the prober supervisor (groups) / a config build (group) — never
the per-request hot path, which holds an Arc<UpstreamGroup> resolved at build time.
Implementations§
Source§impl UpstreamRegistry
impl UpstreamRegistry
pub fn new() -> Self
Sourcepub fn reconcile(
&self,
upstreams: &[Upstream],
base_dir: &Path,
) -> Result<(), ControlError>
pub fn reconcile( &self, upstreams: &[Upstream], base_dir: &Path, ) -> Result<(), ControlError>
Reconcile the registry to upstreams (ADR 000017). Validation (duplicate name, empty
addresses, the LB config — ADR 000035 — and the [upstream.tls] CA load, ADR 000042) runs
FIRST against the whole list, so a bad manifest leaves the running set untouched
(all-or-nothing, like the rest of a reload). Then, per upstream: build a new group whose
instances reuse the existing Arc<UpstreamInstance> for any unchanged (name, address, weight) when the health policy and [upstream.tls] are unchanged (a TLS change makes
prior probe results meaningless, so it re-probes from pessimistic like a health-policy
change), create a fresh pessimistic instance otherwise, build the LB state (a Maglev
upstream recomputes its table from the instance set), and drop upstreams no longer present.
base_dir resolves each [upstream.tls] ca_path, like the [[tls]] cert paths.
Sourcepub fn group(&self, name: &str) -> Option<Arc<UpstreamGroup>>
pub fn group(&self, name: &str) -> Option<Arc<UpstreamGroup>>
The group named name, if present — used to resolve a route’s upstream at config-build time.
Sourcepub fn groups(&self) -> Vec<Arc<UpstreamGroup>>
pub fn groups(&self) -> Vec<Arc<UpstreamGroup>>
A snapshot of every current group, for the health-check supervisor to probe.
Trait Implementations§
Source§impl Debug for UpstreamRegistry
impl Debug for UpstreamRegistry
Source§impl Default for UpstreamRegistry
impl Default for UpstreamRegistry
Source§fn default() -> UpstreamRegistry
fn default() -> UpstreamRegistry
Auto Trait Implementations§
impl !Freeze for UpstreamRegistry
impl RefUnwindSafe for UpstreamRegistry
impl Send for UpstreamRegistry
impl Sync for UpstreamRegistry
impl Unpin for UpstreamRegistry
impl UnsafeUnpin for UpstreamRegistry
impl UnwindSafe for UpstreamRegistry
Blanket Implementations§
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
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 more