pub struct LinksServer { /* private fields */ }Expand description
A bound, not yet serving, LiNo server.
Implementations§
Source§impl LinksServer
impl LinksServer
Sourcepub fn bind(
address: impl ToSocketAddrs,
options: ServerOptions,
) -> ProtocolResult<Self>
pub fn bind( address: impl ToSocketAddrs, options: ServerOptions, ) -> ProtocolResult<Self>
Binds to the TCP address (use port 0 for an ephemeral port).
Sourcepub fn listen(endpoint: &str, options: ServerOptions) -> ProtocolResult<Self>
pub fn listen(endpoint: &str, options: ServerOptions) -> ProtocolResult<Self>
Listens on an IPC endpoint such as 127.0.0.1:0,
unix:/tmp/links.sock, pipe:links or shm:/tmp/links.
Sourcepub fn listen_all<S: AsRef<str>>(
endpoints: &[S],
options: ServerOptions,
) -> ProtocolResult<Self>
pub fn listen_all<S: AsRef<str>>( endpoints: &[S], options: ServerOptions, ) -> ProtocolResult<Self>
Listens on every endpoint at once; clients of all of them share the store and see each other’s changes.
Sourcepub fn from_listener(
listener: Box<dyn Listener>,
options: ServerOptions,
) -> Self
pub fn from_listener( listener: Box<dyn Listener>, options: ServerOptions, ) -> Self
Serves the connections of any Listener, such as a custom
transport registered with ipc::register.
Sourcepub fn with_readable(
self,
readable: impl Fn(&Link) -> bool + Send + 'static,
) -> Self
pub fn with_readable( self, readable: impl Fn(&Link) -> bool + Send + 'static, ) -> Self
Lets subscribers see only the links readable accepts; without it,
every subscriber sees every link.
A side of a change the subscriber may not read is left out of its push,
so a link that becomes unreadable arrives as a deletion and one that
becomes readable as a creation. This is where a permission layer plugs in.
On a server in triplet mode readable judges the outer doublet of a
triplet, as (index: type index).
Sourcepub fn local_addr(&self) -> ProtocolResult<SocketAddr>
pub fn local_addr(&self) -> ProtocolResult<SocketAddr>
The TCP address the server listens on; an error for a server that listens on no TCP endpoint.
Sourcepub fn endpoints(&self) -> Vec<String>
pub fn endpoints(&self) -> Vec<String>
Every endpoint the server listens on, in the order given.
Sourcepub fn shutdown_handle(&self) -> ProtocolResult<ShutdownHandle>
pub fn shutdown_handle(&self) -> ProtocolResult<ShutdownHandle>
A handle that stops serve.
Sourcepub fn serve<S: NamedTypeLinks>(self, storage: &mut S) -> ProtocolResult<()>
pub fn serve<S: NamedTypeLinks>(self, storage: &mut S) -> ProtocolResult<()>
Serves storage until a ShutdownHandle stops the server; every
connection sees and changes the whole store.
Sourcepub fn serve_for<T: QueryAddress, S: NamedTypeLinks<T>>(
self,
storage: &mut S,
) -> ProtocolResult<()>
pub fn serve_for<T: QueryAddress, S: NamedTypeLinks<T>>( self, storage: &mut S, ) -> ProtocolResult<()>
Serves the selected address type through the same request path. Checked adapters may use a wider marker to retain their full stored range.
Sourcepub fn serve_sessions<S: NamedTypeLinks, P: AccessPolicy>(
self,
sessions: &mut LinksSessions<S, P>,
) -> ProtocolResult<()>
pub fn serve_sessions<S: NamedTypeLinks, P: AccessPolicy>( self, sessions: &mut LinksSessions<S, P>, ) -> ProtocolResult<()>
Serves sessions until a ShutdownHandle stops the server: every
connection is a session of its own, opened with the default subject
of sessions and closed when the connection closes (issue #149).