Skip to main content

Server

Struct Server 

pub struct Server {
    pub limits: ServerLimits,
    /* private fields */
}

Fields§

§limits: ServerLimits

Step limits; permits are leases.

Implementations§

§

impl Server

pub fn new(cfg: ServerConfig) -> Result<Arc<Self>>

Opens (or creates) a server directory. New directories keep one log for every shard (log format 3); directories created before it keep a log per shard (format 2) and open as they are.

pub fn open(cfg: ServerConfig, shared_log: bool) -> Result<Arc<Self>>

Like new; shared_log: false creates a new directory with a log per shard (log format 2), as servers before the shared log did. Existing directories keep their format either way.

pub fn replicated(node: &ReplicaNode) -> Arc<Self>

Serve a single-shard replication group. Only its ready primary serves connections. A replacement worker claims a fresh quorum-ordered session. Workers connect without TLS or a token until set_security.

pub fn set_security(&self, security: &Security) -> Result<()>

Sets TLS and the token for worker and client connections accepted after this call.

pub fn set_security_scoped( &self, security: &Security, scoped: Vec<(Token, Scope)>, ) -> Result<()>

set_security with tokens of less reach than the worker’s Security::token: a Scope::Client token makes calls and holds no shard, a Scope::Read token makes calls that only read. Connections made after the call use the new settings (call it again to reload them, on SIGHUP); open ones keep theirs.

pub fn set_liveness(&self, liveness: Option<Liveness>) -> Result<()>

Sets the lease liveness rule for leases granted after this call. None keeps a silent worker’s lease until its connection closes.

pub fn liveness(&self) -> Option<Liveness>

pub fn shared_log(&self) -> bool

Whether this server keeps one log for every shard (log format 3).

pub fn set_invokers(self: &Arc<Self>, endpoints: Vec<Endpoint>) -> Result<()>

Invokes workers at endpoints for shards that have work and no holder (crate::invoke). Every shard is due once now: what each has left is known only to a worker that held it. Call it once, on the runtime that serves connections.

pub fn invocation_metrics(&self) -> Option<InvokeMetrics>

The invoker’s counters, if it has endpoints.

pub async fn serve_conn<S: Socket>(self: Arc<Self>, stream: S)

Serves one connection until it closes.

pub async fn serve_conn_scoped<S: Socket>( self: Arc<Self>, stream: S, scope: Scope, )

Serves one connection whose token has scope: checked at its first frame (a worker’s hello or a client’s), never per frame after.

Auto Trait Implementations§

§

impl !Freeze for Server

§

impl !RefUnwindSafe for Server

§

impl Send for Server

§

impl Sync for Server

§

impl Unpin for Server

§

impl UnsafeUnpin for Server

§

impl !UnwindSafe for Server

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