pub struct AppState { /* private fields */ }Expand description
Shared application state accessible from all handlers via Axum State extractor.
Holds:
- VastarRuntimeWorld for process registration and IPC
- ExchangeHeap for zero-copy SHM allocation
- VilMetrics for Prometheus metrics
- ProcessRegistry for handler process isolation
- HandlerMetricsRegistry for per-route auto-observability
Implementations§
Source§impl AppState
impl AppState
pub fn new(name: impl Into<String>) -> Self
Create AppState with a shared (SHM-backed) runtime. This enables cross-process zero-copy communication.
Sourcepub fn uptime_secs(&self) -> u64
pub fn uptime_secs(&self) -> u64
Get server uptime in seconds
Sourcepub fn metrics(&self) -> &VilMetrics
pub fn metrics(&self) -> &VilMetrics
Get VIL metrics collector
Sourcepub fn runtime(&self) -> &Arc<VastarRuntimeWorld>
pub fn runtime(&self) -> &Arc<VastarRuntimeWorld>
Get the VIL runtime
Sourcepub fn shm(&self) -> &Arc<ExchangeHeap>
pub fn shm(&self) -> &Arc<ExchangeHeap>
Get the SHM exchange heap
Sourcepub fn shm_pool(&self) -> &Arc<ShmPool>
pub fn shm_pool(&self) -> &Arc<ShmPool>
Get the pre-allocated SHM pool (for ShmSlice, high-performance path)
Sourcepub fn process_registry(&self) -> &Arc<ProcessRegistry>
pub fn process_registry(&self) -> &Arc<ProcessRegistry>
Get the process registry (handler → VIL process mapping)
Sourcepub fn handler_metrics(&self) -> &Arc<HandlerMetricsRegistry>
pub fn handler_metrics(&self) -> &Arc<HandlerMetricsRegistry>
Get per-handler metrics registry (zero-instrumentation observability)
Sourcepub fn capsule_registry(&self) -> &Arc<CapsuleRegistry>
pub fn capsule_registry(&self) -> &Arc<CapsuleRegistry>
Get WASM capsule handler registry
Sourcepub fn span_collector(&self) -> &Arc<SpanCollector>
pub fn span_collector(&self) -> &Arc<SpanCollector>
Get OpenTelemetry span collector
Sourcepub fn custom_metrics(&self) -> &Arc<CustomMetrics>
pub fn custom_metrics(&self) -> &Arc<CustomMetrics>
Get custom metrics registry
Sourcepub fn error_tracker(&self) -> &Arc<ErrorTracker>
pub fn error_tracker(&self) -> &Arc<ErrorTracker>
Get error tracker
Sourcepub fn profiler(&self) -> &Arc<ServerProfiler>
pub fn profiler(&self) -> &Arc<ServerProfiler>
Get server profiler
Sourcepub fn config_reloader(&self) -> &Arc<ConfigReloader>
pub fn config_reloader(&self) -> &Arc<ConfigReloader>
Get config reloader
Sourcepub fn plugin_manager(&self) -> &Arc<PluginManager>
pub fn plugin_manager(&self) -> &Arc<PluginManager>
Get plugin manager
Sourcepub fn upstream_registry(&self) -> &Arc<UpstreamRegistry>
pub fn upstream_registry(&self) -> &Arc<UpstreamRegistry>
Get upstream metrics registry
Sourcepub fn request_start(&self)
pub fn request_start(&self)
Record request start for metrics
Sourcepub fn request_end(&self, duration_ms: u64)
pub fn request_end(&self, duration_ms: u64)
Record request end with duration for metrics
Sourcepub fn upstream_error(&self)
pub fn upstream_error(&self)
Record an upstream error
Sourcepub fn route_error(&self)
pub fn route_error(&self)
Record a route error
Sourcepub fn sync_metrics(&self)
pub fn sync_metrics(&self)
Sync metrics from runtime counters (for /metrics endpoint)