vitess_grpc/generated/
binlogservice.rs

1/// Generated client implementations.
2pub mod update_stream_client {
3    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
4    use tonic::codegen::*;
5    use tonic::codegen::http::Uri;
6    /// UpdateStream is the RPC version of binlog.UpdateStream.
7    #[derive(Debug, Clone)]
8    pub struct UpdateStreamClient<T> {
9        inner: tonic::client::Grpc<T>,
10    }
11    impl UpdateStreamClient<tonic::transport::Channel> {
12        /// Attempt to create a new client by connecting to a given endpoint.
13        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
14        where
15            D: TryInto<tonic::transport::Endpoint>,
16            D::Error: Into<StdError>,
17        {
18            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
19            Ok(Self::new(conn))
20        }
21    }
22    impl<T> UpdateStreamClient<T>
23    where
24        T: tonic::client::GrpcService<tonic::body::BoxBody>,
25        T::Error: Into<StdError>,
26        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
27        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
28    {
29        pub fn new(inner: T) -> Self {
30            let inner = tonic::client::Grpc::new(inner);
31            Self { inner }
32        }
33        pub fn with_origin(inner: T, origin: Uri) -> Self {
34            let inner = tonic::client::Grpc::with_origin(inner, origin);
35            Self { inner }
36        }
37        pub fn with_interceptor<F>(
38            inner: T,
39            interceptor: F,
40        ) -> UpdateStreamClient<InterceptedService<T, F>>
41        where
42            F: tonic::service::Interceptor,
43            T::ResponseBody: Default,
44            T: tonic::codegen::Service<
45                http::Request<tonic::body::BoxBody>,
46                Response = http::Response<
47                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
48                >,
49            >,
50            <T as tonic::codegen::Service<
51                http::Request<tonic::body::BoxBody>,
52            >>::Error: Into<StdError> + Send + Sync,
53        {
54            UpdateStreamClient::new(InterceptedService::new(inner, interceptor))
55        }
56        /// Compress requests with the given encoding.
57        ///
58        /// This requires the server to support it otherwise it might respond with an
59        /// error.
60        #[must_use]
61        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
62            self.inner = self.inner.send_compressed(encoding);
63            self
64        }
65        /// Enable decompressing responses.
66        #[must_use]
67        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
68            self.inner = self.inner.accept_compressed(encoding);
69            self
70        }
71        /// Limits the maximum size of a decoded message.
72        ///
73        /// Default: `4MB`
74        #[must_use]
75        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
76            self.inner = self.inner.max_decoding_message_size(limit);
77            self
78        }
79        /// Limits the maximum size of an encoded message.
80        ///
81        /// Default: `usize::MAX`
82        #[must_use]
83        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
84            self.inner = self.inner.max_encoding_message_size(limit);
85            self
86        }
87        /// StreamKeyRange returns the binlog transactions related to
88        /// the specified Keyrange.
89        pub async fn stream_key_range(
90            &mut self,
91            request: impl tonic::IntoRequest<
92                super::super::binlogdata::StreamKeyRangeRequest,
93            >,
94        ) -> std::result::Result<
95            tonic::Response<
96                tonic::codec::Streaming<super::super::binlogdata::StreamKeyRangeResponse>,
97            >,
98            tonic::Status,
99        > {
100            self.inner
101                .ready()
102                .await
103                .map_err(|e| {
104                    tonic::Status::new(
105                        tonic::Code::Unknown,
106                        format!("Service was not ready: {}", e.into()),
107                    )
108                })?;
109            let codec = tonic::codec::ProstCodec::default();
110            let path = http::uri::PathAndQuery::from_static(
111                "/binlogservice.UpdateStream/StreamKeyRange",
112            );
113            let mut req = request.into_request();
114            req.extensions_mut()
115                .insert(GrpcMethod::new("binlogservice.UpdateStream", "StreamKeyRange"));
116            self.inner.server_streaming(req, path, codec).await
117        }
118        /// StreamTables returns the binlog transactions related to
119        /// the specified Tables.
120        pub async fn stream_tables(
121            &mut self,
122            request: impl tonic::IntoRequest<
123                super::super::binlogdata::StreamTablesRequest,
124            >,
125        ) -> std::result::Result<
126            tonic::Response<
127                tonic::codec::Streaming<super::super::binlogdata::StreamTablesResponse>,
128            >,
129            tonic::Status,
130        > {
131            self.inner
132                .ready()
133                .await
134                .map_err(|e| {
135                    tonic::Status::new(
136                        tonic::Code::Unknown,
137                        format!("Service was not ready: {}", e.into()),
138                    )
139                })?;
140            let codec = tonic::codec::ProstCodec::default();
141            let path = http::uri::PathAndQuery::from_static(
142                "/binlogservice.UpdateStream/StreamTables",
143            );
144            let mut req = request.into_request();
145            req.extensions_mut()
146                .insert(GrpcMethod::new("binlogservice.UpdateStream", "StreamTables"));
147            self.inner.server_streaming(req, path, codec).await
148        }
149    }
150}