Struct mz_service::grpc::GrpcClient
source · pub struct GrpcClient<G>where
G: ProtoServiceTypes,{
tx: UnboundedSender<G::PC>,
rx: Streaming<G::PR>,
}
Expand description
A client to a remote dataflow server using gRPC and protobuf based communication.
The client opens a connection using the proto client stubs that are
generated by tonic from a service definition. When the client is connected,
it will call automatically the only RPC defined in the service description,
encapsulated by the BidiProtoClient
trait. This trait bound is not on the
Client
type parameter here, but it IS on the impl blocks. Bidirectional
protobuf RPC sets up two streams that persist after the RPC has returned: A
Request (Command) stream (for us, backed by a unbounded mpsc queue) going
from this instance to the server and a response stream coming back
(represented directly as a Streaming<Response>
instance). The recv and send
functions interact with the two mpsc channels or the streaming instance
respectively.
Fields§
§tx: UnboundedSender<G::PC>
The sender for commands.
rx: Streaming<G::PR>
The receiver for responses.
Implementations§
source§impl<G> GrpcClient<G>where
G: ProtoServiceTypes,
impl<G> GrpcClient<G>where
G: ProtoServiceTypes,
sourcepub async fn connect(
addr: String,
version: Version,
metrics: G::STATS,
params: &GrpcClientParameters,
) -> Result<Self, Error>
pub async fn connect( addr: String, version: Version, metrics: G::STATS, params: &GrpcClientParameters, ) -> Result<Self, Error>
Connects to the server at the given address, announcing the specified client version.
sourcepub async fn connect_partitioned<C, R>(
dests: Vec<(String, G::STATS)>,
version: Version,
params: &GrpcClientParameters,
) -> Result<Partitioned<Self, C, R>, Error>where
(C, R): Partitionable<C, R>,
pub async fn connect_partitioned<C, R>(
dests: Vec<(String, G::STATS)>,
version: Version,
params: &GrpcClientParameters,
) -> Result<Partitioned<Self, C, R>, Error>where
(C, R): Partitionable<C, R>,
Like GrpcClient::connect
, but for multiple partitioned servers.
Trait Implementations§
source§impl<G> Debug for GrpcClient<G>
impl<G> Debug for GrpcClient<G>
source§impl<G, C, R> GenericClient<C, R> for GrpcClient<G>
impl<G, C, R> GenericClient<C, R> for GrpcClient<G>
source§fn recv<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<R>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recv<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Option<R>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
§Cancel safety
This method is cancel safe. If recv
is used as the event in a tokio::select!
statement and some other branch completes first, it is guaranteed that no messages were
received by this client.
Auto Trait Implementations§
impl<G> !Freeze for GrpcClient<G>
impl<G> !RefUnwindSafe for GrpcClient<G>
impl<G> Send for GrpcClient<G>
impl<G> !Sync for GrpcClient<G>
impl<G> Unpin for GrpcClient<G>
impl<G> !UnwindSafe for GrpcClient<G>
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
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
T
in a tonic::Request
source§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.