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