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: HeartbeatConfigHeartbeat configuration
last_heartbeat: Arc<RwLock<DateTime<Utc>>>Timestamp of the last heartbeat
metrics: Arc<RwLock<ConnectionMetrics>>Connection metrics
Implementations§
Source§impl SpineConnectionImpl
impl SpineConnectionImpl
Sourcepub fn new(config: ProtocolConfig) -> Self
pub fn new(config: ProtocolConfig) -> Self
Sourcepub async fn Disconnect(&mut self) -> Result<()>
pub async fn Disconnect(&mut self) -> Result<()>
Disconnect from the Spine service
Sourcepub async fn GetState(&self) -> ConnectionState
pub async fn GetState(&self) -> ConnectionState
Get the current connection state
Sourcepub 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 callpayload- The request payload
Sourcepub async fn GetMetrics(&self) -> ConnectionMetrics
pub async fn GetMetrics(&self) -> ConnectionMetrics
Get the connection metrics
Sourcepub 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 !UnwindSafe for SpineConnectionImpl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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 moreSource§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 moreSource§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