ydb_grpc_bindings/generated/
ydb.topic.v1.rs

1/// Generated client implementations.
2pub mod topic_service_client {
3    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
4    use tonic::codegen::*;
5    use tonic::codegen::http::Uri;
6    #[derive(Debug, Clone)]
7    pub struct TopicServiceClient<T> {
8        inner: tonic::client::Grpc<T>,
9    }
10    impl TopicServiceClient<tonic::transport::Channel> {
11        /// Attempt to create a new client by connecting to a given endpoint.
12        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
13        where
14            D: TryInto<tonic::transport::Endpoint>,
15            D::Error: Into<StdError>,
16        {
17            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
18            Ok(Self::new(conn))
19        }
20    }
21    impl<T> TopicServiceClient<T>
22    where
23        T: tonic::client::GrpcService<tonic::body::BoxBody>,
24        T::Error: Into<StdError>,
25        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
26        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
27    {
28        pub fn new(inner: T) -> Self {
29            let inner = tonic::client::Grpc::new(inner);
30            Self { inner }
31        }
32        pub fn with_origin(inner: T, origin: Uri) -> Self {
33            let inner = tonic::client::Grpc::with_origin(inner, origin);
34            Self { inner }
35        }
36        pub fn with_interceptor<F>(
37            inner: T,
38            interceptor: F,
39        ) -> TopicServiceClient<InterceptedService<T, F>>
40        where
41            F: tonic::service::Interceptor,
42            T::ResponseBody: Default,
43            T: tonic::codegen::Service<
44                http::Request<tonic::body::BoxBody>,
45                Response = http::Response<
46                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
47                >,
48            >,
49            <T as tonic::codegen::Service<
50                http::Request<tonic::body::BoxBody>,
51            >>::Error: Into<StdError> + Send + Sync,
52        {
53            TopicServiceClient::new(InterceptedService::new(inner, interceptor))
54        }
55        /// Compress requests with the given encoding.
56        ///
57        /// This requires the server to support it otherwise it might respond with an
58        /// error.
59        #[must_use]
60        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
61            self.inner = self.inner.send_compressed(encoding);
62            self
63        }
64        /// Enable decompressing responses.
65        #[must_use]
66        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
67            self.inner = self.inner.accept_compressed(encoding);
68            self
69        }
70        /// Limits the maximum size of a decoded message.
71        ///
72        /// Default: `4MB`
73        #[must_use]
74        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
75            self.inner = self.inner.max_decoding_message_size(limit);
76            self
77        }
78        /// Limits the maximum size of an encoded message.
79        ///
80        /// Default: `usize::MAX`
81        #[must_use]
82        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
83            self.inner = self.inner.max_encoding_message_size(limit);
84            self
85        }
86        /// Create Write Session
87        /// Pipeline example:
88        /// client                  server
89        ///         InitRequest(Topic, MessageGroupID, ...)
90        ///        ---------------->
91        ///         InitResponse(Partition, MaxSeqNo, ...)
92        ///        <----------------
93        ///         WriteRequest(data1, seqNo1)
94        ///        ---------------->
95        ///         WriteRequest(data2, seqNo2)
96        ///        ---------------->
97        ///         WriteResponse(seqNo1, offset1, ...)
98        ///        <----------------
99        ///         WriteRequest(data3, seqNo3)
100        ///        ---------------->
101        ///         WriteResponse(seqNo2, offset2, ...)
102        ///        <----------------
103        ///         [something went wrong] (status != SUCCESS, issues not empty)
104        ///        <----------------
105        pub async fn stream_write(
106            &mut self,
107            request: impl tonic::IntoStreamingRequest<
108                Message = super::super::stream_write_message::FromClient,
109            >,
110        ) -> std::result::Result<
111            tonic::Response<
112                tonic::codec::Streaming<super::super::stream_write_message::FromServer>,
113            >,
114            tonic::Status,
115        > {
116            self.inner
117                .ready()
118                .await
119                .map_err(|e| {
120                    tonic::Status::new(
121                        tonic::Code::Unknown,
122                        format!("Service was not ready: {}", e.into()),
123                    )
124                })?;
125            let codec = tonic::codec::ProstCodec::default();
126            let path = http::uri::PathAndQuery::from_static(
127                "/Ydb.Topic.V1.TopicService/StreamWrite",
128            );
129            let mut req = request.into_streaming_request();
130            req.extensions_mut()
131                .insert(GrpcMethod::new("Ydb.Topic.V1.TopicService", "StreamWrite"));
132            self.inner.streaming(req, path, codec).await
133        }
134        /// Create Read Session
135        /// Pipeline:
136        /// client                  server
137        ///         InitRequest(Topics, ClientId, ...)
138        ///        ---------------->
139        ///         InitResponse(SessionId)
140        ///        <----------------
141        ///         ReadRequest
142        ///        ---------------->
143        ///         ReadRequest
144        ///        ---------------->
145        ///         StartPartitionSessionRequest(Topic1, Partition1, PartitionSessionID1, ...)
146        ///        <----------------
147        ///         StartPartitionSessionRequest(Topic2, Partition2, PartitionSessionID2, ...)
148        ///        <----------------
149        ///         StartPartitionSessionResponse(PartitionSessionID1, ...)
150        ///             client must respond with this message to actually start recieving data messages from this partition
151        ///        ---------------->
152        ///         StopPartitionSessionRequest(PartitionSessionID1, ...)
153        ///        <----------------
154        ///         StopPartitionSessionResponse(PartitionSessionID1, ...)
155        ///             only after this response server will give this parittion to other session.
156        ///        ---------------->
157        ///         StartPartitionSessionResponse(PartitionSession2, ...)
158        ///        ---------------->
159        ///         ReadResponse(data, ...)
160        ///        <----------------
161        ///         CommitRequest(PartitionCommit1, ...)
162        ///        ---------------->
163        ///         CommitResponse(PartitionCommitAck1, ...)
164        ///        <----------------
165        ///         [something went wrong] (status != SUCCESS, issues not empty)
166        ///        <----------------
167        pub async fn stream_read(
168            &mut self,
169            request: impl tonic::IntoStreamingRequest<
170                Message = super::super::stream_read_message::FromClient,
171            >,
172        ) -> std::result::Result<
173            tonic::Response<
174                tonic::codec::Streaming<super::super::stream_read_message::FromServer>,
175            >,
176            tonic::Status,
177        > {
178            self.inner
179                .ready()
180                .await
181                .map_err(|e| {
182                    tonic::Status::new(
183                        tonic::Code::Unknown,
184                        format!("Service was not ready: {}", e.into()),
185                    )
186                })?;
187            let codec = tonic::codec::ProstCodec::default();
188            let path = http::uri::PathAndQuery::from_static(
189                "/Ydb.Topic.V1.TopicService/StreamRead",
190            );
191            let mut req = request.into_streaming_request();
192            req.extensions_mut()
193                .insert(GrpcMethod::new("Ydb.Topic.V1.TopicService", "StreamRead"));
194            self.inner.streaming(req, path, codec).await
195        }
196        /// Create topic command.
197        pub async fn create_topic(
198            &mut self,
199            request: impl tonic::IntoRequest<super::super::CreateTopicRequest>,
200        ) -> std::result::Result<
201            tonic::Response<super::super::CreateTopicResponse>,
202            tonic::Status,
203        > {
204            self.inner
205                .ready()
206                .await
207                .map_err(|e| {
208                    tonic::Status::new(
209                        tonic::Code::Unknown,
210                        format!("Service was not ready: {}", e.into()),
211                    )
212                })?;
213            let codec = tonic::codec::ProstCodec::default();
214            let path = http::uri::PathAndQuery::from_static(
215                "/Ydb.Topic.V1.TopicService/CreateTopic",
216            );
217            let mut req = request.into_request();
218            req.extensions_mut()
219                .insert(GrpcMethod::new("Ydb.Topic.V1.TopicService", "CreateTopic"));
220            self.inner.unary(req, path, codec).await
221        }
222        /// Describe topic command.
223        pub async fn describe_topic(
224            &mut self,
225            request: impl tonic::IntoRequest<super::super::DescribeTopicRequest>,
226        ) -> std::result::Result<
227            tonic::Response<super::super::DescribeTopicResponse>,
228            tonic::Status,
229        > {
230            self.inner
231                .ready()
232                .await
233                .map_err(|e| {
234                    tonic::Status::new(
235                        tonic::Code::Unknown,
236                        format!("Service was not ready: {}", e.into()),
237                    )
238                })?;
239            let codec = tonic::codec::ProstCodec::default();
240            let path = http::uri::PathAndQuery::from_static(
241                "/Ydb.Topic.V1.TopicService/DescribeTopic",
242            );
243            let mut req = request.into_request();
244            req.extensions_mut()
245                .insert(GrpcMethod::new("Ydb.Topic.V1.TopicService", "DescribeTopic"));
246            self.inner.unary(req, path, codec).await
247        }
248        /// Describe topic's consumer command.
249        pub async fn describe_consumer(
250            &mut self,
251            request: impl tonic::IntoRequest<super::super::DescribeConsumerRequest>,
252        ) -> std::result::Result<
253            tonic::Response<super::super::DescribeConsumerResponse>,
254            tonic::Status,
255        > {
256            self.inner
257                .ready()
258                .await
259                .map_err(|e| {
260                    tonic::Status::new(
261                        tonic::Code::Unknown,
262                        format!("Service was not ready: {}", e.into()),
263                    )
264                })?;
265            let codec = tonic::codec::ProstCodec::default();
266            let path = http::uri::PathAndQuery::from_static(
267                "/Ydb.Topic.V1.TopicService/DescribeConsumer",
268            );
269            let mut req = request.into_request();
270            req.extensions_mut()
271                .insert(
272                    GrpcMethod::new("Ydb.Topic.V1.TopicService", "DescribeConsumer"),
273                );
274            self.inner.unary(req, path, codec).await
275        }
276        /// Alter topic command.
277        pub async fn alter_topic(
278            &mut self,
279            request: impl tonic::IntoRequest<super::super::AlterTopicRequest>,
280        ) -> std::result::Result<
281            tonic::Response<super::super::AlterTopicResponse>,
282            tonic::Status,
283        > {
284            self.inner
285                .ready()
286                .await
287                .map_err(|e| {
288                    tonic::Status::new(
289                        tonic::Code::Unknown,
290                        format!("Service was not ready: {}", e.into()),
291                    )
292                })?;
293            let codec = tonic::codec::ProstCodec::default();
294            let path = http::uri::PathAndQuery::from_static(
295                "/Ydb.Topic.V1.TopicService/AlterTopic",
296            );
297            let mut req = request.into_request();
298            req.extensions_mut()
299                .insert(GrpcMethod::new("Ydb.Topic.V1.TopicService", "AlterTopic"));
300            self.inner.unary(req, path, codec).await
301        }
302        /// Drop topic command.
303        pub async fn drop_topic(
304            &mut self,
305            request: impl tonic::IntoRequest<super::super::DropTopicRequest>,
306        ) -> std::result::Result<
307            tonic::Response<super::super::DropTopicResponse>,
308            tonic::Status,
309        > {
310            self.inner
311                .ready()
312                .await
313                .map_err(|e| {
314                    tonic::Status::new(
315                        tonic::Code::Unknown,
316                        format!("Service was not ready: {}", e.into()),
317                    )
318                })?;
319            let codec = tonic::codec::ProstCodec::default();
320            let path = http::uri::PathAndQuery::from_static(
321                "/Ydb.Topic.V1.TopicService/DropTopic",
322            );
323            let mut req = request.into_request();
324            req.extensions_mut()
325                .insert(GrpcMethod::new("Ydb.Topic.V1.TopicService", "DropTopic"));
326            self.inner.unary(req, path, codec).await
327        }
328    }
329}