pub struct ServerState { /* private fields */ }Expand description
Cloneable shared state passed to all server transports.
Implementations§
Source§impl ServerState
impl ServerState
Sourcepub async fn build(config: ServerConfig) -> Result<Self, ServerError>
pub async fn build(config: ServerConfig) -> Result<Self, ServerError>
Build shared state from operator configuration.
§Errors
Returns ServerError if the store cannot connect or the engine cannot
be constructed.
Sourcepub async fn build_with_store<S>(
store: S,
runtime: RuntimeConfig,
) -> Result<Self, ServerError>where
S: EventStore,
pub async fn build_with_store<S>(
store: S,
runtime: RuntimeConfig,
) -> Result<Self, ServerError>where
S: EventStore,
Build shared state from an already-constructed store.
§Errors
Returns ServerError::EngineCall if the engine cannot be constructed.
Sourcepub fn from_parts(
namespace_resolver: NamespaceResolver,
runtime: RuntimeConfig,
) -> Self
pub fn from_parts( namespace_resolver: NamespaceResolver, runtime: RuntimeConfig, ) -> Self
Build shared state from explicit parts with a default worker registry.
Sourcepub fn from_parts_with_registry(
namespace_resolver: NamespaceResolver,
runtime: RuntimeConfig,
worker_registry: ConnectedWorkerRegistry,
) -> Self
pub fn from_parts_with_registry( namespace_resolver: NamespaceResolver, runtime: RuntimeConfig, worker_registry: ConnectedWorkerRegistry, ) -> Self
Build shared state from explicit parts with a caller-supplied registry.
Sourcepub fn namespace_guard(&self) -> &NamespaceGuard
pub fn namespace_guard(&self) -> &NamespaceGuard
Borrow the namespace guard shared by all transports.
Sourcepub fn deploy_guard(&self) -> DeployGuard
pub fn deploy_guard(&self) -> DeployGuard
Build the deploy authorization guard over the shared resolver.
Sourcepub fn runtime_config(&self) -> &RuntimeConfig
pub fn runtime_config(&self) -> &RuntimeConfig
Borrow non-secret runtime settings needed by transports.
Sourcepub fn worker_registry(&self) -> &ConnectedWorkerRegistry
pub fn worker_registry(&self) -> &ConnectedWorkerRegistry
Borrow the connected-worker registry shared by worker transports and dispatch.
Sourcepub fn engine(&self) -> Result<Arc<Engine>, ServerError>
pub fn engine(&self) -> Result<Arc<Engine>, ServerError>
Clone the live engine handle the completion path records terminals through.
This is the SAME Arc<Engine> the gRPC completion callback is built over
(state.rs installs ServerOutboxDeliveryCallback::new(engine) on the
pending tracker when outbox.enabled), so the liminal completion path
re-enters worker results through the identical record_fan_out_completion
seam rather than inventing a second one.
§Errors
Returns ServerError when the namespace resolver has no engine handle
(a state built from parts without an engine).
Sourcepub fn pending_activities(&self) -> &PendingActivities
pub fn pending_activities(&self) -> &PendingActivities
Borrow the pending-activities tracker shared by the NIF bridge and worker stream handler.
Sourcepub fn heartbeat_tracker(&self) -> &HeartbeatTracker
pub fn heartbeat_tracker(&self) -> &HeartbeatTracker
Borrow the heartbeat/liveness tracker shared by dispatch and worker streams.
Sourcepub fn drain_state(&self) -> &DrainState
pub fn drain_state(&self) -> &DrainState
Borrow the drain gate shared by transports and worker dispatch.
Sourcepub fn metrics(&self) -> Option<&Metrics>
pub fn metrics(&self) -> Option<&Metrics>
Borrow the prometheus metrics handle when this state was built with a store.
Sourcepub fn health(&self) -> Option<&HealthState>
pub fn health(&self) -> Option<&HealthState>
Borrow health probe state when this state was built with a store.
Sourcepub fn activity_mock_registry(&self) -> Option<&ActivityMockRegistry>
pub fn activity_mock_registry(&self) -> Option<&ActivityMockRegistry>
Borrow the shared per-run activity-mock registry when the dev surface is
commissioned. Returns None on a server with the dev surface dark, so
the dev handlers refuse cleanly rather than mocking on a production
server.
Sourcepub fn outbox_store(&self) -> Option<Arc<dyn OutboxStore>>
pub fn outbox_store(&self) -> Option<Arc<dyn OutboxStore>>
Borrow the outbox store the dispatcher claims rows from, when the durable
(libSQL) backend is in use. This is the SAME leaf Arc<LibSqlStore> the
engine writes through, so the dispatcher shares its single
libsql::Connection rather than opening a second contending one. Returns
None for the in-memory backend, which has no outbox table.
Sourcepub fn outbox_wake(&self) -> Arc<Notify>
pub fn outbox_wake(&self) -> Arc<Notify>
Clone the advisory outbox wake (LSUB-2) shared with the engine’s stage seam. The outbox dispatcher installs this handle so a committed fan-out row wakes its run loop in ~RTT rather than waiting for the next poll tick. The handle is always present; it is simply never pulsed when the outbox is not commissioned, so wiring it is free and behaviour is unchanged.
Sourcepub fn shutdown(&self) -> Result<(), ServerError>
pub fn shutdown(&self) -> Result<(), ServerError>
Shut down the embedded engine so in-flight durable appends can finish.
§Errors
Returns ServerError if the namespace resolver has no engine handle or the engine rejects
shutdown.
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 !RefUnwindSafe for ServerState
impl !UnwindSafe for ServerState
impl Freeze for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl UnsafeUnpin for ServerState
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> 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::RequestSource§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