Skip to main content

ServerState

Struct ServerState 

Source
pub struct ServerState {
Show 72 fields pub config: ServerConfig, pub daemons: HashMap<String, DaemonInfo>, pub metrics: ServerMetrics, pub started_at: Instant, pub deploy_count: u64, pub event_bus: EventBus, pub supervisor: DaemonSupervisor, pub versions: VersionRegistry, pub dynamic_routes: HashMap<(String, String), DynamicEndpointRoute>, pub dynamic_types: HashMap<String, TypeSchema>, pub idempotency_store: IdempotencyStore, pub axonendpoint_replay: AxonendpointReplayLog, pub session: SessionStore, pub scoped_sessions: ScopedSessionManager, pub rate_limiter: RateLimiter, pub tenant_rate_limiter: TenantRateLimiter, pub request_logger: RequestLogger, pub api_keys: ApiKeyManager, pub webhooks: WebhookRegistry, pub delivery_config: DeliveryConfig, pub cors_config: CorsConfig, pub middleware_config: MiddlewareConfig, pub request_id_gen: RequestIdGenerator, pub audit_log: AuditLog, pub trace_store: TraceStore, pub schedules: HashMap<String, ScheduleEntry>, pub config_snapshots: Vec<NamedConfigSnapshot>, pub execution_queue: Vec<QueuedExecution>, pub execution_queue_next_id: u64, pub cost_pricing: CostPricing, pub cost_budgets: HashMap<String, CostBudget>, pub flow_rules: HashMap<String, FlowValidationRules>, pub flow_quotas: HashMap<String, FlowQuota>, pub readiness_gates: ReadinessGates, pub autoscale_config: AutoscaleConfig, pub auto_persist_on_shutdown: bool, pub flow_tags: HashMap<String, Vec<String>>, pub flow_slas: HashMap<String, FlowSLA>, pub canary_configs: HashMap<String, CanaryConfig>, pub alert_rules: Vec<AlertRule>, pub fired_alerts: Vec<FiredAlert>, pub alert_silences: Vec<AlertSilence>, pub health_history: Vec<HealthTransition>, pub endpoint_rate_limits: HashMap<String, EndpointRateLimit>, pub execution_cache: Vec<CachedResult>, pub backend_registry: HashMap<String, BackendRegistryEntry>, pub axon_stores: HashMap<String, AxonStoreInstance>, pub dataspaces: HashMap<String, DataspaceInstance>, pub shields: HashMap<String, ShieldInstance>, pub corpora: HashMap<String, CorpusInstance>, pub mandates: HashMap<String, MandatePolicy>, pub refine_sessions: HashMap<String, RefineSession>, pub trails: HashMap<String, TrailRecord>, pub probes: HashMap<String, ProbeSession>, pub weaves: HashMap<String, WeaveSession>, pub corroborations: HashMap<String, CorroborateSession>, pub drills: HashMap<String, DrillSession>, pub forges: HashMap<String, ForgeSession>, pub deliberations: HashMap<String, DeliberateSession>, pub consensus_sessions: HashMap<String, ConsensusSession>, pub hibernations: HashMap<String, HibernateSession>, pub ots_secrets: HashMap<String, OtsSecret>, pub psyche_sessions: HashMap<String, PsycheSession>, pub axon_endpoints: HashMap<String, EndpointBinding>, pub endpoint_calls: Vec<EndpointCallRecord>, pub pix_sessions: HashMap<String, PixSession>, pub backend_health_probes: HashMap<String, BackendHealthProbe>, pub backend_health_history: HashMap<String, Vec<HealthCheckRecord>>, pub shutdown: Option<Arc<ShutdownCoordinator>>, pub storage: Arc<StorageDispatcher>, pub resilient_backend: Arc<ResilientBackend>, pub tenant_secrets: Arc<TenantSecretsClient>,
}
Expand description

Shared server state, wrapped in Arc<Mutex<>> for thread safety.

Fields§

§config: ServerConfig§daemons: HashMap<String, DaemonInfo>§metrics: ServerMetrics§started_at: Instant§deploy_count: u64§event_bus: EventBus§supervisor: DaemonSupervisor§versions: VersionRegistry§dynamic_routes: HashMap<(String, String), DynamicEndpointRoute>

§Fase 32.b — Dynamic HTTP routes registered from axonendpoint declarations at deploy time (D1, D11). Key is (method_uppercase, path); value carries the metadata needed for request-time dispatch (flow name + transport + keepalive + source file for the negotiation classifier).

Populated by register_axonendpoint_routes after every successful /v1/deploy. Path conflicts detected at deploy time per D2 (deploy fails with 409 when the same (method, path) tuple is already owned by a different (flow_name, source_file) pair). Re-deploying the same flow updates its routes in place.

