ydb_grpc_bindings/generated/
ydb.table.v1.rs

1/// Generated client implementations.
2pub mod table_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 TableServiceClient<T> {
8        inner: tonic::client::Grpc<T>,
9    }
10    impl TableServiceClient<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> TableServiceClient<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        ) -> TableServiceClient<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            TableServiceClient::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 new session. Implicit session creation is forbidden,
87        /// so user must create new session before execute any query,
88        /// otherwise BAD_SESSION status will be returned.
89        /// Simultaneous execution of requests are forbiden.
90        /// Sessions are volatile, can be invalidated by server, for example in case
91        /// of fatal errors. All requests with this session will fail with BAD_SESSION status.
92        /// So, client must be able to handle BAD_SESSION status.
93        pub async fn create_session(
94            &mut self,
95            request: impl tonic::IntoRequest<super::super::CreateSessionRequest>,
96        ) -> std::result::Result<
97            tonic::Response<super::super::CreateSessionResponse>,
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                "/Ydb.Table.V1.TableService/CreateSession",
112            );
113            let mut req = request.into_request();
114            req.extensions_mut()
115                .insert(GrpcMethod::new("Ydb.Table.V1.TableService", "CreateSession"));
116            self.inner.unary(req, path, codec).await
117        }
118        /// Ends a session, releasing server resources associated with it.
119        pub async fn delete_session(
120            &mut self,
121            request: impl tonic::IntoRequest<super::super::DeleteSessionRequest>,
122        ) -> std::result::Result<
123            tonic::Response<super::super::DeleteSessionResponse>,
124            tonic::Status,
125        > {
126            self.inner
127                .ready()
128                .await
129                .map_err(|e| {
130                    tonic::Status::new(
131                        tonic::Code::Unknown,
132                        format!("Service was not ready: {}", e.into()),
133                    )
134                })?;
135            let codec = tonic::codec::ProstCodec::default();
136            let path = http::uri::PathAndQuery::from_static(
137                "/Ydb.Table.V1.TableService/DeleteSession",
138            );
139            let mut req = request.into_request();
140            req.extensions_mut()
141                .insert(GrpcMethod::new("Ydb.Table.V1.TableService", "DeleteSession"));
142            self.inner.unary(req, path, codec).await
143        }
144        /// Idle sessions can be kept alive by calling KeepAlive periodically.
145        pub async fn keep_alive(
146            &mut self,
147            request: impl tonic::IntoRequest<super::super::KeepAliveRequest>,
148        ) -> std::result::Result<
149            tonic::Response<super::super::KeepAliveResponse>,
150            tonic::Status,
151        > {
152            self.inner
153                .ready()
154                .await
155                .map_err(|e| {
156                    tonic::Status::new(
157                        tonic::Code::Unknown,
158                        format!("Service was not ready: {}", e.into()),
159                    )
160                })?;
161            let codec = tonic::codec::ProstCodec::default();
162            let path = http::uri::PathAndQuery::from_static(
163                "/Ydb.Table.V1.TableService/KeepAlive",
164            );
165            let mut req = request.into_request();
166            req.extensions_mut()
167                .insert(GrpcMethod::new("Ydb.Table.V1.TableService", "KeepAlive"));
168            self.inner.unary(req, path, codec).await
169        }
170        /// Creates new table.
171        pub async fn create_table(
172            &mut self,
173            request: impl tonic::IntoRequest<super::super::CreateTableRequest>,
174        ) -> std::result::Result<
175            tonic::Response<super::super::CreateTableResponse>,
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.Table.V1.TableService/CreateTable",
190            );
191            let mut req = request.into_request();
192            req.extensions_mut()
193                .insert(GrpcMethod::new("Ydb.Table.V1.TableService", "CreateTable"));
194            self.inner.unary(req, path, codec).await
195        }
196        /// Drop table.
197        pub async fn drop_table(
198            &mut self,
199            request: impl tonic::IntoRequest<super::super::DropTableRequest>,
200        ) -> std::result::Result<
201            tonic::Response<super::super::DropTableResponse>,
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.Table.V1.TableService/DropTable",
216            );
217            let mut req = request.into_request();
218            req.extensions_mut()
219                .insert(GrpcMethod::new("Ydb.Table.V1.TableService", "DropTable"));
220            self.inner.unary(req, path, codec).await
221        }
222        /// Modifies schema of given table.
223        pub async fn alter_table(
224            &mut self,
225            request: impl tonic::IntoRequest<super::super::AlterTableRequest>,
226        ) -> std::result::Result<
227            tonic::Response<super::super::AlterTableResponse>,
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.Table.V1.TableService/AlterTable",
242            );
243            let mut req = request.into_request();
244            req.extensions_mut()
245                .insert(GrpcMethod::new("Ydb.Table.V1.TableService", "AlterTable"));
246            self.inner.unary(req, path, codec).await
247        }
248        /// Creates copy of given table.
249        pub async fn copy_table(
250            &mut self,
251            request: impl tonic::IntoRequest<super::super::CopyTableRequest>,
252        ) -> std::result::Result<
253            tonic::Response<super::super::CopyTableResponse>,
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.Table.V1.TableService/CopyTable",
268            );
269            let mut req = request.into_request();
270            req.extensions_mut()
271                .insert(GrpcMethod::new("Ydb.Table.V1.TableService", "CopyTable"));
272            self.inner.unary(req, path, codec).await
273        }
274        /// Creates consistent copy of given tables.
275        pub async fn copy_tables(
276            &mut self,
277            request: impl tonic::IntoRequest<super::super::CopyTablesRequest>,
278        ) -> std::result::Result<
279            tonic::Response<super::super::CopyTablesResponse>,
280            tonic::Status,
281        > {
282            self.inner
283                .ready()
284                .await
285                .map_err(|e| {
286                    tonic::Status::new(
287                        tonic::Code::Unknown,
288                        format!("Service was not ready: {}", e.into()),
289                    )
290                })?;
291            let codec = tonic::codec::ProstCodec::default();
292            let path = http::uri::PathAndQuery::from_static(
293                "/Ydb.Table.V1.TableService/CopyTables",
294            );
295            let mut req = request.into_request();
296            req.extensions_mut()
297                .insert(GrpcMethod::new("Ydb.Table.V1.TableService", "CopyTables"));
298            self.inner.unary(req, path, codec).await
299        }
300        /// Creates consistent move of given tables.
301        pub async fn rename_tables(
302            &mut self,
303            request: impl tonic::IntoRequest<super::super::RenameTablesRequest>,
304        ) -> std::result::Result<
305            tonic::Response<super::super::RenameTablesResponse>,
306            tonic::Status,
307        > {
308            self.inner
309                .ready()
310                .await
311                .map_err(|e| {
312                    tonic::Status::new(
313                        tonic::Code::Unknown,
314                        format!("Service was not ready: {}", e.into()),
315                    )
316                })?;
317            let codec = tonic::codec::ProstCodec::default();
318            let path = http::uri::PathAndQuery::from_static(
319                "/Ydb.Table.V1.TableService/RenameTables",
320            );
321            let mut req = request.into_request();
322            req.extensions_mut()
323                .insert(GrpcMethod::new("Ydb.Table.V1.TableService", "RenameTables"));
324            self.inner.unary(req, path, codec).await
325        }
326        /// Returns information about given table (metadata).
327        pub async fn describe_table(
328            &mut self,
329            request: impl tonic::IntoRequest<super::super::DescribeTableRequest>,
330        ) -> std::result::Result<
331            tonic::Response<super::super::DescribeTableResponse>,
332            tonic::Status,
333        > {
334            self.inner
335                .ready()
336                .await
337                .map_err(|e| {
338                    tonic::Status::new(
339                        tonic::Code::Unknown,
340                        format!("Service was not ready: {}", e.into()),
341                    )
342                })?;
343            let codec = tonic::codec::ProstCodec::default();
344            let path = http::uri::PathAndQuery::from_static(
345                "/Ydb.Table.V1.TableService/DescribeTable",
346            );
347            let mut req = request.into_request();
348            req.extensions_mut()
349                .insert(GrpcMethod::new("Ydb.Table.V1.TableService", "DescribeTable"));
350            self.inner.unary(req, path, codec).await
351        }
352        /// Explains data query.
353        /// SessionId of previously created session must be provided.
354        pub async fn explain_data_query(
355            &mut self,
356            request: impl tonic::IntoRequest<super::super::ExplainDataQueryRequest>,
357        ) -> std::result::Result<
358            tonic::Response<super::super::ExplainDataQueryResponse>,
359            tonic::Status,
360        > {
361            self.inner
362                .ready()
363                .await
364                .map_err(|e| {
365                    tonic::Status::new(
366                        tonic::Code::Unknown,
367                        format!("Service was not ready: {}", e.into()),
368                    )
369                })?;
370            let codec = tonic::codec::ProstCodec::default();
371            let path = http::uri::PathAndQuery::from_static(
372                "/Ydb.Table.V1.TableService/ExplainDataQuery",
373            );
374            let mut req = request.into_request();
375            req.extensions_mut()
376                .insert(
377                    GrpcMethod::new("Ydb.Table.V1.TableService", "ExplainDataQuery"),
378                );
379            self.inner.unary(req, path, codec).await
380        }
381        /// Prepares data query, returns query id.
382        /// SessionId of previously created session must be provided.
383        pub async fn prepare_data_query(
384            &mut self,
385            request: impl tonic::IntoRequest<super::super::PrepareDataQueryRequest>,
386        ) -> std::result::Result<
387            tonic::Response<super::super::PrepareDataQueryResponse>,
388            tonic::Status,
389        > {
390            self.inner
391                .ready()
392                .await
393                .map_err(|e| {
394                    tonic::Status::new(
395                        tonic::Code::Unknown,
396                        format!("Service was not ready: {}", e.into()),
397                    )
398                })?;
399            let codec = tonic::codec::ProstCodec::default();
400            let path = http::uri::PathAndQuery::from_static(
401                "/Ydb.Table.V1.TableService/PrepareDataQuery",
402            );
403            let mut req = request.into_request();
404            req.extensions_mut()
405                .insert(
406                    GrpcMethod::new("Ydb.Table.V1.TableService", "PrepareDataQuery"),
407                );
408            self.inner.unary(req, path, codec).await
409        }
410        /// Executes data query.
411        /// SessionId of previously created session must be provided.
412        pub async fn execute_data_query(
413            &mut self,
414            request: impl tonic::IntoRequest<super::super::ExecuteDataQueryRequest>,
415        ) -> std::result::Result<
416            tonic::Response<super::super::ExecuteDataQueryResponse>,
417            tonic::Status,
418        > {
419            self.inner
420                .ready()
421                .await
422                .map_err(|e| {
423                    tonic::Status::new(
424                        tonic::Code::Unknown,
425                        format!("Service was not ready: {}", e.into()),
426                    )
427                })?;
428            let codec = tonic::codec::ProstCodec::default();
429            let path = http::uri::PathAndQuery::from_static(
430                "/Ydb.Table.V1.TableService/ExecuteDataQuery",
431            );
432            let mut req = request.into_request();
433            req.extensions_mut()
434                .insert(
435                    GrpcMethod::new("Ydb.Table.V1.TableService", "ExecuteDataQuery"),
436                );
437            self.inner.unary(req, path, codec).await
438        }
439        /// Executes scheme query.
440        /// SessionId of previously created session must be provided.
441        pub async fn execute_scheme_query(
442            &mut self,
443            request: impl tonic::IntoRequest<super::super::ExecuteSchemeQueryRequest>,
444        ) -> std::result::Result<
445            tonic::Response<super::super::ExecuteSchemeQueryResponse>,
446            tonic::Status,
447        > {
448            self.inner
449                .ready()
450                .await
451                .map_err(|e| {
452                    tonic::Status::new(
453                        tonic::Code::Unknown,
454                        format!("Service was not ready: {}", e.into()),
455                    )
456                })?;
457            let codec = tonic::codec::ProstCodec::default();
458            let path = http::uri::PathAndQuery::from_static(
459                "/Ydb.Table.V1.TableService/ExecuteSchemeQuery",
460            );
461            let mut req = request.into_request();
462            req.extensions_mut()
463                .insert(
464                    GrpcMethod::new("Ydb.Table.V1.TableService", "ExecuteSchemeQuery"),
465                );
466            self.inner.unary(req, path, codec).await
467        }
468        /// Begins new transaction.
469        pub async fn begin_transaction(
470            &mut self,
471            request: impl tonic::IntoRequest<super::super::BeginTransactionRequest>,
472        ) -> std::result::Result<
473            tonic::Response<super::super::BeginTransactionResponse>,
474            tonic::Status,
475        > {
476            self.inner
477                .ready()
478                .await
479                .map_err(|e| {
480                    tonic::Status::new(
481                        tonic::Code::Unknown,
482                        format!("Service was not ready: {}", e.into()),
483                    )
484                })?;
485            let codec = tonic::codec::ProstCodec::default();
486            let path = http::uri::PathAndQuery::from_static(
487                "/Ydb.Table.V1.TableService/BeginTransaction",
488            );
489            let mut req = request.into_request();
490            req.extensions_mut()
491                .insert(
492                    GrpcMethod::new("Ydb.Table.V1.TableService", "BeginTransaction"),
493                );
494            self.inner.unary(req, path, codec).await
495        }
496        /// Commits specified active transaction.
497        pub async fn commit_transaction(
498            &mut self,
499            request: impl tonic::IntoRequest<super::super::CommitTransactionRequest>,
500        ) -> std::result::Result<
501            tonic::Response<super::super::CommitTransactionResponse>,
502            tonic::Status,
503        > {
504            self.inner
505                .ready()
506                .await
507                .map_err(|e| {
508                    tonic::Status::new(
509                        tonic::Code::Unknown,
510                        format!("Service was not ready: {}", e.into()),
511                    )
512                })?;
513            let codec = tonic::codec::ProstCodec::default();
514            let path = http::uri::PathAndQuery::from_static(
515                "/Ydb.Table.V1.TableService/CommitTransaction",
516            );
517            let mut req = request.into_request();
518            req.extensions_mut()
519                .insert(
520                    GrpcMethod::new("Ydb.Table.V1.TableService", "CommitTransaction"),
521                );
522            self.inner.unary(req, path, codec).await
523        }
524        /// Performs a rollback of the specified active transaction.
525        pub async fn rollback_transaction(
526            &mut self,
527            request: impl tonic::IntoRequest<super::super::RollbackTransactionRequest>,
528        ) -> std::result::Result<
529            tonic::Response<super::super::RollbackTransactionResponse>,
530            tonic::Status,
531        > {
532            self.inner
533                .ready()
534                .await
535                .map_err(|e| {
536                    tonic::Status::new(
537                        tonic::Code::Unknown,
538                        format!("Service was not ready: {}", e.into()),
539                    )
540                })?;
541            let codec = tonic::codec::ProstCodec::default();
542            let path = http::uri::PathAndQuery::from_static(
543                "/Ydb.Table.V1.TableService/RollbackTransaction",
544            );
545            let mut req = request.into_request();
546            req.extensions_mut()
547                .insert(
548                    GrpcMethod::new("Ydb.Table.V1.TableService", "RollbackTransaction"),
549                );
550            self.inner.unary(req, path, codec).await
551        }
552        /// Describe supported table options.
553        pub async fn describe_table_options(
554            &mut self,
555            request: impl tonic::IntoRequest<super::super::DescribeTableOptionsRequest>,
556        ) -> std::result::Result<
557            tonic::Response<super::super::DescribeTableOptionsResponse>,
558            tonic::Status,
559        > {
560            self.inner
561                .ready()
562                .await
563                .map_err(|e| {
564                    tonic::Status::new(
565                        tonic::Code::Unknown,
566                        format!("Service was not ready: {}", e.into()),
567                    )
568                })?;
569            let codec = tonic::codec::ProstCodec::default();
570            let path = http::uri::PathAndQuery::from_static(
571                "/Ydb.Table.V1.TableService/DescribeTableOptions",
572            );
573            let mut req = request.into_request();
574            req.extensions_mut()
575                .insert(
576                    GrpcMethod::new("Ydb.Table.V1.TableService", "DescribeTableOptions"),
577                );
578            self.inner.unary(req, path, codec).await
579        }
580        /// Streaming read table
581        pub async fn stream_read_table(
582            &mut self,
583            request: impl tonic::IntoRequest<super::super::ReadTableRequest>,
584        ) -> std::result::Result<
585            tonic::Response<tonic::codec::Streaming<super::super::ReadTableResponse>>,
586            tonic::Status,
587        > {
588            self.inner
589                .ready()
590                .await
591                .map_err(|e| {
592                    tonic::Status::new(
593                        tonic::Code::Unknown,
594                        format!("Service was not ready: {}", e.into()),
595                    )
596                })?;
597            let codec = tonic::codec::ProstCodec::default();
598            let path = http::uri::PathAndQuery::from_static(
599                "/Ydb.Table.V1.TableService/StreamReadTable",
600            );
601            let mut req = request.into_request();
602            req.extensions_mut()
603                .insert(GrpcMethod::new("Ydb.Table.V1.TableService", "StreamReadTable"));
604            self.inner.server_streaming(req, path, codec).await
605        }
606        /// Upserts a batch of rows non-transactionally.
607        /// Returns success only when all rows were successfully upserted. In case of an error some rows might
608        /// be upserted and some might not.
609        pub async fn bulk_upsert(
610            &mut self,
611            request: impl tonic::IntoRequest<super::super::BulkUpsertRequest>,
612        ) -> std::result::Result<
613            tonic::Response<super::super::BulkUpsertResponse>,
614            tonic::Status,
615        > {
616            self.inner
617                .ready()
618                .await
619                .map_err(|e| {
620                    tonic::Status::new(
621                        tonic::Code::Unknown,
622                        format!("Service was not ready: {}", e.into()),
623                    )
624                })?;
625            let codec = tonic::codec::ProstCodec::default();
626            let path = http::uri::PathAndQuery::from_static(
627                "/Ydb.Table.V1.TableService/BulkUpsert",
628            );
629            let mut req = request.into_request();
630            req.extensions_mut()
631                .insert(GrpcMethod::new("Ydb.Table.V1.TableService", "BulkUpsert"));
632            self.inner.unary(req, path, codec).await
633        }
634        /// Executes scan query with streaming result.
635        pub async fn stream_execute_scan_query(
636            &mut self,
637            request: impl tonic::IntoRequest<super::super::ExecuteScanQueryRequest>,
638        ) -> std::result::Result<
639            tonic::Response<
640                tonic::codec::Streaming<super::super::ExecuteScanQueryPartialResponse>,
641            >,
642            tonic::Status,
643        > {
644            self.inner
645                .ready()
646                .await
647                .map_err(|e| {
648                    tonic::Status::new(
649                        tonic::Code::Unknown,
650                        format!("Service was not ready: {}", e.into()),
651                    )
652                })?;
653            let codec = tonic::codec::ProstCodec::default();
654            let path = http::uri::PathAndQuery::from_static(
655                "/Ydb.Table.V1.TableService/StreamExecuteScanQuery",
656            );
657            let mut req = request.into_request();
658            req.extensions_mut()
659                .insert(
660                    GrpcMethod::new(
661                        "Ydb.Table.V1.TableService",
662                        "StreamExecuteScanQuery",
663                    ),
664                );
665            self.inner.server_streaming(req, path, codec).await
666        }
667    }
668}