ydb_grpc/generated/
ydb.table.v1.rs

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