pub struct AppState {
pub config: Arc<ProxyConfig>,
pub http: Client,
pub providers: ProviderRegistry,
pub gate_health: Arc<GateHealthRegistry>,
pub traces: TraceSender,
pub adaptive: Option<Arc<Mutex<AdaptiveConformal>>>,
pub tenant_rate_limiter: Option<Arc<DefaultKeyedRateLimiter<String>>>,
}Expand description
Shared state handed to every request handler. Cheap to clone: an Arced config, a
pooled HTTP client, and a bounded channel sender.
Fields§
§config: Arc<ProxyConfig>Static proxy configuration.
http: ClientShared, connection-pooled HTTP client used to call upstream (observe passthrough).
providers: ProviderRegistryMulti-provider registry used by the enforce-mode escalation engine.
gate_health: Arc<GateHealthRegistry>Per-gate error budgets (auto-disable), shared across requests.
traces: TraceSenderFire-and-forget sender to the background trace writer.
adaptive: Option<Arc<Mutex<AdaptiveConformal>>>Optional online/adaptive conformal serve threshold (Gibbs-Candès ACI). None = fixed
serve_threshold from config (default). When present, /v1/feedback nudges it live and the
enforce path reads its current value per request — the reactive, self-tuning loop.
tenant_rate_limiter: Option<Arc<DefaultKeyedRateLimiter<String>>>Per-tenant request rate limiter (ADR 0004 §D6). None (the default) disables rate
limiting entirely — set via build_tenant_rate_limiter from
ProxyConfig::tenant_rate_per_sec.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AppState
impl !UnwindSafe for AppState
impl Freeze for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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