Struct opcua_server::server::Server
source · pub struct Server {
pub certificate_store: Arc<RwLock<CertificateStore>>,
pub server_metrics: Arc<RwLock<ServerMetrics>>,
pub server_state: Arc<RwLock<ServerState>>,
pub address_space: Arc<RwLock<AddressSpace>>,
pub connections: Arc<RwLock<Connections>>,
/* private fields */
}Expand description
This represents a running instance of an OPC UA server. There can be more than one server running at a time providing they do not share the same thread or listen on the same ports.
A Server is initialised from a ServerConfig which determines what port the server
runs on, the endpoints it supports, the identity tokens it supports and so forth.
The server’s AddressSpace is initialised with the default address space values, but may also
be extended with additional nodes representing folders, variables, methods etc.
The server’s CertificateStore manages the server’s private key and public certificate. It
also manages public certificates of incoming clients and arranges them into trusted and rejected
collections.
Fields§
§certificate_store: Arc<RwLock<CertificateStore>>Certificate store for certs
server_metrics: Arc<RwLock<ServerMetrics>>Server metrics - diagnostics and anything else that someone might be interested in that describes the current state of the server
server_state: Arc<RwLock<ServerState>>The server state is everything that sessions share that can possibly change. State
is initialised from a ServerConfig.
address_space: Arc<RwLock<AddressSpace>>Address space
connections: Arc<RwLock<Connections>>List of open connections
Implementations§
source§impl Server
impl Server
sourcepub fn new(config: ServerConfig) -> Server
pub fn new(config: ServerConfig) -> Server
Creates a new Server instance, initialising it from a ServerConfig.
sourcepub fn run(self)
pub fn run(self)
Runs the server which blocks until it completes either by aborting or by error. Typically a server should be run on its own thread.
sourcepub fn run_server(server: Arc<RwLock<Server>>)
pub fn run_server(server: Arc<RwLock<Server>>)
Runs the supplied server reference counted server. The function will block until the server terminates, i.e. all running tokio tasks finish.
pub fn abort(&mut self)
sourcepub fn add_polling_action<F>(&mut self, interval_ms: u32, action: F)where
F: Fn() + Send + Sync + 'static,
pub fn add_polling_action<F>(&mut self, interval_ms: u32, action: F)where
F: Fn() + Send + Sync + 'static,
Creates a polling action that happens continuously on an interval while the server is running.