pub struct Connection { /* private fields */ }Expand description
Live client handle to a server endpoint, evaluating expressions over a transport EvalSite.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn new(
address: ServerAddress,
default_codec: Symbol,
supported_codecs: Vec<Symbol>,
site: Arc<dyn EvalSite>,
) -> Result<Self>
pub fn new( address: ServerAddress, default_codec: Symbol, supported_codecs: Vec<Symbol>, site: Arc<dyn EvalSite>, ) -> Result<Self>
Opens a connection with default role and isolation policy.
Sourcepub fn with_session(
address: ServerAddress,
default_codec: Symbol,
supported_codecs: Vec<Symbol>,
site: Arc<dyn EvalSite>,
role: Option<Symbol>,
isolation: IsolationPolicy,
) -> Result<Self>
pub fn with_session( address: ServerAddress, default_codec: Symbol, supported_codecs: Vec<Symbol>, site: Arc<dyn EvalSite>, role: Option<Symbol>, isolation: IsolationPolicy, ) -> Result<Self>
Opens a connection with an explicit role and isolation policy, verifying the
address transport is available before constructing the initial session.
Sourcepub fn address(&self) -> &ServerAddress
pub fn address(&self) -> &ServerAddress
Returns the remote address this connection targets.
Sourcepub fn default_codec(&self) -> &Symbol
pub fn default_codec(&self) -> &Symbol
Returns the codec used by default for outbound frames.
Sourcepub fn supported_codecs(&self) -> &[Symbol]
pub fn supported_codecs(&self) -> &[Symbol]
Returns the codecs this connection is willing to negotiate.
Sourcepub fn session(&self) -> Session
pub fn session(&self) -> Session
Returns a snapshot of the current session, or a closed placeholder if the lock is poisoned.
Sourcepub fn role(&self) -> Option<&Symbol>
pub fn role(&self) -> Option<&Symbol>
Returns the role symbol attached to outbound frames, if any.
Sourcepub fn request(
&self,
cx: &mut Cx,
expr: Expr,
timeout: Option<Duration>,
required_capabilities: Vec<CapabilityName>,
) -> Result<Value>
pub fn request( &self, cx: &mut Cx, expr: Expr, timeout: Option<Duration>, required_capabilities: Vec<CapabilityName>, ) -> Result<Value>
Evaluates expr remotely and returns its result value, using the connection’s
default consistency.
Sourcepub fn send(
&self,
cx: &mut Cx,
expr: Expr,
codec: Symbol,
deadline: Option<Duration>,
required_capabilities: Vec<CapabilityName>,
reply_codec_hint: Option<Symbol>,
) -> Result<u64>
pub fn send( &self, cx: &mut Cx, expr: Expr, codec: Symbol, deadline: Option<Duration>, required_capabilities: Vec<CapabilityName>, reply_codec_hint: Option<Symbol>, ) -> Result<u64>
Sends expr as a request frame without awaiting a synchronous result, returning the
assigned message id for later correlation. Uses the connection’s default consistency.
Sourcepub fn notify(
&self,
cx: &mut Cx,
expr: Expr,
codec: Symbol,
deadline: Option<Duration>,
required_capabilities: Vec<CapabilityName>,
) -> Result<()>
pub fn notify( &self, cx: &mut Cx, expr: Expr, codec: Symbol, deadline: Option<Duration>, required_capabilities: Vec<CapabilityName>, ) -> Result<()>
Sends expr as a one-way notify frame, expecting no correlated reply.
Sourcepub fn receive(&self, _timeout: Option<Duration>) -> Result<Option<ServerFrame>>
pub fn receive(&self, _timeout: Option<Duration>) -> Result<Option<ServerFrame>>
Pops the next buffered inbound frame, if one is queued.
Returns Error::PoisonedLock when the router’s queue mutex is
poisoned, rather than panicking.
Trait Implementations§
Source§impl Clone for Connection
impl Clone for Connection
Source§fn clone(&self) -> Connection
fn clone(&self) -> Connection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl EvalFabric for Connection
impl EvalFabric for Connection
Source§impl Object for Connection
impl Object for Connection
Source§fn display(&self, _cx: &mut Cx) -> Result<String>
fn display(&self, _cx: &mut Cx) -> Result<String>
Source§fn header(&self) -> &ObjectHeader
fn header(&self) -> &ObjectHeader
Source§fn op(&self, _key: &OpKey) -> Option<&dyn Op>
fn op(&self, _key: &OpKey) -> Option<&dyn Op>
key, if any.