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