pub struct GrpcTransport {
endpoint: String,
channel: Arc<RwLock<Option<Channel>>>,
config: TransportConfig,
connected: Arc<RwLock<bool>>,
stats: Arc<RwLock<TransportStats>>,
}Expand description
gRPC transport for communication with Mountain and other gRPC services
Fields§
§endpoint: StringConnection endpoint
channel: Arc<RwLock<Option<Channel>>>gRPC channel
config: TransportConfigTransport configuration
connected: Arc<RwLock<bool>>Connection state
stats: Arc<RwLock<TransportStats>>Transport statistics
Implementations§
Source§impl GrpcTransport
impl GrpcTransport
Sourcepub fn with_config(address: &str, config: TransportConfig) -> Result<Self>
pub fn with_config(address: &str, config: TransportConfig) -> Result<Self>
Create a new gRPC transport with custom configuration
Sourcepub async fn stats(&self) -> TransportStats
pub async fn stats(&self) -> TransportStats
Get transport statistics
Sourcefn build_endpoint(&self) -> Result<Endpoint>
fn build_endpoint(&self) -> Result<Endpoint>
Build an endpoint from the address string
Trait Implementations§
Source§impl Clone for GrpcTransport
impl Clone for GrpcTransport
Source§fn clone(&self) -> GrpcTransport
fn clone(&self) -> GrpcTransport
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GrpcTransport
impl Debug for GrpcTransport
Source§impl TransportStrategy for GrpcTransport
impl TransportStrategy for GrpcTransport
Source§type Error = GrpcTransportError
type Error = GrpcTransportError
Error type for this transport
Source§fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connect to the transport endpoint
Source§fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a request and receive a response
Source§fn send_no_response<'life0, 'life1, 'async_trait>(
&'life0 self,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_no_response<'life0, 'life1, 'async_trait>(
&'life0 self,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send data without expecting a response (fire and forget)
Source§fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close the transport connection
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if the transport is connected
Source§fn transport_type(&self) -> TransportType
fn transport_type(&self) -> TransportType
Get the transport type identifier
Auto Trait Implementations§
impl Freeze for GrpcTransport
impl !RefUnwindSafe for GrpcTransport
impl Send for GrpcTransport
impl Sync for GrpcTransport
impl Unpin for GrpcTransport
impl !UnwindSafe for GrpcTransport
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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