avalanche_proto/gen/
appsender.tonic.rs

1// @generated
2/// Generated client implementations.
3pub mod app_sender_client {
4    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
5    use tonic::codegen::*;
6    use tonic::codegen::http::Uri;
7    #[derive(Debug, Clone)]
8    pub struct AppSenderClient<T> {
9        inner: tonic::client::Grpc<T>,
10    }
11    impl AppSenderClient<tonic::transport::Channel> {
12        /// Attempt to create a new client by connecting to a given endpoint.
13        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
14        where
15            D: std::convert::TryInto<tonic::transport::Endpoint>,
16            D::Error: Into<StdError>,
17        {
18            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
19            Ok(Self::new(conn))
20        }
21    }
22    impl<T> AppSenderClient<T>
23    where
24        T: tonic::client::GrpcService<tonic::body::BoxBody>,
25        T::Error: Into<StdError>,
26        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
27        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
28    {
29        pub fn new(inner: T) -> Self {
30            let inner = tonic::client::Grpc::new(inner);
31            Self { inner }
32        }
33        pub fn with_origin(inner: T, origin: Uri) -> Self {
34            let inner = tonic::client::Grpc::with_origin(inner, origin);
35            Self { inner }
36        }
37        pub fn with_interceptor<F>(
38            inner: T,
39            interceptor: F,
40        ) -> AppSenderClient<InterceptedService<T, F>>
41        where
42            F: tonic::service::Interceptor,
43            T::ResponseBody: Default,
44            T: tonic::codegen::Service<
45                http::Request<tonic::body::BoxBody>,
46                Response = http::Response<
47                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
48                >,
49            >,
50            <T as tonic::codegen::Service<
51                http::Request<tonic::body::BoxBody>,
52            >>::Error: Into<StdError> + Send + Sync,
53        {
54            AppSenderClient::new(InterceptedService::new(inner, interceptor))
55        }
56        /// Compress requests with the given encoding.
57        ///
58        /// This requires the server to support it otherwise it might respond with an
59        /// error.
60        #[must_use]
61        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
62            self.inner = self.inner.send_compressed(encoding);
63            self
64        }
65        /// Enable decompressing responses.
66        #[must_use]
67        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
68            self.inner = self.inner.accept_compressed(encoding);
69            self
70        }
71        pub async fn send_app_request(
72            &mut self,
73            request: impl tonic::IntoRequest<super::SendAppRequestMsg>,
74        ) -> Result<
75            tonic::Response<super::super::google::protobuf::Empty>,
76            tonic::Status,
77        > {
78            self.inner
79                .ready()
80                .await
81                .map_err(|e| {
82                    tonic::Status::new(
83                        tonic::Code::Unknown,
84                        format!("Service was not ready: {}", e.into()),
85                    )
86                })?;
87            let codec = tonic::codec::ProstCodec::default();
88            let path = http::uri::PathAndQuery::from_static(
89                "/appsender.AppSender/SendAppRequest",
90            );
91            self.inner.unary(request.into_request(), path, codec).await
92        }
93        pub async fn send_app_response(
94            &mut self,
95            request: impl tonic::IntoRequest<super::SendAppResponseMsg>,
96        ) -> Result<
97            tonic::Response<super::super::google::protobuf::Empty>,
98            tonic::Status,
99        > {
100            self.inner
101                .ready()
102                .await
103                .map_err(|e| {
104                    tonic::Status::new(
105                        tonic::Code::Unknown,
106                        format!("Service was not ready: {}", e.into()),
107                    )
108                })?;
109            let codec = tonic::codec::ProstCodec::default();
110            let path = http::uri::PathAndQuery::from_static(
111                "/appsender.AppSender/SendAppResponse",
112            );
113            self.inner.unary(request.into_request(), path, codec).await
114        }
115        pub async fn send_app_gossip(
116            &mut self,
117            request: impl tonic::IntoRequest<super::SendAppGossipMsg>,
118        ) -> Result<
119            tonic::Response<super::super::google::protobuf::Empty>,
120            tonic::Status,
121        > {
122            self.inner
123                .ready()
124                .await
125                .map_err(|e| {
126                    tonic::Status::new(
127                        tonic::Code::Unknown,
128                        format!("Service was not ready: {}", e.into()),
129                    )
130                })?;
131            let codec = tonic::codec::ProstCodec::default();
132            let path = http::uri::PathAndQuery::from_static(
133                "/appsender.AppSender/SendAppGossip",
134            );
135            self.inner.unary(request.into_request(), path, codec).await
136        }
137        pub async fn send_app_gossip_specific(
138            &mut self,
139            request: impl tonic::IntoRequest<super::SendAppGossipSpecificMsg>,
140        ) -> Result<
141            tonic::Response<super::super::google::protobuf::Empty>,
142            tonic::Status,
143        > {
144            self.inner
145                .ready()
146                .await
147                .map_err(|e| {
148                    tonic::Status::new(
149                        tonic::Code::Unknown,
150                        format!("Service was not ready: {}", e.into()),
151                    )
152                })?;
153            let codec = tonic::codec::ProstCodec::default();
154            let path = http::uri::PathAndQuery::from_static(
155                "/appsender.AppSender/SendAppGossipSpecific",
156            );
157            self.inner.unary(request.into_request(), path, codec).await
158        }
159        pub async fn send_cross_chain_app_request(
160            &mut self,
161            request: impl tonic::IntoRequest<super::SendCrossChainAppRequestMsg>,
162        ) -> Result<
163            tonic::Response<super::super::google::protobuf::Empty>,
164            tonic::Status,
165        > {
166            self.inner
167                .ready()
168                .await
169                .map_err(|e| {
170                    tonic::Status::new(
171                        tonic::Code::Unknown,
172                        format!("Service was not ready: {}", e.into()),
173                    )
174                })?;
175            let codec = tonic::codec::ProstCodec::default();
176            let path = http::uri::PathAndQuery::from_static(
177                "/appsender.AppSender/SendCrossChainAppRequest",
178            );
179            self.inner.unary(request.into_request(), path, codec).await
180        }
181        pub async fn send_cross_chain_app_response(
182            &mut self,
183            request: impl tonic::IntoRequest<super::SendCrossChainAppResponseMsg>,
184        ) -> Result<
185            tonic::Response<super::super::google::protobuf::Empty>,
186            tonic::Status,
187        > {
188            self.inner
189                .ready()
190                .await
191                .map_err(|e| {
192                    tonic::Status::new(
193                        tonic::Code::Unknown,
194                        format!("Service was not ready: {}", e.into()),
195                    )
196                })?;
197            let codec = tonic::codec::ProstCodec::default();
198            let path = http::uri::PathAndQuery::from_static(
199                "/appsender.AppSender/SendCrossChainAppResponse",
200            );
201            self.inner.unary(request.into_request(), path, codec).await
202        }
203    }
204}
205/// Generated server implementations.
206pub mod app_sender_server {
207    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
208    use tonic::codegen::*;
209    ///Generated trait containing gRPC methods that should be implemented for use with AppSenderServer.
210    #[async_trait]
211    pub trait AppSender: Send + Sync + 'static {
212        async fn send_app_request(
213            &self,
214            request: tonic::Request<super::SendAppRequestMsg>,
215        ) -> Result<
216            tonic::Response<super::super::google::protobuf::Empty>,
217            tonic::Status,
218        >;
219        async fn send_app_response(
220            &self,
221            request: tonic::Request<super::SendAppResponseMsg>,
222        ) -> Result<
223            tonic::Response<super::super::google::protobuf::Empty>,
224            tonic::Status,
225        >;
226        async fn send_app_gossip(
227            &self,
228            request: tonic::Request<super::SendAppGossipMsg>,
229        ) -> Result<
230            tonic::Response<super::super::google::protobuf::Empty>,
231            tonic::Status,
232        >;
233        async fn send_app_gossip_specific(
234            &self,
235            request: tonic::Request<super::SendAppGossipSpecificMsg>,
236        ) -> Result<
237            tonic::Response<super::super::google::protobuf::Empty>,
238            tonic::Status,
239        >;
240        async fn send_cross_chain_app_request(
241            &self,
242            request: tonic::Request<super::SendCrossChainAppRequestMsg>,
243        ) -> Result<
244            tonic::Response<super::super::google::protobuf::Empty>,
245            tonic::Status,
246        >;
247        async fn send_cross_chain_app_response(
248            &self,
249            request: tonic::Request<super::SendCrossChainAppResponseMsg>,
250        ) -> Result<
251            tonic::Response<super::super::google::protobuf::Empty>,
252            tonic::Status,
253        >;
254    }
255    #[derive(Debug)]
256    pub struct AppSenderServer<T: AppSender> {
257        inner: _Inner<T>,
258        accept_compression_encodings: EnabledCompressionEncodings,
259        send_compression_encodings: EnabledCompressionEncodings,
260    }
261    struct _Inner<T>(Arc<T>);
262    impl<T: AppSender> AppSenderServer<T> {
263        pub fn new(inner: T) -> Self {
264            Self::from_arc(Arc::new(inner))
265        }
266        pub fn from_arc(inner: Arc<T>) -> Self {
267            let inner = _Inner(inner);
268            Self {
269                inner,
270                accept_compression_encodings: Default::default(),
271                send_compression_encodings: Default::default(),
272            }
273        }
274        pub fn with_interceptor<F>(
275            inner: T,
276            interceptor: F,
277        ) -> InterceptedService<Self, F>
278        where
279            F: tonic::service::Interceptor,
280        {
281            InterceptedService::new(Self::new(inner), interceptor)
282        }
283        /// Enable decompressing requests with the given encoding.
284        #[must_use]
285        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
286            self.accept_compression_encodings.enable(encoding);
287            self
288        }
289        /// Compress responses with the given encoding, if the client supports it.
290        #[must_use]
291        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
292            self.send_compression_encodings.enable(encoding);
293            self
294        }
295    }
296    impl<T, B> tonic::codegen::Service<http::Request<B>> for AppSenderServer<T>
297    where
298        T: AppSender,
299        B: Body + Send + 'static,
300        B::Error: Into<StdError> + Send + 'static,
301    {
302        type Response = http::Response<tonic::body::BoxBody>;
303        type Error = std::convert::Infallible;
304        type Future = BoxFuture<Self::Response, Self::Error>;
305        fn poll_ready(
306            &mut self,
307            _cx: &mut Context<'_>,
308        ) -> Poll<Result<(), Self::Error>> {
309            Poll::Ready(Ok(()))
310        }
311        fn call(&mut self, req: http::Request<B>) -> Self::Future {
312            let inner = self.inner.clone();
313            match req.uri().path() {
314                "/appsender.AppSender/SendAppRequest" => {
315                    #[allow(non_camel_case_types)]
316                    struct SendAppRequestSvc<T: AppSender>(pub Arc<T>);
317                    impl<
318                        T: AppSender,
319                    > tonic::server::UnaryService<super::SendAppRequestMsg>
320                    for SendAppRequestSvc<T> {
321                        type Response = super::super::google::protobuf::Empty;
322                        type Future = BoxFuture<
323                            tonic::Response<Self::Response>,
324                            tonic::Status,
325                        >;
326                        fn call(
327                            &mut self,
328                            request: tonic::Request<super::SendAppRequestMsg>,
329                        ) -> Self::Future {
330                            let inner = self.0.clone();
331                            let fut = async move {
332                                (*inner).send_app_request(request).await
333                            };
334                            Box::pin(fut)
335                        }
336                    }
337                    let accept_compression_encodings = self.accept_compression_encodings;
338                    let send_compression_encodings = self.send_compression_encodings;
339                    let inner = self.inner.clone();
340                    let fut = async move {
341                        let inner = inner.0;
342                        let method = SendAppRequestSvc(inner);
343                        let codec = tonic::codec::ProstCodec::default();
344                        let mut grpc = tonic::server::Grpc::new(codec)
345                            .apply_compression_config(
346                                accept_compression_encodings,
347                                send_compression_encodings,
348                            );
349                        let res = grpc.unary(method, req).await;
350                        Ok(res)
351                    };
352                    Box::pin(fut)
353                }
354                "/appsender.AppSender/SendAppResponse" => {
355                    #[allow(non_camel_case_types)]
356                    struct SendAppResponseSvc<T: AppSender>(pub Arc<T>);
357                    impl<
358                        T: AppSender,
359                    > tonic::server::UnaryService<super::SendAppResponseMsg>
360                    for SendAppResponseSvc<T> {
361                        type Response = super::super::google::protobuf::Empty;
362                        type Future = BoxFuture<
363                            tonic::Response<Self::Response>,
364                            tonic::Status,
365                        >;
366                        fn call(
367                            &mut self,
368                            request: tonic::Request<super::SendAppResponseMsg>,
369                        ) -> Self::Future {
370                            let inner = self.0.clone();
371                            let fut = async move {
372                                (*inner).send_app_response(request).await
373                            };
374                            Box::pin(fut)
375                        }
376                    }
377                    let accept_compression_encodings = self.accept_compression_encodings;
378                    let send_compression_encodings = self.send_compression_encodings;
379                    let inner = self.inner.clone();
380                    let fut = async move {
381                        let inner = inner.0;
382                        let method = SendAppResponseSvc(inner);
383                        let codec = tonic::codec::ProstCodec::default();
384                        let mut grpc = tonic::server::Grpc::new(codec)
385                            .apply_compression_config(
386                                accept_compression_encodings,
387                                send_compression_encodings,
388                            );
389                        let res = grpc.unary(method, req).await;
390                        Ok(res)
391                    };
392                    Box::pin(fut)
393                }
394                "/appsender.AppSender/SendAppGossip" => {
395                    #[allow(non_camel_case_types)]
396                    struct SendAppGossipSvc<T: AppSender>(pub Arc<T>);
397                    impl<
398                        T: AppSender,
399                    > tonic::server::UnaryService<super::SendAppGossipMsg>
400                    for SendAppGossipSvc<T> {
401                        type Response = super::super::google::protobuf::Empty;
402                        type Future = BoxFuture<
403                            tonic::Response<Self::Response>,
404                            tonic::Status,
405                        >;
406                        fn call(
407                            &mut self,
408                            request: tonic::Request<super::SendAppGossipMsg>,
409                        ) -> Self::Future {
410                            let inner = self.0.clone();
411                            let fut = async move {
412                                (*inner).send_app_gossip(request).await
413                            };
414                            Box::pin(fut)
415                        }
416                    }
417                    let accept_compression_encodings = self.accept_compression_encodings;
418                    let send_compression_encodings = self.send_compression_encodings;
419                    let inner = self.inner.clone();
420                    let fut = async move {
421                        let inner = inner.0;
422                        let method = SendAppGossipSvc(inner);
423                        let codec = tonic::codec::ProstCodec::default();
424                        let mut grpc = tonic::server::Grpc::new(codec)
425                            .apply_compression_config(
426                                accept_compression_encodings,
427                                send_compression_encodings,
428                            );
429                        let res = grpc.unary(method, req).await;
430                        Ok(res)
431                    };
432                    Box::pin(fut)
433                }
434                "/appsender.AppSender/SendAppGossipSpecific" => {
435                    #[allow(non_camel_case_types)]
436                    struct SendAppGossipSpecificSvc<T: AppSender>(pub Arc<T>);
437                    impl<
438                        T: AppSender,
439                    > tonic::server::UnaryService<super::SendAppGossipSpecificMsg>
440                    for SendAppGossipSpecificSvc<T> {
441                        type Response = super::super::google::protobuf::Empty;
442                        type Future = BoxFuture<
443                            tonic::Response<Self::Response>,
444                            tonic::Status,
445                        >;
446                        fn call(
447                            &mut self,
448                            request: tonic::Request<super::SendAppGossipSpecificMsg>,
449                        ) -> Self::Future {
450                            let inner = self.0.clone();
451                            let fut = async move {
452                                (*inner).send_app_gossip_specific(request).await
453                            };
454                            Box::pin(fut)
455                        }
456                    }
457                    let accept_compression_encodings = self.accept_compression_encodings;
458                    let send_compression_encodings = self.send_compression_encodings;
459                    let inner = self.inner.clone();
460                    let fut = async move {
461                        let inner = inner.0;
462                        let method = SendAppGossipSpecificSvc(inner);
463                        let codec = tonic::codec::ProstCodec::default();
464                        let mut grpc = tonic::server::Grpc::new(codec)
465                            .apply_compression_config(
466                                accept_compression_encodings,
467                                send_compression_encodings,
468                            );
469                        let res = grpc.unary(method, req).await;
470                        Ok(res)
471                    };
472                    Box::pin(fut)
473                }
474                "/appsender.AppSender/SendCrossChainAppRequest" => {
475                    #[allow(non_camel_case_types)]
476                    struct SendCrossChainAppRequestSvc<T: AppSender>(pub Arc<T>);
477                    impl<
478                        T: AppSender,
479                    > tonic::server::UnaryService<super::SendCrossChainAppRequestMsg>
480                    for SendCrossChainAppRequestSvc<T> {
481                        type Response = super::super::google::protobuf::Empty;
482                        type Future = BoxFuture<
483                            tonic::Response<Self::Response>,
484                            tonic::Status,
485                        >;
486                        fn call(
487                            &mut self,
488                            request: tonic::Request<super::SendCrossChainAppRequestMsg>,
489                        ) -> Self::Future {
490                            let inner = self.0.clone();
491                            let fut = async move {
492                                (*inner).send_cross_chain_app_request(request).await
493                            };
494                            Box::pin(fut)
495                        }
496                    }
497                    let accept_compression_encodings = self.accept_compression_encodings;
498                    let send_compression_encodings = self.send_compression_encodings;
499                    let inner = self.inner.clone();
500                    let fut = async move {
501                        let inner = inner.0;
502                        let method = SendCrossChainAppRequestSvc(inner);
503                        let codec = tonic::codec::ProstCodec::default();
504                        let mut grpc = tonic::server::Grpc::new(codec)
505                            .apply_compression_config(
506                                accept_compression_encodings,
507                                send_compression_encodings,
508                            );
509                        let res = grpc.unary(method, req).await;
510                        Ok(res)
511                    };
512                    Box::pin(fut)
513                }
514                "/appsender.AppSender/SendCrossChainAppResponse" => {
515                    #[allow(non_camel_case_types)]
516                    struct SendCrossChainAppResponseSvc<T: AppSender>(pub Arc<T>);
517                    impl<
518                        T: AppSender,
519                    > tonic::server::UnaryService<super::SendCrossChainAppResponseMsg>
520                    for SendCrossChainAppResponseSvc<T> {
521                        type Response = super::super::google::protobuf::Empty;
522                        type Future = BoxFuture<
523                            tonic::Response<Self::Response>,
524                            tonic::Status,
525                        >;
526                        fn call(
527                            &mut self,
528                            request: tonic::Request<super::SendCrossChainAppResponseMsg>,
529                        ) -> Self::Future {
530                            let inner = self.0.clone();
531                            let fut = async move {
532                                (*inner).send_cross_chain_app_response(request).await
533                            };
534                            Box::pin(fut)
535                        }
536                    }
537                    let accept_compression_encodings = self.accept_compression_encodings;
538                    let send_compression_encodings = self.send_compression_encodings;
539                    let inner = self.inner.clone();
540                    let fut = async move {
541                        let inner = inner.0;
542                        let method = SendCrossChainAppResponseSvc(inner);
543                        let codec = tonic::codec::ProstCodec::default();
544                        let mut grpc = tonic::server::Grpc::new(codec)
545                            .apply_compression_config(
546                                accept_compression_encodings,
547                                send_compression_encodings,
548                            );
549                        let res = grpc.unary(method, req).await;
550                        Ok(res)
551                    };
552                    Box::pin(fut)
553                }
554                _ => {
555                    Box::pin(async move {
556                        Ok(
557                            http::Response::builder()
558                                .status(200)
559                                .header("grpc-status", "12")
560                                .header("content-type", "application/grpc")
561                                .body(empty_body())
562                                .unwrap(),
563                        )
564                    })
565                }
566            }
567        }
568    }
569    impl<T: AppSender> Clone for AppSenderServer<T> {
570        fn clone(&self) -> Self {
571            let inner = self.inner.clone();
572            Self {
573                inner,
574                accept_compression_encodings: self.accept_compression_encodings,
575                send_compression_encodings: self.send_compression_encodings,
576            }
577        }
578    }
579    impl<T: AppSender> Clone for _Inner<T> {
580        fn clone(&self) -> Self {
581            Self(self.0.clone())
582        }
583    }
584    impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
585        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
586            write!(f, "{:?}", self.0)
587        }
588    }
589    impl<T: AppSender> tonic::server::NamedService for AppSenderServer<T> {
590        const NAME: &'static str = "appsender.AppSender";
591    }
592}