Mountain/Vine/Generated/
vine_ipc.rs

1// This file is @generated by prost-build.
2/// Represents an empty message, typically used for RPCs that don't need to return data.
3#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4pub struct Empty {}
5/// A generic request message containing a method name and serialized parameters.
6#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
7pub struct GenericRequest {
8    #[prost(uint64, tag = "1")]
9    pub request_identifier: u64,
10    #[prost(string, tag = "2")]
11    pub method: ::prost::alloc::string::String,
12    /// Parameters are expected to be a JSON-serialized byte array.
13    #[prost(bytes = "vec", tag = "3")]
14    pub parameter: ::prost::alloc::vec::Vec<u8>,
15}
16/// A generic response message containing the result or an error.
17#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
18pub struct GenericResponse {
19    #[prost(uint64, tag = "1")]
20    pub request_identifier: u64,
21    /// The successful result, JSON-serialized.
22    #[prost(bytes = "vec", tag = "2")]
23    pub result: ::prost::alloc::vec::Vec<u8>,
24    #[prost(message, optional, tag = "3")]
25    pub error: ::core::option::Option<RpcError>,
26}
27/// A generic notification message, which is fire-and-forget and does not have an ID.
28#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
29pub struct GenericNotification {
30    #[prost(string, tag = "1")]
31    pub method: ::prost::alloc::string::String,
32    /// Parameters are expected to be a JSON-serialized byte array.
33    #[prost(bytes = "vec", tag = "2")]
34    pub parameter: ::prost::alloc::vec::Vec<u8>,
35}
36/// A structured error payload, compliant with JSON-RPC error objects.
37#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
38pub struct RpcError {
39    #[prost(int32, tag = "1")]
40    pub code: i32,
41    #[prost(string, tag = "2")]
42    pub message: ::prost::alloc::string::String,
43    /// Optional, additional error data, JSON-serialized.
44    #[prost(bytes = "vec", tag = "3")]
45    pub data: ::prost::alloc::vec::Vec<u8>,
46}
47/// A message to cancel a specific, ongoing operation.
48#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
49pub struct CancelOperationRequest {
50    #[prost(uint64, tag = "1")]
51    pub request_identifier_to_cancel: u64,
52}
53/// A generic data payload, currently unused but available for future extensions.
54#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
55pub struct RpcDataPayload {
56    #[prost(bytes = "vec", tag = "1")]
57    pub data: ::prost::alloc::vec::Vec<u8>,
58}
59/// Generated client implementations.
60pub mod mountain_service_client {
61    #![allow(
62        unused_variables,
63        dead_code,
64        missing_docs,
65        clippy::wildcard_imports,
66        clippy::let_unit_value,
67    )]
68    use tonic::codegen::*;
69    use tonic::codegen::http::Uri;
70    /// Service running on the Mountain host, listening for requests from Cocoon.
71    #[derive(Debug, Clone)]
72    pub struct MountainServiceClient<T> {
73        inner: tonic::client::Grpc<T>,
74    }
75    impl MountainServiceClient<tonic::transport::Channel> {
76        /// Attempt to create a new client by connecting to a given endpoint.
77        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
78        where
79            D: TryInto<tonic::transport::Endpoint>,
80            D::Error: Into<StdError>,
81        {
82            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
83            Ok(Self::new(conn))
84        }
85    }
86    impl<T> MountainServiceClient<T>
87    where
88        T: tonic::client::GrpcService<tonic::body::Body>,
89        T::Error: Into<StdError>,
90        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
91        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
92    {
93        pub fn new(inner: T) -> Self {
94            let inner = tonic::client::Grpc::new(inner);
95            Self { inner }
96        }
97        pub fn with_origin(inner: T, origin: Uri) -> Self {
98            let inner = tonic::client::Grpc::with_origin(inner, origin);
99            Self { inner }
100        }
101        pub fn with_interceptor<F>(
102            inner: T,
103            interceptor: F,
104        ) -> MountainServiceClient<InterceptedService<T, F>>
105        where
106            F: tonic::service::Interceptor,
107            T::ResponseBody: Default,
108            T: tonic::codegen::Service<
109                http::Request<tonic::body::Body>,
110                Response = http::Response<
111                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
112                >,
113            >,
114            <T as tonic::codegen::Service<
115                http::Request<tonic::body::Body>,
116            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
117        {
118            MountainServiceClient::new(InterceptedService::new(inner, interceptor))
119        }
120        /// Compress requests with the given encoding.
121        ///
122        /// This requires the server to support it otherwise it might respond with an
123        /// error.
124        #[must_use]
125        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
126            self.inner = self.inner.send_compressed(encoding);
127            self
128        }
129        /// Enable decompressing responses.
130        #[must_use]
131        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
132            self.inner = self.inner.accept_compressed(encoding);
133            self
134        }
135        /// Limits the maximum size of a decoded message.
136        ///
137        /// Default: `4MB`
138        #[must_use]
139        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
140            self.inner = self.inner.max_decoding_message_size(limit);
141            self
142        }
143        /// Limits the maximum size of an encoded message.
144        ///
145        /// Default: `usize::MAX`
146        #[must_use]
147        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
148            self.inner = self.inner.max_encoding_message_size(limit);
149            self
150        }
151        /// A generic request-response method for Cocoon to call a function on Mountain.
152        pub async fn process_cocoon_request(
153            &mut self,
154            request: impl tonic::IntoRequest<super::GenericRequest>,
155        ) -> std::result::Result<
156            tonic::Response<super::GenericResponse>,
157            tonic::Status,
158        > {
159            self.inner
160                .ready()
161                .await
162                .map_err(|e| {
163                    tonic::Status::unknown(
164                        format!("Service was not ready: {}", e.into()),
165                    )
166                })?;
167            let codec = tonic_prost::ProstCodec::default();
168            let path = http::uri::PathAndQuery::from_static(
169                "/vine_ipc.MountainService/ProcessCocoonRequest",
170            );
171            let mut req = request.into_request();
172            req.extensions_mut()
173                .insert(
174                    GrpcMethod::new("vine_ipc.MountainService", "ProcessCocoonRequest"),
175                );
176            self.inner.unary(req, path, codec).await
177        }
178        /// A generic fire-and-forget method for Cocoon to send a notification to Mountain.
179        pub async fn send_cocoon_notification(
180            &mut self,
181            request: impl tonic::IntoRequest<super::GenericNotification>,
182        ) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status> {
183            self.inner
184                .ready()
185                .await
186                .map_err(|e| {
187                    tonic::Status::unknown(
188                        format!("Service was not ready: {}", e.into()),
189                    )
190                })?;
191            let codec = tonic_prost::ProstCodec::default();
192            let path = http::uri::PathAndQuery::from_static(
193                "/vine_ipc.MountainService/SendCocoonNotification",
194            );
195            let mut req = request.into_request();
196            req.extensions_mut()
197                .insert(
198                    GrpcMethod::new("vine_ipc.MountainService", "SendCocoonNotification"),
199                );
200            self.inner.unary(req, path, codec).await
201        }
202        /// A method for Cocoon to request that Mountain cancel a long-running operation.
203        pub async fn cancel_operation(
204            &mut self,
205            request: impl tonic::IntoRequest<super::CancelOperationRequest>,
206        ) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status> {
207            self.inner
208                .ready()
209                .await
210                .map_err(|e| {
211                    tonic::Status::unknown(
212                        format!("Service was not ready: {}", e.into()),
213                    )
214                })?;
215            let codec = tonic_prost::ProstCodec::default();
216            let path = http::uri::PathAndQuery::from_static(
217                "/vine_ipc.MountainService/CancelOperation",
218            );
219            let mut req = request.into_request();
220            req.extensions_mut()
221                .insert(GrpcMethod::new("vine_ipc.MountainService", "CancelOperation"));
222            self.inner.unary(req, path, codec).await
223        }
224    }
225}
226/// Generated server implementations.
227pub mod mountain_service_server {
228    #![allow(
229        unused_variables,
230        dead_code,
231        missing_docs,
232        clippy::wildcard_imports,
233        clippy::let_unit_value,
234    )]
235    use tonic::codegen::*;
236    /// Generated trait containing gRPC methods that should be implemented for use with MountainServiceServer.
237    #[async_trait]
238    pub trait MountainService: std::marker::Send + std::marker::Sync + 'static {
239        /// A generic request-response method for Cocoon to call a function on Mountain.
240        async fn process_cocoon_request(
241            &self,
242            request: tonic::Request<super::GenericRequest>,
243        ) -> std::result::Result<tonic::Response<super::GenericResponse>, tonic::Status>;
244        /// A generic fire-and-forget method for Cocoon to send a notification to Mountain.
245        async fn send_cocoon_notification(
246            &self,
247            request: tonic::Request<super::GenericNotification>,
248        ) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status>;
249        /// A method for Cocoon to request that Mountain cancel a long-running operation.
250        async fn cancel_operation(
251            &self,
252            request: tonic::Request<super::CancelOperationRequest>,
253        ) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status>;
254    }
255    /// Service running on the Mountain host, listening for requests from Cocoon.
256    #[derive(Debug)]
257    pub struct MountainServiceServer<T> {
258        inner: Arc<T>,
259        accept_compression_encodings: EnabledCompressionEncodings,
260        send_compression_encodings: EnabledCompressionEncodings,
261        max_decoding_message_size: Option<usize>,
262        max_encoding_message_size: Option<usize>,
263    }
264    impl<T> MountainServiceServer<T> {
265        pub fn new(inner: T) -> Self {
266            Self::from_arc(Arc::new(inner))
267        }
268        pub fn from_arc(inner: Arc<T>) -> Self {
269            Self {
270                inner,
271                accept_compression_encodings: Default::default(),
272                send_compression_encodings: Default::default(),
273                max_decoding_message_size: None,
274                max_encoding_message_size: None,
275            }
276        }
277        pub fn with_interceptor<F>(
278            inner: T,
279            interceptor: F,
280        ) -> InterceptedService<Self, F>
281        where
282            F: tonic::service::Interceptor,
283        {
284            InterceptedService::new(Self::new(inner), interceptor)
285        }
286        /// Enable decompressing requests with the given encoding.
287        #[must_use]
288        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
289            self.accept_compression_encodings.enable(encoding);
290            self
291        }
292        /// Compress responses with the given encoding, if the client supports it.
293        #[must_use]
294        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
295            self.send_compression_encodings.enable(encoding);
296            self
297        }
298        /// Limits the maximum size of a decoded message.
299        ///
300        /// Default: `4MB`
301        #[must_use]
302        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
303            self.max_decoding_message_size = Some(limit);
304            self
305        }
306        /// Limits the maximum size of an encoded message.
307        ///
308        /// Default: `usize::MAX`
309        #[must_use]
310        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
311            self.max_encoding_message_size = Some(limit);
312            self
313        }
314    }
315    impl<T, B> tonic::codegen::Service<http::Request<B>> for MountainServiceServer<T>
316    where
317        T: MountainService,
318        B: Body + std::marker::Send + 'static,
319        B::Error: Into<StdError> + std::marker::Send + 'static,
320    {
321        type Response = http::Response<tonic::body::Body>;
322        type Error = std::convert::Infallible;
323        type Future = BoxFuture<Self::Response, Self::Error>;
324        fn poll_ready(
325            &mut self,
326            _cx: &mut Context<'_>,
327        ) -> Poll<std::result::Result<(), Self::Error>> {
328            Poll::Ready(Ok(()))
329        }
330        fn call(&mut self, req: http::Request<B>) -> Self::Future {
331            match req.uri().path() {
332                "/vine_ipc.MountainService/ProcessCocoonRequest" => {
333                    #[allow(non_camel_case_types)]
334                    struct ProcessCocoonRequestSvc<T: MountainService>(pub Arc<T>);
335                    impl<
336                        T: MountainService,
337                    > tonic::server::UnaryService<super::GenericRequest>
338                    for ProcessCocoonRequestSvc<T> {
339                        type Response = super::GenericResponse;
340                        type Future = BoxFuture<
341                            tonic::Response<Self::Response>,
342                            tonic::Status,
343                        >;
344                        fn call(
345                            &mut self,
346                            request: tonic::Request<super::GenericRequest>,
347                        ) -> Self::Future {
348                            let inner = Arc::clone(&self.0);
349                            let fut = async move {
350                                <T as MountainService>::process_cocoon_request(
351                                        &inner,
352                                        request,
353                                    )
354                                    .await
355                            };
356                            Box::pin(fut)
357                        }
358                    }
359                    let accept_compression_encodings = self.accept_compression_encodings;
360                    let send_compression_encodings = self.send_compression_encodings;
361                    let max_decoding_message_size = self.max_decoding_message_size;
362                    let max_encoding_message_size = self.max_encoding_message_size;
363                    let inner = self.inner.clone();
364                    let fut = async move {
365                        let method = ProcessCocoonRequestSvc(inner);
366                        let codec = tonic_prost::ProstCodec::default();
367                        let mut grpc = tonic::server::Grpc::new(codec)
368                            .apply_compression_config(
369                                accept_compression_encodings,
370                                send_compression_encodings,
371                            )
372                            .apply_max_message_size_config(
373                                max_decoding_message_size,
374                                max_encoding_message_size,
375                            );
376                        let res = grpc.unary(method, req).await;
377                        Ok(res)
378                    };
379                    Box::pin(fut)
380                }
381                "/vine_ipc.MountainService/SendCocoonNotification" => {
382                    #[allow(non_camel_case_types)]
383                    struct SendCocoonNotificationSvc<T: MountainService>(pub Arc<T>);
384                    impl<
385                        T: MountainService,
386                    > tonic::server::UnaryService<super::GenericNotification>
387                    for SendCocoonNotificationSvc<T> {
388                        type Response = super::Empty;
389                        type Future = BoxFuture<
390                            tonic::Response<Self::Response>,
391                            tonic::Status,
392                        >;
393                        fn call(
394                            &mut self,
395                            request: tonic::Request<super::GenericNotification>,
396                        ) -> Self::Future {
397                            let inner = Arc::clone(&self.0);
398                            let fut = async move {
399                                <T as MountainService>::send_cocoon_notification(
400                                        &inner,
401                                        request,
402                                    )
403                                    .await
404                            };
405                            Box::pin(fut)
406                        }
407                    }
408                    let accept_compression_encodings = self.accept_compression_encodings;
409                    let send_compression_encodings = self.send_compression_encodings;
410                    let max_decoding_message_size = self.max_decoding_message_size;
411                    let max_encoding_message_size = self.max_encoding_message_size;
412                    let inner = self.inner.clone();
413                    let fut = async move {
414                        let method = SendCocoonNotificationSvc(inner);
415                        let codec = tonic_prost::ProstCodec::default();
416                        let mut grpc = tonic::server::Grpc::new(codec)
417                            .apply_compression_config(
418                                accept_compression_encodings,
419                                send_compression_encodings,
420                            )
421                            .apply_max_message_size_config(
422                                max_decoding_message_size,
423                                max_encoding_message_size,
424                            );
425                        let res = grpc.unary(method, req).await;
426                        Ok(res)
427                    };
428                    Box::pin(fut)
429                }
430                "/vine_ipc.MountainService/CancelOperation" => {
431                    #[allow(non_camel_case_types)]
432                    struct CancelOperationSvc<T: MountainService>(pub Arc<T>);
433                    impl<
434                        T: MountainService,
435                    > tonic::server::UnaryService<super::CancelOperationRequest>
436                    for CancelOperationSvc<T> {
437                        type Response = super::Empty;
438                        type Future = BoxFuture<
439                            tonic::Response<Self::Response>,
440                            tonic::Status,
441                        >;
442                        fn call(
443                            &mut self,
444                            request: tonic::Request<super::CancelOperationRequest>,
445                        ) -> Self::Future {
446                            let inner = Arc::clone(&self.0);
447                            let fut = async move {
448                                <T as MountainService>::cancel_operation(&inner, request)
449                                    .await
450                            };
451                            Box::pin(fut)
452                        }
453                    }
454                    let accept_compression_encodings = self.accept_compression_encodings;
455                    let send_compression_encodings = self.send_compression_encodings;
456                    let max_decoding_message_size = self.max_decoding_message_size;
457                    let max_encoding_message_size = self.max_encoding_message_size;
458                    let inner = self.inner.clone();
459                    let fut = async move {
460                        let method = CancelOperationSvc(inner);
461                        let codec = tonic_prost::ProstCodec::default();
462                        let mut grpc = tonic::server::Grpc::new(codec)
463                            .apply_compression_config(
464                                accept_compression_encodings,
465                                send_compression_encodings,
466                            )
467                            .apply_max_message_size_config(
468                                max_decoding_message_size,
469                                max_encoding_message_size,
470                            );
471                        let res = grpc.unary(method, req).await;
472                        Ok(res)
473                    };
474                    Box::pin(fut)
475                }
476                _ => {
477                    Box::pin(async move {
478                        let mut response = http::Response::new(
479                            tonic::body::Body::default(),
480                        );
481                        let headers = response.headers_mut();
482                        headers
483                            .insert(
484                                tonic::Status::GRPC_STATUS,
485                                (tonic::Code::Unimplemented as i32).into(),
486                            );
487                        headers
488                            .insert(
489                                http::header::CONTENT_TYPE,
490                                tonic::metadata::GRPC_CONTENT_TYPE,
491                            );
492                        Ok(response)
493                    })
494                }
495            }
496        }
497    }
498    impl<T> Clone for MountainServiceServer<T> {
499        fn clone(&self) -> Self {
500            let inner = self.inner.clone();
501            Self {
502                inner,
503                accept_compression_encodings: self.accept_compression_encodings,
504                send_compression_encodings: self.send_compression_encodings,
505                max_decoding_message_size: self.max_decoding_message_size,
506                max_encoding_message_size: self.max_encoding_message_size,
507            }
508        }
509    }
510    /// Generated gRPC service name
511    pub const SERVICE_NAME: &str = "vine_ipc.MountainService";
512    impl<T> tonic::server::NamedService for MountainServiceServer<T> {
513        const NAME: &'static str = SERVICE_NAME;
514    }
515}
516/// Generated client implementations.
517pub mod cocoon_service_client {
518    #![allow(
519        unused_variables,
520        dead_code,
521        missing_docs,
522        clippy::wildcard_imports,
523        clippy::let_unit_value,
524    )]
525    use tonic::codegen::*;
526    use tonic::codegen::http::Uri;
527    /// Service running on the Cocoon sidecar, listening for requests from Mountain.
528    #[derive(Debug, Clone)]
529    pub struct CocoonServiceClient<T> {
530        inner: tonic::client::Grpc<T>,
531    }
532    impl CocoonServiceClient<tonic::transport::Channel> {
533        /// Attempt to create a new client by connecting to a given endpoint.
534        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
535        where
536            D: TryInto<tonic::transport::Endpoint>,
537            D::Error: Into<StdError>,
538        {
539            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
540            Ok(Self::new(conn))
541        }
542    }
543    impl<T> CocoonServiceClient<T>
544    where
545        T: tonic::client::GrpcService<tonic::body::Body>,
546        T::Error: Into<StdError>,
547        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
548        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
549    {
550        pub fn new(inner: T) -> Self {
551            let inner = tonic::client::Grpc::new(inner);
552            Self { inner }
553        }
554        pub fn with_origin(inner: T, origin: Uri) -> Self {
555            let inner = tonic::client::Grpc::with_origin(inner, origin);
556            Self { inner }
557        }
558        pub fn with_interceptor<F>(
559            inner: T,
560            interceptor: F,
561        ) -> CocoonServiceClient<InterceptedService<T, F>>
562        where
563            F: tonic::service::Interceptor,
564            T::ResponseBody: Default,
565            T: tonic::codegen::Service<
566                http::Request<tonic::body::Body>,
567                Response = http::Response<
568                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
569                >,
570            >,
571            <T as tonic::codegen::Service<
572                http::Request<tonic::body::Body>,
573            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
574        {
575            CocoonServiceClient::new(InterceptedService::new(inner, interceptor))
576        }
577        /// Compress requests with the given encoding.
578        ///
579        /// This requires the server to support it otherwise it might respond with an
580        /// error.
581        #[must_use]
582        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
583            self.inner = self.inner.send_compressed(encoding);
584            self
585        }
586        /// Enable decompressing responses.
587        #[must_use]
588        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
589            self.inner = self.inner.accept_compressed(encoding);
590            self
591        }
592        /// Limits the maximum size of a decoded message.
593        ///
594        /// Default: `4MB`
595        #[must_use]
596        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
597            self.inner = self.inner.max_decoding_message_size(limit);
598            self
599        }
600        /// Limits the maximum size of an encoded message.
601        ///
602        /// Default: `usize::MAX`
603        #[must_use]
604        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
605            self.inner = self.inner.max_encoding_message_size(limit);
606            self
607        }
608        /// A generic request-response method for Mountain to call a function on Cocoon.
609        pub async fn process_mountain_request(
610            &mut self,
611            request: impl tonic::IntoRequest<super::GenericRequest>,
612        ) -> std::result::Result<
613            tonic::Response<super::GenericResponse>,
614            tonic::Status,
615        > {
616            self.inner
617                .ready()
618                .await
619                .map_err(|e| {
620                    tonic::Status::unknown(
621                        format!("Service was not ready: {}", e.into()),
622                    )
623                })?;
624            let codec = tonic_prost::ProstCodec::default();
625            let path = http::uri::PathAndQuery::from_static(
626                "/vine_ipc.CocoonService/ProcessMountainRequest",
627            );
628            let mut req = request.into_request();
629            req.extensions_mut()
630                .insert(
631                    GrpcMethod::new("vine_ipc.CocoonService", "ProcessMountainRequest"),
632                );
633            self.inner.unary(req, path, codec).await
634        }
635        /// A generic fire-and-forget method for Mountain to send a notification to Cocoon.
636        pub async fn send_mountain_notification(
637            &mut self,
638            request: impl tonic::IntoRequest<super::GenericNotification>,
639        ) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status> {
640            self.inner
641                .ready()
642                .await
643                .map_err(|e| {
644                    tonic::Status::unknown(
645                        format!("Service was not ready: {}", e.into()),
646                    )
647                })?;
648            let codec = tonic_prost::ProstCodec::default();
649            let path = http::uri::PathAndQuery::from_static(
650                "/vine_ipc.CocoonService/SendMountainNotification",
651            );
652            let mut req = request.into_request();
653            req.extensions_mut()
654                .insert(
655                    GrpcMethod::new("vine_ipc.CocoonService", "SendMountainNotification"),
656                );
657            self.inner.unary(req, path, codec).await
658        }
659        /// A method for Mountain to request that Cocoon cancel a long-running operation.
660        pub async fn cancel_operation(
661            &mut self,
662            request: impl tonic::IntoRequest<super::CancelOperationRequest>,
663        ) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status> {
664            self.inner
665                .ready()
666                .await
667                .map_err(|e| {
668                    tonic::Status::unknown(
669                        format!("Service was not ready: {}", e.into()),
670                    )
671                })?;
672            let codec = tonic_prost::ProstCodec::default();
673            let path = http::uri::PathAndQuery::from_static(
674                "/vine_ipc.CocoonService/CancelOperation",
675            );
676            let mut req = request.into_request();
677            req.extensions_mut()
678                .insert(GrpcMethod::new("vine_ipc.CocoonService", "CancelOperation"));
679            self.inner.unary(req, path, codec).await
680        }
681    }
682}
683/// Generated server implementations.
684pub mod cocoon_service_server {
685    #![allow(
686        unused_variables,
687        dead_code,
688        missing_docs,
689        clippy::wildcard_imports,
690        clippy::let_unit_value,
691    )]
692    use tonic::codegen::*;
693    /// Generated trait containing gRPC methods that should be implemented for use with CocoonServiceServer.
694    #[async_trait]
695    pub trait CocoonService: std::marker::Send + std::marker::Sync + 'static {
696        /// A generic request-response method for Mountain to call a function on Cocoon.
697        async fn process_mountain_request(
698            &self,
699            request: tonic::Request<super::GenericRequest>,
700        ) -> std::result::Result<tonic::Response<super::GenericResponse>, tonic::Status>;
701        /// A generic fire-and-forget method for Mountain to send a notification to Cocoon.
702        async fn send_mountain_notification(
703            &self,
704            request: tonic::Request<super::GenericNotification>,
705        ) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status>;
706        /// A method for Mountain to request that Cocoon cancel a long-running operation.
707        async fn cancel_operation(
708            &self,
709            request: tonic::Request<super::CancelOperationRequest>,
710        ) -> std::result::Result<tonic::Response<super::Empty>, tonic::Status>;
711    }
712    /// Service running on the Cocoon sidecar, listening for requests from Mountain.
713    #[derive(Debug)]
714    pub struct CocoonServiceServer<T> {
715        inner: Arc<T>,
716        accept_compression_encodings: EnabledCompressionEncodings,
717        send_compression_encodings: EnabledCompressionEncodings,
718        max_decoding_message_size: Option<usize>,
719        max_encoding_message_size: Option<usize>,
720    }
721    impl<T> CocoonServiceServer<T> {
722        pub fn new(inner: T) -> Self {
723            Self::from_arc(Arc::new(inner))
724        }
725        pub fn from_arc(inner: Arc<T>) -> Self {
726            Self {
727                inner,
728                accept_compression_encodings: Default::default(),
729                send_compression_encodings: Default::default(),
730                max_decoding_message_size: None,
731                max_encoding_message_size: None,
732            }
733        }
734        pub fn with_interceptor<F>(
735            inner: T,
736            interceptor: F,
737        ) -> InterceptedService<Self, F>
738        where
739            F: tonic::service::Interceptor,
740        {
741            InterceptedService::new(Self::new(inner), interceptor)
742        }
743        /// Enable decompressing requests with the given encoding.
744        #[must_use]
745        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
746            self.accept_compression_encodings.enable(encoding);
747            self
748        }
749        /// Compress responses with the given encoding, if the client supports it.
750        #[must_use]
751        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
752            self.send_compression_encodings.enable(encoding);
753            self
754        }
755        /// Limits the maximum size of a decoded message.
756        ///
757        /// Default: `4MB`
758        #[must_use]
759        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
760            self.max_decoding_message_size = Some(limit);
761            self
762        }
763        /// Limits the maximum size of an encoded message.
764        ///
765        /// Default: `usize::MAX`
766        #[must_use]
767        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
768            self.max_encoding_message_size = Some(limit);
769            self
770        }
771    }
772    impl<T, B> tonic::codegen::Service<http::Request<B>> for CocoonServiceServer<T>
773    where
774        T: CocoonService,
775        B: Body + std::marker::Send + 'static,
776        B::Error: Into<StdError> + std::marker::Send + 'static,
777    {
778        type Response = http::Response<tonic::body::Body>;
779        type Error = std::convert::Infallible;
780        type Future = BoxFuture<Self::Response, Self::Error>;
781        fn poll_ready(
782            &mut self,
783            _cx: &mut Context<'_>,
784        ) -> Poll<std::result::Result<(), Self::Error>> {
785            Poll::Ready(Ok(()))
786        }
787        fn call(&mut self, req: http::Request<B>) -> Self::Future {
788            match req.uri().path() {
789                "/vine_ipc.CocoonService/ProcessMountainRequest" => {
790                    #[allow(non_camel_case_types)]
791                    struct ProcessMountainRequestSvc<T: CocoonService>(pub Arc<T>);
792                    impl<
793                        T: CocoonService,
794                    > tonic::server::UnaryService<super::GenericRequest>
795                    for ProcessMountainRequestSvc<T> {
796                        type Response = super::GenericResponse;
797                        type Future = BoxFuture<
798                            tonic::Response<Self::Response>,
799                            tonic::Status,
800                        >;
801                        fn call(
802                            &mut self,
803                            request: tonic::Request<super::GenericRequest>,
804                        ) -> Self::Future {
805                            let inner = Arc::clone(&self.0);
806                            let fut = async move {
807                                <T as CocoonService>::process_mountain_request(
808                                        &inner,
809                                        request,
810                                    )
811                                    .await
812                            };
813                            Box::pin(fut)
814                        }
815                    }
816                    let accept_compression_encodings = self.accept_compression_encodings;
817                    let send_compression_encodings = self.send_compression_encodings;
818                    let max_decoding_message_size = self.max_decoding_message_size;
819                    let max_encoding_message_size = self.max_encoding_message_size;
820                    let inner = self.inner.clone();
821                    let fut = async move {
822                        let method = ProcessMountainRequestSvc(inner);
823                        let codec = tonic_prost::ProstCodec::default();
824                        let mut grpc = tonic::server::Grpc::new(codec)
825                            .apply_compression_config(
826                                accept_compression_encodings,
827                                send_compression_encodings,
828                            )
829                            .apply_max_message_size_config(
830                                max_decoding_message_size,
831                                max_encoding_message_size,
832                            );
833                        let res = grpc.unary(method, req).await;
834                        Ok(res)
835                    };
836                    Box::pin(fut)
837                }
838                "/vine_ipc.CocoonService/SendMountainNotification" => {
839                    #[allow(non_camel_case_types)]
840                    struct SendMountainNotificationSvc<T: CocoonService>(pub Arc<T>);
841                    impl<
842                        T: CocoonService,
843                    > tonic::server::UnaryService<super::GenericNotification>
844                    for SendMountainNotificationSvc<T> {
845                        type Response = super::Empty;
846                        type Future = BoxFuture<
847                            tonic::Response<Self::Response>,
848                            tonic::Status,
849                        >;
850                        fn call(
851                            &mut self,
852                            request: tonic::Request<super::GenericNotification>,
853                        ) -> Self::Future {
854                            let inner = Arc::clone(&self.0);
855                            let fut = async move {
856                                <T as CocoonService>::send_mountain_notification(
857                                        &inner,
858                                        request,
859                                    )
860                                    .await
861                            };
862                            Box::pin(fut)
863                        }
864                    }
865                    let accept_compression_encodings = self.accept_compression_encodings;
866                    let send_compression_encodings = self.send_compression_encodings;
867                    let max_decoding_message_size = self.max_decoding_message_size;
868                    let max_encoding_message_size = self.max_encoding_message_size;
869                    let inner = self.inner.clone();
870                    let fut = async move {
871                        let method = SendMountainNotificationSvc(inner);
872                        let codec = tonic_prost::ProstCodec::default();
873                        let mut grpc = tonic::server::Grpc::new(codec)
874                            .apply_compression_config(
875                                accept_compression_encodings,
876                                send_compression_encodings,
877                            )
878                            .apply_max_message_size_config(
879                                max_decoding_message_size,
880                                max_encoding_message_size,
881                            );
882                        let res = grpc.unary(method, req).await;
883                        Ok(res)
884                    };
885                    Box::pin(fut)
886                }
887                "/vine_ipc.CocoonService/CancelOperation" => {
888                    #[allow(non_camel_case_types)]
889                    struct CancelOperationSvc<T: CocoonService>(pub Arc<T>);
890                    impl<
891                        T: CocoonService,
892                    > tonic::server::UnaryService<super::CancelOperationRequest>
893                    for CancelOperationSvc<T> {
894                        type Response = super::Empty;
895                        type Future = BoxFuture<
896                            tonic::Response<Self::Response>,
897                            tonic::Status,
898                        >;
899                        fn call(
900                            &mut self,
901                            request: tonic::Request<super::CancelOperationRequest>,
902                        ) -> Self::Future {
903                            let inner = Arc::clone(&self.0);
904                            let fut = async move {
905                                <T as CocoonService>::cancel_operation(&inner, request)
906                                    .await
907                            };
908                            Box::pin(fut)
909                        }
910                    }
911                    let accept_compression_encodings = self.accept_compression_encodings;
912                    let send_compression_encodings = self.send_compression_encodings;
913                    let max_decoding_message_size = self.max_decoding_message_size;
914                    let max_encoding_message_size = self.max_encoding_message_size;
915                    let inner = self.inner.clone();
916                    let fut = async move {
917                        let method = CancelOperationSvc(inner);
918                        let codec = tonic_prost::ProstCodec::default();
919                        let mut grpc = tonic::server::Grpc::new(codec)
920                            .apply_compression_config(
921                                accept_compression_encodings,
922                                send_compression_encodings,
923                            )
924                            .apply_max_message_size_config(
925                                max_decoding_message_size,
926                                max_encoding_message_size,
927                            );
928                        let res = grpc.unary(method, req).await;
929                        Ok(res)
930                    };
931                    Box::pin(fut)
932                }
933                _ => {
934                    Box::pin(async move {
935                        let mut response = http::Response::new(
936                            tonic::body::Body::default(),
937                        );
938                        let headers = response.headers_mut();
939                        headers
940                            .insert(
941                                tonic::Status::GRPC_STATUS,
942                                (tonic::Code::Unimplemented as i32).into(),
943                            );
944                        headers
945                            .insert(
946                                http::header::CONTENT_TYPE,
947                                tonic::metadata::GRPC_CONTENT_TYPE,
948                            );
949                        Ok(response)
950                    })
951                }
952            }
953        }
954    }
955    impl<T> Clone for CocoonServiceServer<T> {
956        fn clone(&self) -> Self {
957            let inner = self.inner.clone();
958            Self {
959                inner,
960                accept_compression_encodings: self.accept_compression_encodings,
961                send_compression_encodings: self.send_compression_encodings,
962                max_decoding_message_size: self.max_decoding_message_size,
963                max_encoding_message_size: self.max_encoding_message_size,
964            }
965        }
966    }
967    /// Generated gRPC service name
968    pub const SERVICE_NAME: &str = "vine_ipc.CocoonService";
969    impl<T> tonic::server::NamedService for CocoonServiceServer<T> {
970        const NAME: &'static str = SERVICE_NAME;
971    }
972}