ydb_grpc/generated/
ydb.coordination.v1.rs

1// This file is @generated by prost-build.
2/// Generated client implementations.
3pub mod coordination_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::http::Uri;
12    use tonic::codegen::*;
13    #[derive(Debug, Clone)]
14    pub struct CoordinationServiceClient<T> {
15        inner: tonic::client::Grpc<T>,
16    }
17    impl CoordinationServiceClient<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> CoordinationServiceClient<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        ) -> CoordinationServiceClient<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<http::Request<tonic::body::Body>>>::Error:
57                Into<StdError> + std::marker::Send + std::marker::Sync,
58        {
59            CoordinationServiceClient::new(InterceptedService::new(inner, interceptor))
60        }
61        /// Compress requests with the given encoding.
62        /// This requires the server to support it otherwise it might respond with an
63        /// error.
64        #[must_use]
65        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
66            self.inner = self.inner.send_compressed(encoding);
67            self
68        }
69        /// Enable decompressing responses.
70        #[must_use]
71        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
72            self.inner = self.inner.accept_compressed(encoding);
73            self
74        }
75        /// Limits the maximum size of a decoded message.
76        /// Default: `4MB`
77        #[must_use]
78        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
79            self.inner = self.inner.max_decoding_message_size(limit);
80            self
81        }
82        /// Limits the maximum size of an encoded message.
83        /// Default: `usize::MAX`
84        #[must_use]
85        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
86            self.inner = self.inner.max_encoding_message_size(limit);
87            self
88        }
89        /// *
90        /// Bidirectional stream used to establish a session with a coordination node
91        /// Relevant APIs for managing semaphores, distributed locking, creating or
92        /// restoring a previously established session are described using nested
93        /// messages in SessionRequest and SessionResponse. Session is established
94        /// with a specific coordination node (previously created using CreateNode
95        /// below) and semaphores are local to that coordination node.
96        pub async fn session(
97            &mut self,
98            request: impl tonic::IntoStreamingRequest<Message = super::super::SessionRequest>,
99        ) -> std::result::Result<
100            tonic::Response<tonic::codec::Streaming<super::super::SessionResponse>>,
101            tonic::Status,
102        > {
103            self.inner.ready().await.map_err(|e| {
104                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
105            })?;
106            let codec = tonic_prost::ProstCodec::default();
107            let path = http::uri::PathAndQuery::from_static(
108                "/Ydb.Coordination.V1.CoordinationService/Session",
109            );
110            let mut req = request.into_streaming_request();
111            req.extensions_mut().insert(GrpcMethod::new(
112                "Ydb.Coordination.V1.CoordinationService",
113                "Session",
114            ));
115            self.inner.streaming(req, path, codec).await
116        }
117        /// Creates a new coordination node
118        pub async fn create_node(
119            &mut self,
120            request: impl tonic::IntoRequest<super::super::CreateNodeRequest>,
121        ) -> std::result::Result<tonic::Response<super::super::CreateNodeResponse>, tonic::Status>
122        {
123            self.inner.ready().await.map_err(|e| {
124                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
125            })?;
126            let codec = tonic_prost::ProstCodec::default();
127            let path = http::uri::PathAndQuery::from_static(
128                "/Ydb.Coordination.V1.CoordinationService/CreateNode",
129            );
130            let mut req = request.into_request();
131            req.extensions_mut().insert(GrpcMethod::new(
132                "Ydb.Coordination.V1.CoordinationService",
133                "CreateNode",
134            ));
135            self.inner.unary(req, path, codec).await
136        }
137        /// Modifies settings of a coordination node
138        pub async fn alter_node(
139            &mut self,
140            request: impl tonic::IntoRequest<super::super::AlterNodeRequest>,
141        ) -> std::result::Result<tonic::Response<super::super::AlterNodeResponse>, tonic::Status>
142        {
143            self.inner.ready().await.map_err(|e| {
144                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
145            })?;
146            let codec = tonic_prost::ProstCodec::default();
147            let path = http::uri::PathAndQuery::from_static(
148                "/Ydb.Coordination.V1.CoordinationService/AlterNode",
149            );
150            let mut req = request.into_request();
151            req.extensions_mut().insert(GrpcMethod::new(
152                "Ydb.Coordination.V1.CoordinationService",
153                "AlterNode",
154            ));
155            self.inner.unary(req, path, codec).await
156        }
157        /// Drops a coordination node
158        pub async fn drop_node(
159            &mut self,
160            request: impl tonic::IntoRequest<super::super::DropNodeRequest>,
161        ) -> std::result::Result<tonic::Response<super::super::DropNodeResponse>, tonic::Status>
162        {
163            self.inner.ready().await.map_err(|e| {
164                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
165            })?;
166            let codec = tonic_prost::ProstCodec::default();
167            let path = http::uri::PathAndQuery::from_static(
168                "/Ydb.Coordination.V1.CoordinationService/DropNode",
169            );
170            let mut req = request.into_request();
171            req.extensions_mut().insert(GrpcMethod::new(
172                "Ydb.Coordination.V1.CoordinationService",
173                "DropNode",
174            ));
175            self.inner.unary(req, path, codec).await
176        }
177        /// Describes a coordination node
178        pub async fn describe_node(
179            &mut self,
180            request: impl tonic::IntoRequest<super::super::DescribeNodeRequest>,
181        ) -> std::result::Result<tonic::Response<super::super::DescribeNodeResponse>, tonic::Status>
182        {
183            self.inner.ready().await.map_err(|e| {
184                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
185            })?;
186            let codec = tonic_prost::ProstCodec::default();
187            let path = http::uri::PathAndQuery::from_static(
188                "/Ydb.Coordination.V1.CoordinationService/DescribeNode",
189            );
190            let mut req = request.into_request();
191            req.extensions_mut().insert(GrpcMethod::new(
192                "Ydb.Coordination.V1.CoordinationService",
193                "DescribeNode",
194            ));
195            self.inner.unary(req, path, codec).await
196        }
197    }
198}