ydb_grpc_bindings/generated/
ydb.coordination.v1.rs

1/// Generated client implementations.
2pub mod coordination_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 CoordinationServiceClient<T> {
8        inner: tonic::client::Grpc<T>,
9    }
10    impl CoordinationServiceClient<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> CoordinationServiceClient<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        ) -> CoordinationServiceClient<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            CoordinationServiceClient::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        /// *
87        /// Bidirectional stream used to establish a session with a coordination node
88        ///
89        /// Relevant APIs for managing semaphores, distributed locking, creating or
90        /// restoring a previously established session are described using nested
91        /// messages in SessionRequest and SessionResponse. Session is established
92        /// with a specific coordination node (previously created using CreateNode
93        /// below) and semaphores are local to that coordination node.
94        pub async fn session(
95            &mut self,
96            request: impl tonic::IntoStreamingRequest<
97                Message = super::super::SessionRequest,
98            >,
99        ) -> std::result::Result<
100            tonic::Response<tonic::codec::Streaming<super::super::SessionResponse>>,
101            tonic::Status,
102        > {
103            self.inner
104                .ready()
105                .await
106                .map_err(|e| {
107                    tonic::Status::new(
108                        tonic::Code::Unknown,
109                        format!("Service was not ready: {}", e.into()),
110                    )
111                })?;
112            let codec = tonic::codec::ProstCodec::default();
113            let path = http::uri::PathAndQuery::from_static(
114                "/Ydb.Coordination.V1.CoordinationService/Session",
115            );
116            let mut req = request.into_streaming_request();
117            req.extensions_mut()
118                .insert(
119                    GrpcMethod::new("Ydb.Coordination.V1.CoordinationService", "Session"),
120                );
121            self.inner.streaming(req, path, codec).await
122        }
123        /// Creates a new coordination node
124        pub async fn create_node(
125            &mut self,
126            request: impl tonic::IntoRequest<super::super::CreateNodeRequest>,
127        ) -> std::result::Result<
128            tonic::Response<super::super::CreateNodeResponse>,
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                "/Ydb.Coordination.V1.CoordinationService/CreateNode",
143            );
144            let mut req = request.into_request();
145            req.extensions_mut()
146                .insert(
147                    GrpcMethod::new(
148                        "Ydb.Coordination.V1.CoordinationService",
149                        "CreateNode",
150                    ),
151                );
152            self.inner.unary(req, path, codec).await
153        }
154        /// Modifies settings of a coordination node
155        pub async fn alter_node(
156            &mut self,
157            request: impl tonic::IntoRequest<super::super::AlterNodeRequest>,
158        ) -> std::result::Result<
159            tonic::Response<super::super::AlterNodeResponse>,
160            tonic::Status,
161        > {
162            self.inner
163                .ready()
164                .await
165                .map_err(|e| {
166                    tonic::Status::new(
167                        tonic::Code::Unknown,
168                        format!("Service was not ready: {}", e.into()),
169                    )
170                })?;
171            let codec = tonic::codec::ProstCodec::default();
172            let path = http::uri::PathAndQuery::from_static(
173                "/Ydb.Coordination.V1.CoordinationService/AlterNode",
174            );
175            let mut req = request.into_request();
176            req.extensions_mut()
177                .insert(
178                    GrpcMethod::new(
179                        "Ydb.Coordination.V1.CoordinationService",
180                        "AlterNode",
181                    ),
182                );
183            self.inner.unary(req, path, codec).await
184        }
185        /// Drops a coordination node
186        pub async fn drop_node(
187            &mut self,
188            request: impl tonic::IntoRequest<super::super::DropNodeRequest>,
189        ) -> std::result::Result<
190            tonic::Response<super::super::DropNodeResponse>,
191            tonic::Status,
192        > {
193            self.inner
194                .ready()
195                .await
196                .map_err(|e| {
197                    tonic::Status::new(
198                        tonic::Code::Unknown,
199                        format!("Service was not ready: {}", e.into()),
200                    )
201                })?;
202            let codec = tonic::codec::ProstCodec::default();
203            let path = http::uri::PathAndQuery::from_static(
204                "/Ydb.Coordination.V1.CoordinationService/DropNode",
205            );
206            let mut req = request.into_request();
207            req.extensions_mut()
208                .insert(
209                    GrpcMethod::new(
210                        "Ydb.Coordination.V1.CoordinationService",
211                        "DropNode",
212                    ),
213                );
214            self.inner.unary(req, path, codec).await
215        }
216        /// Describes a coordination node
217        pub async fn describe_node(
218            &mut self,
219            request: impl tonic::IntoRequest<super::super::DescribeNodeRequest>,
220        ) -> std::result::Result<
221            tonic::Response<super::super::DescribeNodeResponse>,
222            tonic::Status,
223        > {
224            self.inner
225                .ready()
226                .await
227                .map_err(|e| {
228                    tonic::Status::new(
229                        tonic::Code::Unknown,
230                        format!("Service was not ready: {}", e.into()),
231                    )
232                })?;
233            let codec = tonic::codec::ProstCodec::default();
234            let path = http::uri::PathAndQuery::from_static(
235                "/Ydb.Coordination.V1.CoordinationService/DescribeNode",
236            );
237            let mut req = request.into_request();
238            req.extensions_mut()
239                .insert(
240                    GrpcMethod::new(
241                        "Ydb.Coordination.V1.CoordinationService",
242                        "DescribeNode",
243                    ),
244                );
245            self.inner.unary(req, path, codec).await
246        }
247    }
248}