pub struct gRPCTransport {
Endpoint: String,
Channel: Arc<RwLock<Option<Channel>>>,
Configuration: TransportConfig,
Connected: Arc<RwLock<bool>>,
Statistics: Arc<RwLock<TransportStats>>,
}
Expand description
gRPC transport for communication with Mountain and other gRPC services.
Fields§
§Endpoint:
String
Connection endpoint address.
Channel:
Arc<RwLock<Option<Channel>>>
gRPC channel (lazily connected).
Configuration:
TransportConfig
Transport configuration.
Connected:
Arc<RwLock<bool>>
Whether the transport is currently connected.
Statistics:
Arc<RwLock<TransportStats>>
Transport statistics.
Implementations§
Source§
impl
gRPCTransport
impl gRPCTransport
Source
pub fn
New(Address: &str) ->
Result<Self>
pub fn New(Address: &str) -> Result<Self>
Creates a new gRPC transport with the given address.
Source
pub fn
WithConfiguration( Address: &str, Configuration:
TransportConfig, ) ->
Result<Self>
pub fn WithConfiguration( Address: &str, Configuration: TransportConfig, ) -> Result<Self>
Creates a new gRPC transport with custom configuration.
Source
pub async fn
GetChannel(&self) ->
Result<Channel>
pub async fn GetChannel(&self) -> Result<Channel>
Returns the active gRPC channel.
Source
pub async fn
Statistics(&self) ->
TransportStats
pub async fn Statistics(&self) -> TransportStats
Returns a snapshot of transport statistics.
Source
fn
BuildEndpoint(&self) ->
Result<Endpoint>
fn BuildEndpoint(&self) -> Result<Endpoint>
Builds 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 more
Source§
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 UnsafeUnpin for gRPCTransport
impl !UnwindSafe for gRPCTransport
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
Source§
impl<T>
CloneToUninit
for T
where T:
Clone,
impl<T>
CloneToUninit
for T
where 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 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