subliminal_protos_rust/codegen/
broker.rs

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