Struct Server
pub struct Server {
pub limits: ServerLimits,
/* private fields */
}Fields§
§limits: ServerLimitsStep limits; permits are leases.
Implementations§
§impl Server
impl Server
pub fn new(cfg: ServerConfig) -> Result<Arc<Self>>
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>>
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> ⓘ
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<()>
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<()>
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<()>
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>
Whether this server keeps one log for every shard (log format 3).
pub fn set_invokers(self: &Arc<Self>, endpoints: Vec<Endpoint>) -> Result<()>
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>
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)
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,
)
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.