Crate perspective_server
source ·Expand description
This crate contains the server/engine components of the
Perspective data visualization suite. It is
meant to be used in conjunction with the other crates of this project,
e.g. perspective-client to create client connections to a server.
The [perspective] crate provides a convenient frontend for Rust
developers, including both perspective_client and [perspective_server]
as well as other convenient integration helpers.
§Architecture
The basic dataflow of a Perspective applications looks something like this:
: Network or sync boundary
:
Client 1 : Session 1 Server
┏━━━━━━━━━━━━━━━━━━┓ : ┏━━━━━━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━━┓
┃ handle_response ┃<━━━┃ send_response ┃<━┳━━━━━━━━┃ send_response ┃
┃ send_request ┃━┳━>┃ handle_request ┃━━━━━┳━━━━>┃ handle_request ┃
┗━━━━━━━━━━━━━━━━━━┛ ┗━>┃ poll ┃━━━━━━━━┳━>┃ poll ┃
: ┃ session_id ┃ ┃ ┃ ┃ ┃ generate_id ┃
: ┗━━━━━━━━━━━━━━━━━━┛ ┃ ┃ ┃ ┃ cleanup_id ┃
: ┃ ┃ ┃ ┗━━━━━━━━━━━━━━━━━━┛
Client 2 : Session 2 ┃ ┃ ┃
┏━━━━━━━━━━━━━━━━━━┓ : ┏━━━━━━━━━━━━━━━━━━┓ ┃ ┃ ┃
┃ handle_response ┃<━━━┃ send_response ┃<━┛ ┃ ┃
┃ send_request ┃━┳━>┃ handle_request ┃━━━━━┛ ┃
┗━━━━━━━━━━━━━━━━━━┛ ┗━>┃ poll ┃━━━━━━━━┛
: ┃ session_id ┃
: ┗━━━━━━━━━━━━━━━━━━┛
§Feature Flags
The following feature flags are available to enable in your Cargo.toml:
external-cppSet this flag to configure this crate’s compile process to look for Perspective C++ source code in the environment rather than locally, e.g. for when you build this crate in-place in the Perspective repo source tree.
Structs§
- A struct for implementing
perspective_client::Sessionagainst an same-processServerinstance. See alsoperspective_client::ProxySessionfor implement the trait against an arbitrary remote transport. - An instance of a Perspective server. Each
Serverinstance is separate, and does not shareperspective_client::Table(or other) data with otherServers.
Traits§
- The server-side representation of a connection to a
Client. For eachClientthat wants to connect to aperspective_server::Server, a dedicatedSessionmust be created. TheSessionhandles routing messages emitted by theperspective_server::Serverve_server::Server, as well as owning any resources the [Client`] may request. - Use
SessionHandlerto implement a callback for messages emitted from aSession, to be passed to theServer::new_sessionconstructor. Alternatively, aSessioncan be created from a closure instead viaServer::new_session_with_callback.