pub struct SpineConnectionImpl {
config: Arc<RwLock<ProtocolConfig>>,
state: Arc<RwLock<ConnectionState>>,
heartbeat_config: HeartbeatConfig,
last_heartbeat: Arc<RwLock<DateTime<Utc>>>,
metrics: Arc<RwLock<ConnectionMetrics>>,
}
Expand description
Spine connection implementation
Fields§
§config:
Arc<RwLock<ProtocolConfig>>
Protocol configuration
state:
Arc<RwLock<ConnectionState>>
Current connection state
heartbeat_config:
HeartbeatConfig
Heartbeat configuration
last_heartbeat:
Arc<RwLock<DateTime<Utc>>>
Timestamp of the last heartbeat
metrics:
Arc<RwLock<ConnectionMetrics>>
Connection metrics
Implementations§
Source§
impl
SpineConnectionImpl
impl SpineConnectionImpl
Source
pub fn
new(config:
ProtocolConfig) -> Self
pub fn new(config: ProtocolConfig) -> Self
Source
pub async fn
Disconnect(&mut self) ->
Result<()>
pub async fn Disconnect(&mut self) -> Result<()>
Disconnect from the Spine service
Source
pub async fn
GetState(&self) ->
ConnectionState
pub async fn GetState(&self) -> ConnectionState
Get the current connection state
Source
pub async fn
SendRequest( &self, method: &str, _payload:
Vec<u8>, ) ->
Result<Vec<u8>>
pub async fn SendRequest( &self, method: &str, _payload: Vec<u8>, ) -> Result<Vec<u8>>
Send a request to the Spine service
§Arguments
-
method- The method name to call -
payload- The request payload
Source
pub async fn
GetMetrics(&self) ->
ConnectionMetrics
pub async fn GetMetrics(&self) -> ConnectionMetrics
Get the connection metrics
Source
pub fn
SetHeartbeatConfig(&mut self, config:
HeartbeatConfig)
pub fn SetHeartbeatConfig(&mut self, config: HeartbeatConfig)
Set the heartbeat configuration
Auto Trait Implementations§
impl Freeze for SpineConnectionImpl
impl !RefUnwindSafe for SpineConnectionImpl
impl Send for SpineConnectionImpl
impl Sync for SpineConnectionImpl
impl Unpin for SpineConnectionImpl
impl UnsafeUnpin for SpineConnectionImpl
impl !UnwindSafe for SpineConnectionImpl
Blanket Implementations§
Source§
impl<T>
BorrowMut<T> for T
where T: ?Sized,
impl<T>
BorrowMut<T> for T
where T: ?Sized,
Source§
fn
borrow_mut(&mut self) ->
&mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value.
Read more
§
impl<T> Instrument for T
impl<T> Instrument for T
§
fn
instrument(self, span: Span) ->
Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§
fn
in_current_span(self) ->
Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§
impl<T>
IntoEither
for T
impl<T> IntoEither for T
Source§
fn
into_either(self, into_left:
bool) ->
Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a
Left
variant of
Either<Self, Self>
if into_left is
true. Converts
self into a
Right
variant of
Either<Self, Self>
otherwise.
Read more
Source§
fn
into_either_with<F>(self, into_left: F)
->
Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a
Left
variant of
Either<Self, Self>
if
into_left(&self)
returns true. Converts
self into a
Right
variant of
Either<Self, Self>
otherwise.
Read more
Source§
impl<T>
IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§
fn
into_request(self) ->
Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in
a tonic::Request