Skip to main content

ServerState

Struct ServerState 

Source
pub struct ServerState { /* private fields */ }
Expand description

Cloneable shared state passed to all server transports.

Implementations§

Source§

impl ServerState

Source

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.

Source

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.

Source

pub fn from_parts( namespace_resolver: NamespaceResolver, runtime: RuntimeConfig, ) -> Self

Build shared state from explicit parts with a default worker registry.

Source

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.

Source

pub fn namespace_guard(&self) -> &NamespaceGuard

Borrow the namespace guard shared by all transports.

Source

pub fn deploy_guard(&self) -> DeployGuard

Build the deploy authorization guard over the shared resolver.

Source

pub fn runtime_config(&self) -> &RuntimeConfig

Borrow non-secret runtime settings needed by transports.

Source

pub fn worker_registry(&self) -> &ConnectedWorkerRegistry

Borrow the connected-worker registry shared by worker transports and dispatch.

Source

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).

Source

pub fn pending_activities(&self) -> &PendingActivities

Borrow the pending-activities tracker shared by the NIF bridge and worker stream handler.

Source

pub fn heartbeat_tracker(&self) -> &HeartbeatTracker

Borrow the heartbeat/liveness tracker shared by dispatch and worker streams.

Source

pub fn drain_state(&self) -> &DrainState

Borrow the drain gate shared by transports and worker dispatch.

Source

pub fn metrics(&self) -> Option<&Metrics>

Borrow the prometheus metrics handle when this state was built with a store.

Source

pub fn health(&self) -> Option<&HealthState>

Borrow health probe state when this state was built with a store.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> ServerState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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