Skip to main content

ora_server/proto/generated/
ora.executors.v1.rs

1// This file is @generated by prost-build.
2/// Request for `ExecutorConnection`.
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct ExecutorConnectionRequest {
5    /// A message sent from the executor.
6    #[prost(message, optional, tag = "1")]
7    pub message: ::core::option::Option<ExecutorMessage>,
8}
9impl ::prost::Name for ExecutorConnectionRequest {
10    const NAME: &'static str = "ExecutorConnectionRequest";
11    const PACKAGE: &'static str = "ora.executors.v1";
12    fn full_name() -> ::prost::alloc::string::String {
13        "ora.executors.v1.ExecutorConnectionRequest".into()
14    }
15    fn type_url() -> ::prost::alloc::string::String {
16        "/ora.executors.v1.ExecutorConnectionRequest".into()
17    }
18}
19/// Response for `ExecutorConnection`.
20#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
21pub struct ExecutorConnectionResponse {
22    /// A message sent from the server.
23    #[prost(message, optional, tag = "1")]
24    pub message: ::core::option::Option<ServerMessage>,
25}
26impl ::prost::Name for ExecutorConnectionResponse {
27    const NAME: &'static str = "ExecutorConnectionResponse";
28    const PACKAGE: &'static str = "ora.executors.v1";
29    fn full_name() -> ::prost::alloc::string::String {
30        "ora.executors.v1.ExecutorConnectionResponse".into()
31    }
32    fn type_url() -> ::prost::alloc::string::String {
33        "/ora.executors.v1.ExecutorConnectionResponse".into()
34    }
35}
36/// A message sent from the executor.
37#[derive(Clone, PartialEq, ::prost::Message)]
38pub struct ExecutorMessage {
39    /// The message.
40    #[prost(oneof = "executor_message::ExecutorMessageKind", tags = "1, 2, 3, 4")]
41    pub executor_message_kind: ::core::option::Option<
42        executor_message::ExecutorMessageKind,
43    >,
44}
45/// Nested message and enum types in `ExecutorMessage`.
46pub mod executor_message {
47    /// The message.
48    #[derive(Clone, PartialEq, ::prost::Oneof)]
49    pub enum ExecutorMessageKind {
50        /// The capabilities of the executor.
51        ///
52        /// The executor must send the capabilities
53        /// as the first message in the stream
54        /// before any heartbeats, subsequent capabilities
55        /// messages might be ignored.
56        #[prost(message, tag = "1")]
57        Capabilities(super::ExecutorCapabilities),
58        /// The heartbeat request.
59        #[prost(message, tag = "2")]
60        Heartbeat(super::ExecutorHeartbeat),
61        /// The execution has succeeded.
62        #[prost(message, tag = "3")]
63        ExecutionSucceeded(super::ExecutionSucceeded),
64        /// The execution has failed.
65        #[prost(message, tag = "4")]
66        ExecutionFailed(super::ExecutionFailed),
67    }
68}
69impl ::prost::Name for ExecutorMessage {
70    const NAME: &'static str = "ExecutorMessage";
71    const PACKAGE: &'static str = "ora.executors.v1";
72    fn full_name() -> ::prost::alloc::string::String {
73        "ora.executors.v1.ExecutorMessage".into()
74    }
75    fn type_url() -> ::prost::alloc::string::String {
76        "/ora.executors.v1.ExecutorMessage".into()
77    }
78}
79/// Capabilities of the executor and other information
80/// that the server needs to know about the executor.
81#[derive(Clone, PartialEq, ::prost::Message)]
82pub struct ExecutorCapabilities {
83    /// The name of the executor.
84    #[prost(string, tag = "1")]
85    pub name: ::prost::alloc::string::String,
86    /// The job queue configurations of the executor.
87    #[prost(message, repeated, tag = "2")]
88    pub job_queues: ::prost::alloc::vec::Vec<ExecutorJobQueue>,
89}
90impl ::prost::Name for ExecutorCapabilities {
91    const NAME: &'static str = "ExecutorCapabilities";
92    const PACKAGE: &'static str = "ora.executors.v1";
93    fn full_name() -> ::prost::alloc::string::String {
94        "ora.executors.v1.ExecutorCapabilities".into()
95    }
96    fn type_url() -> ::prost::alloc::string::String {
97        "/ora.executors.v1.ExecutorCapabilities".into()
98    }
99}
100/// A job queue configuration of the executor.
101#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
102pub struct ExecutorJobQueue {
103    /// The job type of the queue.
104    #[prost(message, optional, tag = "1")]
105    pub job_type: ::core::option::Option<super::super::jobs::v1::JobType>,
106    /// The maximum amount of concurrent executions allowed for this job type.
107    #[prost(uint64, tag = "2")]
108    pub max_concurrent_executions: u64,
109}
110impl ::prost::Name for ExecutorJobQueue {
111    const NAME: &'static str = "ExecutorJobQueue";
112    const PACKAGE: &'static str = "ora.executors.v1";
113    fn full_name() -> ::prost::alloc::string::String {
114        "ora.executors.v1.ExecutorJobQueue".into()
115    }
116    fn type_url() -> ::prost::alloc::string::String {
117        "/ora.executors.v1.ExecutorJobQueue".into()
118    }
119}
120/// The heartbeat content.
121#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
122pub struct ExecutorHeartbeat {}
123impl ::prost::Name for ExecutorHeartbeat {
124    const NAME: &'static str = "ExecutorHeartbeat";
125    const PACKAGE: &'static str = "ora.executors.v1";
126    fn full_name() -> ::prost::alloc::string::String {
127        "ora.executors.v1.ExecutorHeartbeat".into()
128    }
129    fn type_url() -> ::prost::alloc::string::String {
130        "/ora.executors.v1.ExecutorHeartbeat".into()
131    }
132}
133/// A job execution has succeeded.
134#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
135pub struct ExecutionSucceeded {
136    /// The ID of the job execution.
137    #[prost(string, tag = "1")]
138    pub execution_id: ::prost::alloc::string::String,
139    /// The time when the job execution succeeded.
140    #[prost(message, optional, tag = "2")]
141    pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
142    /// The output payload of the job.
143    #[prost(string, tag = "3")]
144    pub output_payload_json: ::prost::alloc::string::String,
145}
146impl ::prost::Name for ExecutionSucceeded {
147    const NAME: &'static str = "ExecutionSucceeded";
148    const PACKAGE: &'static str = "ora.executors.v1";
149    fn full_name() -> ::prost::alloc::string::String {
150        "ora.executors.v1.ExecutionSucceeded".into()
151    }
152    fn type_url() -> ::prost::alloc::string::String {
153        "/ora.executors.v1.ExecutionSucceeded".into()
154    }
155}
156/// The job execution has failed.
157#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
158pub struct ExecutionFailed {
159    /// The ID of the job execution.
160    #[prost(string, tag = "1")]
161    pub execution_id: ::prost::alloc::string::String,
162    /// The time when the job execution failed.
163    #[prost(message, optional, tag = "2")]
164    pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
165    /// The error message of the job.
166    #[prost(string, tag = "3")]
167    pub failure_reason: ::prost::alloc::string::String,
168}
169impl ::prost::Name for ExecutionFailed {
170    const NAME: &'static str = "ExecutionFailed";
171    const PACKAGE: &'static str = "ora.executors.v1";
172    fn full_name() -> ::prost::alloc::string::String {
173        "ora.executors.v1.ExecutionFailed".into()
174    }
175    fn type_url() -> ::prost::alloc::string::String {
176        "/ora.executors.v1.ExecutionFailed".into()
177    }
178}
179/// A message sent from the server.
180#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
181pub struct ServerMessage {
182    /// The message.
183    #[prost(oneof = "server_message::ServerMessageKind", tags = "1, 2, 3")]
184    pub server_message_kind: ::core::option::Option<server_message::ServerMessageKind>,
185}
186/// Nested message and enum types in `ServerMessage`.
187pub mod server_message {
188    /// The message.
189    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
190    pub enum ServerMessageKind {
191        /// The properties of the executor.
192        #[prost(message, tag = "1")]
193        Properties(super::ExecutorProperties),
194        /// A job execution is ready to be executed by the executor.
195        #[prost(message, tag = "2")]
196        ExecutionReady(super::ExecutionReady),
197        /// The job execution was cancelled and should be dropped by the executor.
198        #[prost(message, tag = "3")]
199        ExecutionCancelled(super::ExecutionCancelled),
200    }
201}
202impl ::prost::Name for ServerMessage {
203    const NAME: &'static str = "ServerMessage";
204    const PACKAGE: &'static str = "ora.executors.v1";
205    fn full_name() -> ::prost::alloc::string::String {
206        "ora.executors.v1.ServerMessage".into()
207    }
208    fn type_url() -> ::prost::alloc::string::String {
209        "/ora.executors.v1.ServerMessage".into()
210    }
211}
212/// Properties of the executor assigned by the server.
213#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
214pub struct ExecutorProperties {
215    /// The ID given to the executor.
216    #[prost(string, tag = "1")]
217    pub executor_id: ::prost::alloc::string::String,
218    /// The maximum interval between heartbeats.
219    ///
220    /// Executors should repeat the executor ping
221    /// request at least every `max_heartbeat_interval`.
222    ///
223    /// Note that delays in the network or the server
224    /// may cause the executor to miss the deadline,
225    /// so the executor should send the heartbeat
226    /// before the deadline to account for this.
227    #[prost(message, optional, tag = "2")]
228    pub max_heartbeat_interval: ::core::option::Option<::prost_types::Duration>,
229}
230impl ::prost::Name for ExecutorProperties {
231    const NAME: &'static str = "ExecutorProperties";
232    const PACKAGE: &'static str = "ora.executors.v1";
233    fn full_name() -> ::prost::alloc::string::String {
234        "ora.executors.v1.ExecutorProperties".into()
235    }
236    fn type_url() -> ::prost::alloc::string::String {
237        "/ora.executors.v1.ExecutorProperties".into()
238    }
239}
240/// A job execution is ready to be executed by the executor.
241#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
242pub struct ExecutionReady {
243    /// The ID of the job.
244    #[prost(string, tag = "1")]
245    pub job_id: ::prost::alloc::string::String,
246    /// The execution ID of the job.
247    #[prost(string, tag = "2")]
248    pub execution_id: ::prost::alloc::string::String,
249    /// The job type ID.
250    #[prost(string, tag = "3")]
251    pub job_type_id: ::prost::alloc::string::String,
252    /// The attempt number of the job execution.
253    ///
254    /// The first attempt is 1.
255    #[prost(uint64, tag = "4")]
256    pub attempt_number: u64,
257    /// The input payload of the job.
258    #[prost(string, tag = "5")]
259    pub input_payload_json: ::prost::alloc::string::String,
260    /// The target execution time of the job.
261    #[prost(message, optional, tag = "6")]
262    pub target_execution_time: ::core::option::Option<::prost_types::Timestamp>,
263}
264impl ::prost::Name for ExecutionReady {
265    const NAME: &'static str = "ExecutionReady";
266    const PACKAGE: &'static str = "ora.executors.v1";
267    fn full_name() -> ::prost::alloc::string::String {
268        "ora.executors.v1.ExecutionReady".into()
269    }
270    fn type_url() -> ::prost::alloc::string::String {
271        "/ora.executors.v1.ExecutionReady".into()
272    }
273}
274/// The job execution was cancelled and should be dropped by the executor.
275#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
276pub struct ExecutionCancelled {
277    /// The ID of the job execution.
278    #[prost(string, tag = "1")]
279    pub execution_id: ::prost::alloc::string::String,
280}
281impl ::prost::Name for ExecutionCancelled {
282    const NAME: &'static str = "ExecutionCancelled";
283    const PACKAGE: &'static str = "ora.executors.v1";
284    fn full_name() -> ::prost::alloc::string::String {
285        "ora.executors.v1.ExecutionCancelled".into()
286    }
287    fn type_url() -> ::prost::alloc::string::String {
288        "/ora.executors.v1.ExecutionCancelled".into()
289    }
290}
291/// Generated server implementations.
292pub mod execution_service_server {
293    #![allow(
294        unused_variables,
295        dead_code,
296        missing_docs,
297        clippy::wildcard_imports,
298        clippy::let_unit_value,
299    )]
300    use tonic::codegen::*;
301    /// Generated trait containing gRPC methods that should be implemented for use with ExecutionServiceServer.
302    #[async_trait]
303    pub trait ExecutionService: std::marker::Send + std::marker::Sync + 'static {
304        /// Long-lived bidirectional stream for the executor.
305        async fn executor_connection(
306            &self,
307            request: tonic::Request<tonic::Streaming<super::ExecutorConnectionRequest>>,
308        ) -> std::result::Result<
309            tonic::Response<BoxStream<super::ExecutorConnectionResponse>>,
310            tonic::Status,
311        > {
312            Err(tonic::Status::unimplemented("Not yet implemented"))
313        }
314    }
315    /// Endpoint on the server for executors to connect to.
316    #[derive(Debug)]
317    pub struct ExecutionServiceServer<T> {
318        inner: Arc<T>,
319        accept_compression_encodings: EnabledCompressionEncodings,
320        send_compression_encodings: EnabledCompressionEncodings,
321        max_decoding_message_size: Option<usize>,
322        max_encoding_message_size: Option<usize>,
323    }
324    impl<T> ExecutionServiceServer<T> {
325        pub fn new(inner: T) -> Self {
326            Self::from_arc(Arc::new(inner))
327        }
328        pub fn from_arc(inner: Arc<T>) -> Self {
329            Self {
330                inner,
331                accept_compression_encodings: Default::default(),
332                send_compression_encodings: Default::default(),
333                max_decoding_message_size: None,
334                max_encoding_message_size: None,
335            }
336        }
337        pub fn with_interceptor<F>(
338            inner: T,
339            interceptor: F,
340        ) -> InterceptedService<Self, F>
341        where
342            F: tonic::service::Interceptor,
343        {
344            InterceptedService::new(Self::new(inner), interceptor)
345        }
346        /// Enable decompressing requests with the given encoding.
347        #[must_use]
348        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
349            self.accept_compression_encodings.enable(encoding);
350            self
351        }
352        /// Compress responses with the given encoding, if the client supports it.
353        #[must_use]
354        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
355            self.send_compression_encodings.enable(encoding);
356            self
357        }
358        /// Limits the maximum size of a decoded message.
359        ///
360        /// Default: `4MB`
361        #[must_use]
362        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
363            self.max_decoding_message_size = Some(limit);
364            self
365        }
366        /// Limits the maximum size of an encoded message.
367        ///
368        /// Default: `usize::MAX`
369        #[must_use]
370        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
371            self.max_encoding_message_size = Some(limit);
372            self
373        }
374    }
375    impl<T, B> tonic::codegen::Service<http::Request<B>> for ExecutionServiceServer<T>
376    where
377        T: ExecutionService,
378        B: Body + std::marker::Send + 'static,
379        B::Error: Into<StdError> + std::marker::Send + 'static,
380    {
381        type Response = http::Response<tonic::body::Body>;
382        type Error = std::convert::Infallible;
383        type Future = BoxFuture<Self::Response, Self::Error>;
384        fn poll_ready(
385            &mut self,
386            _cx: &mut Context<'_>,
387        ) -> Poll<std::result::Result<(), Self::Error>> {
388            Poll::Ready(Ok(()))
389        }
390        fn call(&mut self, req: http::Request<B>) -> Self::Future {
391            match req.uri().path() {
392                "/ora.executors.v1.ExecutionService/ExecutorConnection" => {
393                    #[allow(non_camel_case_types)]
394                    struct ExecutorConnectionSvc<T: ExecutionService>(pub Arc<T>);
395                    impl<
396                        T: ExecutionService,
397                    > tonic::server::StreamingService<super::ExecutorConnectionRequest>
398                    for ExecutorConnectionSvc<T> {
399                        type Response = super::ExecutorConnectionResponse;
400                        type ResponseStream = BoxStream<
401                            super::ExecutorConnectionResponse,
402                        >;
403                        type Future = BoxFuture<
404                            tonic::Response<Self::ResponseStream>,
405                            tonic::Status,
406                        >;
407                        fn call(
408                            &mut self,
409                            request: tonic::Request<
410                                tonic::Streaming<super::ExecutorConnectionRequest>,
411                            >,
412                        ) -> Self::Future {
413                            let inner = Arc::clone(&self.0);
414                            let fut = async move {
415                                <T as ExecutionService>::executor_connection(
416                                        &inner,
417                                        request,
418                                    )
419                                    .await
420                            };
421                            Box::pin(fut)
422                        }
423                    }
424                    let accept_compression_encodings = self.accept_compression_encodings;
425                    let send_compression_encodings = self.send_compression_encodings;
426                    let max_decoding_message_size = self.max_decoding_message_size;
427                    let max_encoding_message_size = self.max_encoding_message_size;
428                    let inner = self.inner.clone();
429                    let fut = async move {
430                        let method = ExecutorConnectionSvc(inner);
431                        let codec = tonic_prost::ProstCodec::default();
432                        let mut grpc = tonic::server::Grpc::new(codec)
433                            .apply_compression_config(
434                                accept_compression_encodings,
435                                send_compression_encodings,
436                            )
437                            .apply_max_message_size_config(
438                                max_decoding_message_size,
439                                max_encoding_message_size,
440                            );
441                        let res = grpc.streaming(method, req).await;
442                        Ok(res)
443                    };
444                    Box::pin(fut)
445                }
446                _ => {
447                    Box::pin(async move {
448                        let mut response = http::Response::new(
449                            tonic::body::Body::default(),
450                        );
451                        let headers = response.headers_mut();
452                        headers
453                            .insert(
454                                tonic::Status::GRPC_STATUS,
455                                (tonic::Code::Unimplemented as i32).into(),
456                            );
457                        headers
458                            .insert(
459                                http::header::CONTENT_TYPE,
460                                tonic::metadata::GRPC_CONTENT_TYPE,
461                            );
462                        Ok(response)
463                    })
464                }
465            }
466        }
467    }
468    impl<T> Clone for ExecutionServiceServer<T> {
469        fn clone(&self) -> Self {
470            let inner = self.inner.clone();
471            Self {
472                inner,
473                accept_compression_encodings: self.accept_compression_encodings,
474                send_compression_encodings: self.send_compression_encodings,
475                max_decoding_message_size: self.max_decoding_message_size,
476                max_encoding_message_size: self.max_encoding_message_size,
477            }
478        }
479    }
480    /// Generated gRPC service name
481    pub const SERVICE_NAME: &str = "ora.executors.v1.ExecutionService";
482    impl<T> tonic::server::NamedService for ExecutionServiceServer<T> {
483        const NAME: &'static str = SERVICE_NAME;
484    }
485}