d_engine_proto/generated/
d_engine.server.cluster.rs

1// This file is @generated by prost-build.
2/// Configuration change request specifies the operation type
3#[derive(serde::Serialize, serde::Deserialize)]
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct ClusterConfChangeRequest {
6    /// the request sender id, (might be fake leader or real leader)
7    #[prost(uint32, tag = "1")]
8    pub id: u32,
9    /// leader term
10    #[prost(uint64, tag = "2")]
11    pub term: u64,
12    /// so follower can redirect clients
13    /// when receiver receives the configure, they need compare the version
14    /// value is timestamp by default.
15    #[prost(uint64, tag = "3")]
16    pub version: u64,
17    #[prost(message, optional, tag = "4")]
18    pub change: ::core::option::Option<super::super::common::MembershipChange>,
19}
20#[derive(serde::Serialize, serde::Deserialize)]
21#[derive(Clone, Copy, PartialEq, ::prost::Message)]
22pub struct ClusterConfUpdateResponse {
23    /// record down the response owner id
24    #[prost(uint32, tag = "1")]
25    pub id: u32,
26    #[prost(uint64, tag = "2")]
27    pub term: u64,
28    #[prost(uint64, tag = "3")]
29    pub version: u64,
30    #[prost(bool, tag = "4")]
31    pub success: bool,
32    #[prost(enumeration = "cluster_conf_update_response::ErrorCode", tag = "5")]
33    pub error_code: i32,
34}
35/// Nested message and enum types in `ClusterConfUpdateResponse`.
36pub mod cluster_conf_update_response {
37    #[derive(serde::Serialize, serde::Deserialize)]
38    #[derive(
39        Clone,
40        Copy,
41        Debug,
42        PartialEq,
43        Eq,
44        Hash,
45        PartialOrd,
46        Ord,
47        ::prost::Enumeration
48    )]
49    #[repr(i32)]
50    pub enum ErrorCode {
51        None = 0,
52        /// Request sent to non-leader
53        NotLeader = 1,
54        /// Stale configuration version
55        VersionConflict = 2,
56        /// Stale leader term
57        TermOutdated = 3,
58        /// Malformed change request
59        InvalidChange = 4,
60        /// Server-side processing error
61        InternalError = 5,
62    }
63    impl ErrorCode {
64        /// String value of the enum field names used in the ProtoBuf definition.
65        ///
66        /// The values are not transformed in any way and thus are considered stable
67        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
68        pub fn as_str_name(&self) -> &'static str {
69            match self {
70                Self::None => "NONE",
71                Self::NotLeader => "NOT_LEADER",
72                Self::VersionConflict => "VERSION_CONFLICT",
73                Self::TermOutdated => "TERM_OUTDATED",
74                Self::InvalidChange => "INVALID_CHANGE",
75                Self::InternalError => "INTERNAL_ERROR",
76            }
77        }
78        /// Creates an enum from field names used in the ProtoBuf definition.
79        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
80            match value {
81                "NONE" => Some(Self::None),
82                "NOT_LEADER" => Some(Self::NotLeader),
83                "VERSION_CONFLICT" => Some(Self::VersionConflict),
84                "TERM_OUTDATED" => Some(Self::TermOutdated),
85                "INVALID_CHANGE" => Some(Self::InvalidChange),
86                "INTERNAL_ERROR" => Some(Self::InternalError),
87                _ => None,
88            }
89        }
90    }
91}
92#[derive(serde::Serialize, serde::Deserialize)]
93#[derive(Clone, Copy, PartialEq, ::prost::Message)]
94pub struct MetadataRequest {}
95#[derive(serde::Serialize, serde::Deserialize)]
96#[derive(Clone, PartialEq, ::prost::Message)]
97pub struct ClusterMembership {
98    #[prost(uint64, tag = "1")]
99    pub version: u64,
100    #[prost(message, repeated, tag = "2")]
101    pub nodes: ::prost::alloc::vec::Vec<NodeMeta>,
102    /// Current leader ID - dynamic runtime info
103    /// None (absent): leader unknown or still electing
104    /// Some(id): id is the current leader node ID
105    #[prost(uint32, optional, tag = "3")]
106    pub current_leader_id: ::core::option::Option<u32>,
107}
108#[derive(serde::Serialize, serde::Deserialize)]
109#[derive(Clone, PartialEq, ::prost::Message)]
110pub struct NodeMeta {
111    #[prost(uint32, tag = "1")]
112    pub id: u32,
113    /// "ip:port"
114    #[prost(string, tag = "2")]
115    pub address: ::prost::alloc::string::String,
116    #[prost(int32, tag = "3")]
117    pub role: i32,
118    /// Add new status fields (such as active/draining)
119    #[prost(enumeration = "super::super::common::NodeStatus", tag = "4")]
120    pub status: i32,
121}
122/// Request from new node to join the cluster
123#[derive(serde::Serialize, serde::Deserialize)]
124#[derive(Clone, PartialEq, ::prost::Message)]
125pub struct JoinRequest {
126    /// Unique ID for the new node
127    #[prost(uint32, tag = "1")]
128    pub node_id: u32,
129    /// Role for the new node
130    #[prost(int32, tag = "2")]
131    pub node_role: i32,
132    /// Network address of the new node
133    #[prost(string, tag = "3")]
134    pub address: ::prost::alloc::string::String,
135    /// Desired status of the node (PROMOTABLE or READ_ONLY)
136    #[prost(enumeration = "super::super::common::NodeStatus", tag = "4")]
137    pub status: i32,
138}
139#[derive(serde::Serialize, serde::Deserialize)]
140#[derive(Clone, PartialEq, ::prost::Message)]
141pub struct JoinResponse {
142    /// Returns true if joining is successful, false otherwise
143    #[prost(bool, tag = "1")]
144    pub success: bool,
145    /// Error message (if any)
146    #[prost(string, tag = "2")]
147    pub error: ::prost::alloc::string::String,
148    /// Current cluster configuration (including all nodes and roles)
149    #[prost(message, optional, tag = "3")]
150    pub config: ::core::option::Option<ClusterMembership>,
151    /// Current cluster configuration version (new nodes must save this version number and bring it with subsequent requests)
152    #[prost(uint64, tag = "4")]
153    pub config_version: u64,
154    /// If the new node needs to receive a snapshot, this field contains the snapshot metadata
155    /// If no snapshot is needed, this field is empty
156    #[prost(message, optional, tag = "5")]
157    pub snapshot_metadata: ::core::option::Option<super::storage::SnapshotMetadata>,
158    /// The ID of the current leader (if it exists), the new node can connect to the leader to get the snapshot
159    #[prost(uint32, tag = "6")]
160    pub leader_id: u32,
161}
162/// New messages
163#[derive(serde::Serialize, serde::Deserialize)]
164#[derive(Clone, PartialEq, ::prost::Message)]
165pub struct LeaderDiscoveryRequest {
166    /// Requester's node ID
167    #[prost(uint32, tag = "1")]
168    pub node_id: u32,
169    /// Requester's address
170    #[prost(string, tag = "2")]
171    pub requester_address: ::prost::alloc::string::String,
172}
173#[derive(serde::Serialize, serde::Deserialize)]
174#[derive(Clone, PartialEq, ::prost::Message)]
175pub struct LeaderDiscoveryResponse {
176    /// Current leader's node ID (0 if unknown)
177    #[prost(uint32, tag = "1")]
178    pub leader_id: u32,
179    /// Current leader's address (empty if unknown)
180    #[prost(string, tag = "2")]
181    pub leader_address: ::prost::alloc::string::String,
182    /// Current term
183    #[prost(uint64, tag = "3")]
184    pub term: u64,
185}
186#[derive(serde::Serialize, serde::Deserialize)]
187#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
188#[repr(i32)]
189pub enum ConfigState {
190    /// Stable state - cluster uses a single configuration
191    Stable = 0,
192    /// Configuration Transition State - The cluster is applying configuration changes
193    ConfigTransition = 1,
194    /// Election State - The cluster is in the process of leader election
195    ElectionInProgress = 2,
196}
197impl ConfigState {
198    /// String value of the enum field names used in the ProtoBuf definition.
199    ///
200    /// The values are not transformed in any way and thus are considered stable
201    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
202    pub fn as_str_name(&self) -> &'static str {
203        match self {
204            Self::Stable => "STABLE",
205            Self::ConfigTransition => "CONFIG_TRANSITION",
206            Self::ElectionInProgress => "ELECTION_IN_PROGRESS",
207        }
208    }
209    /// Creates an enum from field names used in the ProtoBuf definition.
210    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
211        match value {
212            "STABLE" => Some(Self::Stable),
213            "CONFIG_TRANSITION" => Some(Self::ConfigTransition),
214            "ELECTION_IN_PROGRESS" => Some(Self::ElectionInProgress),
215            _ => None,
216        }
217    }
218}
219/// Generated client implementations.
220pub mod cluster_management_service_client {
221    #![allow(
222        unused_variables,
223        dead_code,
224        missing_docs,
225        clippy::wildcard_imports,
226        clippy::let_unit_value,
227    )]
228    use tonic::codegen::*;
229    use tonic::codegen::http::Uri;
230    #[derive(Debug, Clone)]
231    pub struct ClusterManagementServiceClient<T> {
232        inner: tonic::client::Grpc<T>,
233    }
234    impl ClusterManagementServiceClient<tonic::transport::Channel> {
235        /// Attempt to create a new client by connecting to a given endpoint.
236        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
237        where
238            D: TryInto<tonic::transport::Endpoint>,
239            D::Error: Into<StdError>,
240        {
241            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
242            Ok(Self::new(conn))
243        }
244    }
245    impl<T> ClusterManagementServiceClient<T>
246    where
247        T: tonic::client::GrpcService<tonic::body::BoxBody>,
248        T::Error: Into<StdError>,
249        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
250        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
251    {
252        pub fn new(inner: T) -> Self {
253            let inner = tonic::client::Grpc::new(inner);
254            Self { inner }
255        }
256        pub fn with_origin(inner: T, origin: Uri) -> Self {
257            let inner = tonic::client::Grpc::with_origin(inner, origin);
258            Self { inner }
259        }
260        pub fn with_interceptor<F>(
261            inner: T,
262            interceptor: F,
263        ) -> ClusterManagementServiceClient<InterceptedService<T, F>>
264        where
265            F: tonic::service::Interceptor,
266            T::ResponseBody: Default,
267            T: tonic::codegen::Service<
268                http::Request<tonic::body::BoxBody>,
269                Response = http::Response<
270                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
271                >,
272            >,
273            <T as tonic::codegen::Service<
274                http::Request<tonic::body::BoxBody>,
275            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
276        {
277            ClusterManagementServiceClient::new(
278                InterceptedService::new(inner, interceptor),
279            )
280        }
281        /// Compress requests with the given encoding.
282        ///
283        /// This requires the server to support it otherwise it might respond with an
284        /// error.
285        #[must_use]
286        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
287            self.inner = self.inner.send_compressed(encoding);
288            self
289        }
290        /// Enable decompressing responses.
291        #[must_use]
292        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
293            self.inner = self.inner.accept_compressed(encoding);
294            self
295        }
296        /// Limits the maximum size of a decoded message.
297        ///
298        /// Default: `4MB`
299        #[must_use]
300        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
301            self.inner = self.inner.max_decoding_message_size(limit);
302            self
303        }
304        /// Limits the maximum size of an encoded message.
305        ///
306        /// Default: `usize::MAX`
307        #[must_use]
308        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
309            self.inner = self.inner.max_encoding_message_size(limit);
310            self
311        }
312        pub async fn update_cluster_conf(
313            &mut self,
314            request: impl tonic::IntoRequest<super::ClusterConfChangeRequest>,
315        ) -> std::result::Result<
316            tonic::Response<super::ClusterConfUpdateResponse>,
317            tonic::Status,
318        > {
319            self.inner
320                .ready()
321                .await
322                .map_err(|e| {
323                    tonic::Status::unknown(
324                        format!("Service was not ready: {}", e.into()),
325                    )
326                })?;
327            let codec = tonic::codec::ProstCodec::default();
328            let path = http::uri::PathAndQuery::from_static(
329                "/d_engine.server.cluster.ClusterManagementService/UpdateClusterConf",
330            );
331            let mut req = request.into_request();
332            req.extensions_mut()
333                .insert(
334                    GrpcMethod::new(
335                        "d_engine.server.cluster.ClusterManagementService",
336                        "UpdateClusterConf",
337                    ),
338                );
339            self.inner.unary(req, path, codec).await
340        }
341        pub async fn get_cluster_metadata(
342            &mut self,
343            request: impl tonic::IntoRequest<super::MetadataRequest>,
344        ) -> std::result::Result<
345            tonic::Response<super::ClusterMembership>,
346            tonic::Status,
347        > {
348            self.inner
349                .ready()
350                .await
351                .map_err(|e| {
352                    tonic::Status::unknown(
353                        format!("Service was not ready: {}", e.into()),
354                    )
355                })?;
356            let codec = tonic::codec::ProstCodec::default();
357            let path = http::uri::PathAndQuery::from_static(
358                "/d_engine.server.cluster.ClusterManagementService/GetClusterMetadata",
359            );
360            let mut req = request.into_request();
361            req.extensions_mut()
362                .insert(
363                    GrpcMethod::new(
364                        "d_engine.server.cluster.ClusterManagementService",
365                        "GetClusterMetadata",
366                    ),
367                );
368            self.inner.unary(req, path, codec).await
369        }
370        /// Request to join the cluster as a new learner node
371        pub async fn join_cluster(
372            &mut self,
373            request: impl tonic::IntoRequest<super::JoinRequest>,
374        ) -> std::result::Result<tonic::Response<super::JoinResponse>, tonic::Status> {
375            self.inner
376                .ready()
377                .await
378                .map_err(|e| {
379                    tonic::Status::unknown(
380                        format!("Service was not ready: {}", e.into()),
381                    )
382                })?;
383            let codec = tonic::codec::ProstCodec::default();
384            let path = http::uri::PathAndQuery::from_static(
385                "/d_engine.server.cluster.ClusterManagementService/JoinCluster",
386            );
387            let mut req = request.into_request();
388            req.extensions_mut()
389                .insert(
390                    GrpcMethod::new(
391                        "d_engine.server.cluster.ClusterManagementService",
392                        "JoinCluster",
393                    ),
394                );
395            self.inner.unary(req, path, codec).await
396        }
397        /// New RPC for leader discovery
398        pub async fn discover_leader(
399            &mut self,
400            request: impl tonic::IntoRequest<super::LeaderDiscoveryRequest>,
401        ) -> std::result::Result<
402            tonic::Response<super::LeaderDiscoveryResponse>,
403            tonic::Status,
404        > {
405            self.inner
406                .ready()
407                .await
408                .map_err(|e| {
409                    tonic::Status::unknown(
410                        format!("Service was not ready: {}", e.into()),
411                    )
412                })?;
413            let codec = tonic::codec::ProstCodec::default();
414            let path = http::uri::PathAndQuery::from_static(
415                "/d_engine.server.cluster.ClusterManagementService/DiscoverLeader",
416            );
417            let mut req = request.into_request();
418            req.extensions_mut()
419                .insert(
420                    GrpcMethod::new(
421                        "d_engine.server.cluster.ClusterManagementService",
422                        "DiscoverLeader",
423                    ),
424                );
425            self.inner.unary(req, path, codec).await
426        }
427    }
428}
429/// Generated server implementations.
430pub mod cluster_management_service_server {
431    #![allow(
432        unused_variables,
433        dead_code,
434        missing_docs,
435        clippy::wildcard_imports,
436        clippy::let_unit_value,
437    )]
438    use tonic::codegen::*;
439    /// Generated trait containing gRPC methods that should be implemented for use with ClusterManagementServiceServer.
440    #[async_trait]
441    pub trait ClusterManagementService: std::marker::Send + std::marker::Sync + 'static {
442        async fn update_cluster_conf(
443            &self,
444            request: tonic::Request<super::ClusterConfChangeRequest>,
445        ) -> std::result::Result<
446            tonic::Response<super::ClusterConfUpdateResponse>,
447            tonic::Status,
448        >;
449        async fn get_cluster_metadata(
450            &self,
451            request: tonic::Request<super::MetadataRequest>,
452        ) -> std::result::Result<
453            tonic::Response<super::ClusterMembership>,
454            tonic::Status,
455        >;
456        /// Request to join the cluster as a new learner node
457        async fn join_cluster(
458            &self,
459            request: tonic::Request<super::JoinRequest>,
460        ) -> std::result::Result<tonic::Response<super::JoinResponse>, tonic::Status>;
461        /// New RPC for leader discovery
462        async fn discover_leader(
463            &self,
464            request: tonic::Request<super::LeaderDiscoveryRequest>,
465        ) -> std::result::Result<
466            tonic::Response<super::LeaderDiscoveryResponse>,
467            tonic::Status,
468        >;
469    }
470    #[derive(Debug)]
471    pub struct ClusterManagementServiceServer<T> {
472        inner: Arc<T>,
473        accept_compression_encodings: EnabledCompressionEncodings,
474        send_compression_encodings: EnabledCompressionEncodings,
475        max_decoding_message_size: Option<usize>,
476        max_encoding_message_size: Option<usize>,
477    }
478    impl<T> ClusterManagementServiceServer<T> {
479        pub fn new(inner: T) -> Self {
480            Self::from_arc(Arc::new(inner))
481        }
482        pub fn from_arc(inner: Arc<T>) -> Self {
483            Self {
484                inner,
485                accept_compression_encodings: Default::default(),
486                send_compression_encodings: Default::default(),
487                max_decoding_message_size: None,
488                max_encoding_message_size: None,
489            }
490        }
491        pub fn with_interceptor<F>(
492            inner: T,
493            interceptor: F,
494        ) -> InterceptedService<Self, F>
495        where
496            F: tonic::service::Interceptor,
497        {
498            InterceptedService::new(Self::new(inner), interceptor)
499        }
500        /// Enable decompressing requests with the given encoding.
501        #[must_use]
502        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
503            self.accept_compression_encodings.enable(encoding);
504            self
505        }
506        /// Compress responses with the given encoding, if the client supports it.
507        #[must_use]
508        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
509            self.send_compression_encodings.enable(encoding);
510            self
511        }
512        /// Limits the maximum size of a decoded message.
513        ///
514        /// Default: `4MB`
515        #[must_use]
516        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
517            self.max_decoding_message_size = Some(limit);
518            self
519        }
520        /// Limits the maximum size of an encoded message.
521        ///
522        /// Default: `usize::MAX`
523        #[must_use]
524        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
525            self.max_encoding_message_size = Some(limit);
526            self
527        }
528    }
529    impl<T, B> tonic::codegen::Service<http::Request<B>>
530    for ClusterManagementServiceServer<T>
531    where
532        T: ClusterManagementService,
533        B: Body + std::marker::Send + 'static,
534        B::Error: Into<StdError> + std::marker::Send + 'static,
535    {
536        type Response = http::Response<tonic::body::BoxBody>;
537        type Error = std::convert::Infallible;
538        type Future = BoxFuture<Self::Response, Self::Error>;
539        fn poll_ready(
540            &mut self,
541            _cx: &mut Context<'_>,
542        ) -> Poll<std::result::Result<(), Self::Error>> {
543            Poll::Ready(Ok(()))
544        }
545        fn call(&mut self, req: http::Request<B>) -> Self::Future {
546            match req.uri().path() {
547                "/d_engine.server.cluster.ClusterManagementService/UpdateClusterConf" => {
548                    #[allow(non_camel_case_types)]
549                    struct UpdateClusterConfSvc<T: ClusterManagementService>(pub Arc<T>);
550                    impl<
551                        T: ClusterManagementService,
552                    > tonic::server::UnaryService<super::ClusterConfChangeRequest>
553                    for UpdateClusterConfSvc<T> {
554                        type Response = super::ClusterConfUpdateResponse;
555                        type Future = BoxFuture<
556                            tonic::Response<Self::Response>,
557                            tonic::Status,
558                        >;
559                        fn call(
560                            &mut self,
561                            request: tonic::Request<super::ClusterConfChangeRequest>,
562                        ) -> Self::Future {
563                            let inner = Arc::clone(&self.0);
564                            let fut = async move {
565                                <T as ClusterManagementService>::update_cluster_conf(
566                                        &inner,
567                                        request,
568                                    )
569                                    .await
570                            };
571                            Box::pin(fut)
572                        }
573                    }
574                    let accept_compression_encodings = self.accept_compression_encodings;
575                    let send_compression_encodings = self.send_compression_encodings;
576                    let max_decoding_message_size = self.max_decoding_message_size;
577                    let max_encoding_message_size = self.max_encoding_message_size;
578                    let inner = self.inner.clone();
579                    let fut = async move {
580                        let method = UpdateClusterConfSvc(inner);
581                        let codec = tonic::codec::ProstCodec::default();
582                        let mut grpc = tonic::server::Grpc::new(codec)
583                            .apply_compression_config(
584                                accept_compression_encodings,
585                                send_compression_encodings,
586                            )
587                            .apply_max_message_size_config(
588                                max_decoding_message_size,
589                                max_encoding_message_size,
590                            );
591                        let res = grpc.unary(method, req).await;
592                        Ok(res)
593                    };
594                    Box::pin(fut)
595                }
596                "/d_engine.server.cluster.ClusterManagementService/GetClusterMetadata" => {
597                    #[allow(non_camel_case_types)]
598                    struct GetClusterMetadataSvc<T: ClusterManagementService>(
599                        pub Arc<T>,
600                    );
601                    impl<
602                        T: ClusterManagementService,
603                    > tonic::server::UnaryService<super::MetadataRequest>
604                    for GetClusterMetadataSvc<T> {
605                        type Response = super::ClusterMembership;
606                        type Future = BoxFuture<
607                            tonic::Response<Self::Response>,
608                            tonic::Status,
609                        >;
610                        fn call(
611                            &mut self,
612                            request: tonic::Request<super::MetadataRequest>,
613                        ) -> Self::Future {
614                            let inner = Arc::clone(&self.0);
615                            let fut = async move {
616                                <T as ClusterManagementService>::get_cluster_metadata(
617                                        &inner,
618                                        request,
619                                    )
620                                    .await
621                            };
622                            Box::pin(fut)
623                        }
624                    }
625                    let accept_compression_encodings = self.accept_compression_encodings;
626                    let send_compression_encodings = self.send_compression_encodings;
627                    let max_decoding_message_size = self.max_decoding_message_size;
628                    let max_encoding_message_size = self.max_encoding_message_size;
629                    let inner = self.inner.clone();
630                    let fut = async move {
631                        let method = GetClusterMetadataSvc(inner);
632                        let codec = tonic::codec::ProstCodec::default();
633                        let mut grpc = tonic::server::Grpc::new(codec)
634                            .apply_compression_config(
635                                accept_compression_encodings,
636                                send_compression_encodings,
637                            )
638                            .apply_max_message_size_config(
639                                max_decoding_message_size,
640                                max_encoding_message_size,
641                            );
642                        let res = grpc.unary(method, req).await;
643                        Ok(res)
644                    };
645                    Box::pin(fut)
646                }
647                "/d_engine.server.cluster.ClusterManagementService/JoinCluster" => {
648                    #[allow(non_camel_case_types)]
649                    struct JoinClusterSvc<T: ClusterManagementService>(pub Arc<T>);
650                    impl<
651                        T: ClusterManagementService,
652                    > tonic::server::UnaryService<super::JoinRequest>
653                    for JoinClusterSvc<T> {
654                        type Response = super::JoinResponse;
655                        type Future = BoxFuture<
656                            tonic::Response<Self::Response>,
657                            tonic::Status,
658                        >;
659                        fn call(
660                            &mut self,
661                            request: tonic::Request<super::JoinRequest>,
662                        ) -> Self::Future {
663                            let inner = Arc::clone(&self.0);
664                            let fut = async move {
665                                <T as ClusterManagementService>::join_cluster(
666                                        &inner,
667                                        request,
668                                    )
669                                    .await
670                            };
671                            Box::pin(fut)
672                        }
673                    }
674                    let accept_compression_encodings = self.accept_compression_encodings;
675                    let send_compression_encodings = self.send_compression_encodings;
676                    let max_decoding_message_size = self.max_decoding_message_size;
677                    let max_encoding_message_size = self.max_encoding_message_size;
678                    let inner = self.inner.clone();
679                    let fut = async move {
680                        let method = JoinClusterSvc(inner);
681                        let codec = tonic::codec::ProstCodec::default();
682                        let mut grpc = tonic::server::Grpc::new(codec)
683                            .apply_compression_config(
684                                accept_compression_encodings,
685                                send_compression_encodings,
686                            )
687                            .apply_max_message_size_config(
688                                max_decoding_message_size,
689                                max_encoding_message_size,
690                            );
691                        let res = grpc.unary(method, req).await;
692                        Ok(res)
693                    };
694                    Box::pin(fut)
695                }
696                "/d_engine.server.cluster.ClusterManagementService/DiscoverLeader" => {
697                    #[allow(non_camel_case_types)]
698                    struct DiscoverLeaderSvc<T: ClusterManagementService>(pub Arc<T>);
699                    impl<
700                        T: ClusterManagementService,
701                    > tonic::server::UnaryService<super::LeaderDiscoveryRequest>
702                    for DiscoverLeaderSvc<T> {
703                        type Response = super::LeaderDiscoveryResponse;
704                        type Future = BoxFuture<
705                            tonic::Response<Self::Response>,
706                            tonic::Status,
707                        >;
708                        fn call(
709                            &mut self,
710                            request: tonic::Request<super::LeaderDiscoveryRequest>,
711                        ) -> Self::Future {
712                            let inner = Arc::clone(&self.0);
713                            let fut = async move {
714                                <T as ClusterManagementService>::discover_leader(
715                                        &inner,
716                                        request,
717                                    )
718                                    .await
719                            };
720                            Box::pin(fut)
721                        }
722                    }
723                    let accept_compression_encodings = self.accept_compression_encodings;
724                    let send_compression_encodings = self.send_compression_encodings;
725                    let max_decoding_message_size = self.max_decoding_message_size;
726                    let max_encoding_message_size = self.max_encoding_message_size;
727                    let inner = self.inner.clone();
728                    let fut = async move {
729                        let method = DiscoverLeaderSvc(inner);
730                        let codec = tonic::codec::ProstCodec::default();
731                        let mut grpc = tonic::server::Grpc::new(codec)
732                            .apply_compression_config(
733                                accept_compression_encodings,
734                                send_compression_encodings,
735                            )
736                            .apply_max_message_size_config(
737                                max_decoding_message_size,
738                                max_encoding_message_size,
739                            );
740                        let res = grpc.unary(method, req).await;
741                        Ok(res)
742                    };
743                    Box::pin(fut)
744                }
745                _ => {
746                    Box::pin(async move {
747                        let mut response = http::Response::new(empty_body());
748                        let headers = response.headers_mut();
749                        headers
750                            .insert(
751                                tonic::Status::GRPC_STATUS,
752                                (tonic::Code::Unimplemented as i32).into(),
753                            );
754                        headers
755                            .insert(
756                                http::header::CONTENT_TYPE,
757                                tonic::metadata::GRPC_CONTENT_TYPE,
758                            );
759                        Ok(response)
760                    })
761                }
762            }
763        }
764    }
765    impl<T> Clone for ClusterManagementServiceServer<T> {
766        fn clone(&self) -> Self {
767            let inner = self.inner.clone();
768            Self {
769                inner,
770                accept_compression_encodings: self.accept_compression_encodings,
771                send_compression_encodings: self.send_compression_encodings,
772                max_decoding_message_size: self.max_decoding_message_size,
773                max_encoding_message_size: self.max_encoding_message_size,
774            }
775        }
776    }
777    /// Generated gRPC service name
778    pub const SERVICE_NAME: &str = "d_engine.server.cluster.ClusterManagementService";
779    impl<T> tonic::server::NamedService for ClusterManagementServiceServer<T> {
780        const NAME: &'static str = SERVICE_NAME;
781    }
782}