ydb_grpc/generated/
ydb.topic.v1.rs

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