Cross-stack contract (D11): the Python AxonServer mirrors this state via FastAPI route registration; both stacks produce byte-identical route sets from the same source.

§dynamic_types: HashMap<String, TypeSchema>

§Fase 32.c — Per-name type T { … } snapshot consulted by the dynamic-route fallback handler at request time to validate the HTTP request body against the axonendpoint’s declared body: T. Populated alongside dynamic_routes at every successful /v1/deploy. Last-wins on cross-deploy type name collision (a known limitation of the 32.c surface; a future type-registry fase will add deploy-scoped namespacing).

§idempotency_store: IdempotencyStore

§Fase 32.f — Idempotency-Key store for POST/PUT axonendpoint routes. Stripe-compatible. Indexed by (client_id, endpoint_path, idempotency_key). Cross-tenant isolation is a property of the composite key — two adopters cannot collide. Default 24h retention; eviction is lazy on lookup with a reap_expired helper available for periodic background sweeps.

§axonendpoint_replay: AxonendpointReplayLog

§Fase 32.h — Axonendpoint replay log. Append-only, keyed by trace_id. Populated on every successful 2xx response when the route’s replay_enabled is true. Consulted by GET /v1/replay/<trace_id> for regulatory audit.

§session: SessionStore§scoped_sessions: ScopedSessionManager§rate_limiter: RateLimiter§tenant_rate_limiter: TenantRateLimiter

Per-tenant request-rate + daily token quota enforcement (M4).

§request_logger: RequestLogger§api_keys: ApiKeyManager§webhooks: WebhookRegistry§delivery_config: DeliveryConfig§cors_config: CorsConfig§middleware_config: MiddlewareConfig§request_id_gen: RequestIdGenerator§audit_log: AuditLog§trace_store: TraceStore§schedules: HashMap<String, ScheduleEntry>§config_snapshots: Vec<NamedConfigSnapshot>§execution_queue: Vec<QueuedExecution>§execution_queue_next_id: u64§cost_pricing: CostPricing§cost_budgets: HashMap<String, CostBudget>§flow_rules: HashMap<String, FlowValidationRules>§flow_quotas: HashMap<String, FlowQuota>§readiness_gates: ReadinessGates§autoscale_config: AutoscaleConfig§auto_persist_on_shutdown: bool§flow_tags: HashMap<String, Vec<String>>§flow_slas: HashMap<String, FlowSLA>§canary_configs: HashMap<String, CanaryConfig>§alert_rules: Vec<AlertRule>§fired_alerts: Vec<FiredAlert>§alert_silences: Vec<AlertSilence>§health_history: Vec<HealthTransition>§endpoint_rate_limits: HashMap<String, EndpointRateLimit>§execution_cache: Vec<CachedResult>§backend_registry: HashMap<String, BackendRegistryEntry>§axon_stores: HashMap<String, AxonStoreInstance>§dataspaces: HashMap<String, DataspaceInstance>§shields: HashMap<String, ShieldInstance>§corpora: HashMap<String, CorpusInstance>§mandates: HashMap<String, MandatePolicy>§refine_sessions: HashMap<String, RefineSession>§trails: HashMap<String, TrailRecord>§probes: HashMap<String, ProbeSession>§weaves: HashMap<String, WeaveSession>§corroborations: HashMap<String, CorroborateSession>§drills: HashMap<String, DrillSession>§forges: HashMap<String, ForgeSession>§deliberations: HashMap<String, DeliberateSession>§consensus_sessions: HashMap<String, ConsensusSession>§hibernations: HashMap<String, HibernateSession>§ots_secrets: HashMap<String, OtsSecret>§psyche_sessions: HashMap<String, PsycheSession>§axon_endpoints: HashMap<String, EndpointBinding>§endpoint_calls: Vec<EndpointCallRecord>§pix_sessions: HashMap<String, PixSession>§backend_health_probes: HashMap<String, BackendHealthProbe>§backend_health_history: HashMap<String, Vec<HealthCheckRecord>>§shutdown: Option<Arc<ShutdownCoordinator>>§storage: Arc<StorageDispatcher>

Persistent storage backend (PostgreSQL or InMemory).

§resilient_backend: Arc<ResilientBackend>

Resilient backend for LLM calls with retry, circuit breaker, and fallback.

§tenant_secrets: Arc<TenantSecretsClient>

Per-tenant API key resolver (AWS Secrets Manager + in-memory cache).

Implementations§

Source§

impl ServerState

Source

pub fn new(config: ServerConfig) -> Self

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more