Skip to main content

ConnectionSupervisor

Struct ConnectionSupervisor 

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

Supervisor that owns the beamr scheduler for per-connection processes.

Implementations§

Source§

impl ConnectionSupervisor

Source

pub fn from_config(config: &ServerConfig) -> Result<Self, ServerError>

Creates a connection supervisor backed by the configured liminal channels.

§Errors

Returns ServerError when channel initialization or scheduler startup fails.

Source

pub fn new() -> Result<Self, ServerError>

Creates a connection supervisor with no configured channels.

§Errors

Returns ServerError when scheduler startup fails.

Source

pub fn with_services( services: Arc<dyn ConnectionServices>, ) -> Result<Self, ServerError>

Creates a connection supervisor using an explicit service adapter.

§Errors

Returns ServerError when scheduler startup fails.

Source

pub fn with_services_and_notifier( services: Arc<dyn ConnectionServices>, notifier: Arc<dyn ConnectionNotifier>, ) -> Result<Self, ServerError>

Creates a connection supervisor with an explicit service adapter and a connection-keyed worker-registration notifier.

The notifier is invoked when a worker registers on a connection and when such a connection closes. Supervisors built via Self::with_services, Self::from_config, or Self::new carry no notifier, so liminal still runs standalone; a WorkerRegister frame is then accepted without any application callback.

§Errors

Returns ServerError when scheduler startup fails.

Source

pub fn spawn_connection( &self, stream: TcpStream, ) -> Result<ConnectionHandle, ServerError>

Spawns one supervised beamr process that owns stream.

§Errors

Returns ServerError when stream configuration or beamr spawn fails.

Source

pub fn scheduler(&self) -> Arc<Scheduler>

Returns the underlying beamr scheduler.

Source

pub fn reap_crashed_connections(&self) -> usize

Reaps connection processes that have exited outside the normal handler path.

Source

pub fn is_tracked(&self, pid: u64) -> bool

Returns true when pid is still tracked by the supervisor.

Source

pub fn active_connection_count(&self) -> usize

Returns the number of tracked live connections.

Source

pub fn active_connection_pids(&self) -> Vec<u64>

Returns the beamr process ids of the currently tracked live connections.

Useful for addressing a specific connection — e.g. as the pid argument to push_to_connection when the caller knows there is a single connected client.

Source

pub fn notify_shutdown_subscribers(&self)

Broadcasts a best-effort shutdown notification to active connections.

Connections with no active subscriptions ignore the notification. Failures to enqueue the control message are logged and skipped; they are not retried.

Source

pub fn force_close_active_connections(&self)

Sends a force-close control message to every tracked connection process.

Each live process attempts one shutdown notification before closing its stream and exiting normally. Enqueue failures are logged and skipped.

Source

pub fn push_to_connection( &self, pid: u64, payload: Vec<u8>, ) -> Result<PushReplyAwaiter, ServerError>

Pushes an opaque payload to a specific connected client over that client’s existing connection and returns an awaiter for the client’s correlated reply.

This is the server-initiated leg (server-to-client), the inverse of every other request frame. It allocates a correlation id, registers a one-shot reply slot keyed by that id, and enqueues a [ConnectionControl::Push] for the connection process owning pid; that process writes a [Frame::Push] out on its socket. When the client answers with a PushReply carrying the same correlation id, the connection process resolves the awaiter’s slot. The returned PushReplyAwaiter blocks (bounded) for that reply.

§Errors

Returns ServerError when the correlation id cannot be allocated, the reply slot cannot be registered, or the control message cannot be enqueued for the (possibly already-gone) connection process.

Source

pub fn flush_durable_state(&self) -> Result<(), ServerError>

Flushes durable channel state through the configured liminal services.

§Errors

Returns ServerError::ShutdownFlush when the underlying service flush fails.

Source

pub fn shutdown(&self)

Stops the beamr scheduler used by connection processes.

Trait Implementations§

Source§

impl Clone for ConnectionSupervisor

Source§

fn clone(&self) -> ConnectionSupervisor

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

impl Debug for ConnectionSupervisor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> 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> 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> 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<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