pub struct ServerState {Show 17 fields
pub model_client: ModelClient,
pub policy_client: PolicyClient,
pub registry: RegistryClient,
pub config: Arc<ServerConfig>,
pub metrics: Arc<Metrics>,
pub signing_key: Arc<SigningKey>,
pub verifying_key: Arc<VerifyingKey>,
pub published_jwt_verifying_keys: PublishedEd25519Keys,
pub resource_url: String,
pub oauth_issuer_url: String,
pub federation_resolver: Arc<FederationKeyResolver>,
pub dpop_jti_seen: Arc<TtlCache<ReplayKey, ()>>,
pub rate_limiter: Arc<RateLimiter>,
pub browser_provisioning_rate_limiter: Arc<RateLimiter>,
pub public_route_rate_limiter: Arc<RateLimiter>,
pub ninep_decider: Arc<dyn AccessDecider>,
pub ninep_vfs_pep: Option<Arc<NamespacePep>>,
}Expand description
Shared server state
Fields§
§model_client: ModelClientModel client for inference operations via ZMQ
policy_client: PolicyClientPolicy client for authorization checks via ZMQ
registry: RegistryClientRegistry client for model operations
config: Arc<ServerConfig>Server configuration (from unified config system)
metrics: Arc<Metrics>Metrics collector
signing_key: Arc<SigningKey>Ed25519 signing key for creating JWT tokens
verifying_key: Arc<VerifyingKey>Ed25519 verifying key for validating JWT tokens (derived from signing_key).
This is the cluster CA key. Locally-issued at+JWTs may instead be signed by
a rotation slot (see published_jwt_verifying_keys), so token validation
tries this key AND the published rotation keys.
published_jwt_verifying_keys: PublishedEd25519KeysLive, shared handle to the node’s published Ed25519 rotation-slot verifying
keys — the SAME set the /oauth/jwks endpoint publishes. Locally-issued
tokens signed by the OAuth rotation active/lead/drain slots (WIT, S6 grant /
token-exchange, WITs) verify against these in addition to verifying_key.
Only node-published public keys are ever admitted here (never token-supplied
keys). Populated + kept current by the key-rotation task.
resource_url: StringCached resource URL for WWW-Authenticate headers (avoids per-request config reload)
oauth_issuer_url: StringOAuth issuer URL for local tokens (matches the iss claim in locally-issued JWTs).
federation_resolver: Arc<FederationKeyResolver>Federation key resolver for multi-issuer JWT verification. Contains trusted issuers (empty if none configured).
dpop_jti_seen: Arc<TtlCache<ReplayKey, ()>>Per-request DPoP JTI dedup cache (RFC 9449 §11.1 replay prevention).
Backed by the shared TtlCache with atomic check-and-record
(insert_if_absent_no_evict); TTL = iat + 120s; fail-closed at capacity.
rate_limiter: Arc<RateLimiter>Per-subject request rate limiter (fixed window, 300 req/60s default).
browser_provisioning_rate_limiter: Arc<RateLimiter>Dedicated global limiter for public browser provisioning. This executes before checkpoint resolution and hybrid projection signing.
public_route_rate_limiter: Arc<RateLimiter>Stable global limiter for public metadata and pre-upgrade routes.
There is no authenticated tenant on these routes, and client-controlled forwarding headers must not select independent buckets.
ninep_decider: Arc<dyn AccessDecider>Mandatory resolver-backed, audited PEP shared by every 9P transport.
ninep_vfs_pep: Option<Arc<NamespacePep>>Armed only for the opt-in holder-scoped canonical 9P read export.
Implementations§
Source§impl ServerState
impl ServerState
Sourcepub fn resource_auth_state(&self) -> ResourceAuthState
pub fn resource_auth_state(&self) -> ResourceAuthState
Return the narrow state consumed by the shared HTTP authentication core.
Sourcepub async fn new(
config: ServerConfig,
model_client: ModelClient,
policy_client: PolicyClient,
registry: RegistryClient,
signing_key: SigningKey,
jwt_verifying_key: VerifyingKey,
resource_url: String,
oauth_issuer_url: String,
trusted_issuers: &HashMap<String, TrustedIssuerConfig>,
ninep_decider: Arc<dyn AccessDecider>,
ninep_vfs_pep: Option<Arc<NamespacePep>>,
) -> Result<Self, Error>
pub async fn new( config: ServerConfig, model_client: ModelClient, policy_client: PolicyClient, registry: RegistryClient, signing_key: SigningKey, jwt_verifying_key: VerifyingKey, resource_url: String, oauth_issuer_url: String, trusted_issuers: &HashMap<String, TrustedIssuerConfig>, ninep_decider: Arc<dyn AccessDecider>, ninep_vfs_pep: Option<Arc<NamespacePep>>, ) -> Result<Self, Error>
Create a new server state with ZMQ clients
This is the primary method for creating server state with ZMQ-based services. The model_client and policy_client should be created after starting their respective services in main.rs.
Sourcepub async fn get_metrics(&self) -> Value
pub async fn get_metrics(&self) -> Value
Get server metrics
Trait Implementations§
Source§impl Clone for ServerState
impl Clone for ServerState
Source§fn clone(&self) -> ServerState
fn clone(&self) -> ServerState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ServerState
impl !RefUnwindSafe for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl UnsafeUnpin for ServerState
impl !UnwindSafe for ServerState
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§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 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