ora 0.12.7

Part of the Ora scheduler framework.
Documentation
// This file is @generated by prost-build.
/// Request for `ExecutorConnection`.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecutorConnectionRequest {
    /// A message sent from the executor.
    #[prost(message, optional, tag = "1")]
    pub message: ::core::option::Option<ExecutorMessage>,
}
impl ::prost::Name for ExecutorConnectionRequest {
    const NAME: &'static str = "ExecutorConnectionRequest";
    const PACKAGE: &'static str = "ora.executors.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.executors.v1.ExecutorConnectionRequest".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.executors.v1.ExecutorConnectionRequest".into()
    }
}
/// Response for `ExecutorConnection`.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExecutorConnectionResponse {
    /// A message sent from the server.
    #[prost(message, optional, tag = "1")]
    pub message: ::core::option::Option<ServerMessage>,
}
impl ::prost::Name for ExecutorConnectionResponse {
    const NAME: &'static str = "ExecutorConnectionResponse";
    const PACKAGE: &'static str = "ora.executors.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.executors.v1.ExecutorConnectionResponse".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.executors.v1.ExecutorConnectionResponse".into()
    }
}
/// A message sent from the executor.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecutorMessage {
    /// The message.
    #[prost(oneof = "executor_message::ExecutorMessageKind", tags = "1, 2, 3, 4")]
    pub executor_message_kind: ::core::option::Option<executor_message::ExecutorMessageKind>,
}
/// Nested message and enum types in `ExecutorMessage`.
pub mod executor_message {
    /// The message.
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum ExecutorMessageKind {
        /// The capabilities of the executor.
        ///
        /// The executor must send the capabilities
        /// as the first message in the stream
        /// before any heartbeats, subsequent capabilities
        /// messages might be ignored.
        #[prost(message, tag = "1")]
        Capabilities(super::ExecutorCapabilities),
        /// The heartbeat request.
        #[prost(message, tag = "2")]
        Heartbeat(super::ExecutorHeartbeat),
        /// The execution has succeeded.
        #[prost(message, tag = "3")]
        ExecutionSucceeded(super::ExecutionSucceeded),
        /// The execution has failed.
        #[prost(message, tag = "4")]
        ExecutionFailed(super::ExecutionFailed),
    }
}
impl ::prost::Name for ExecutorMessage {
    const NAME: &'static str = "ExecutorMessage";
    const PACKAGE: &'static str = "ora.executors.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.executors.v1.ExecutorMessage".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.executors.v1.ExecutorMessage".into()
    }
}
/// Capabilities of the executor and other information
/// that the server needs to know about the executor.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExecutorCapabilities {
    /// The name of the executor.
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// The job queue configurations of the executor.
    #[prost(message, repeated, tag = "2")]
    pub job_queues: ::prost::alloc::vec::Vec<ExecutorJobQueue>,
}
impl ::prost::Name for ExecutorCapabilities {
    const NAME: &'static str = "ExecutorCapabilities";
    const PACKAGE: &'static str = "ora.executors.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.executors.v1.ExecutorCapabilities".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.executors.v1.ExecutorCapabilities".into()
    }
}
/// A job queue configuration of the executor.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExecutorJobQueue {
    /// The job type of the queue.
    #[prost(message, optional, tag = "1")]
    pub job_type: ::core::option::Option<super::super::jobs::v1::JobType>,
    /// The maximum amount of concurrent executions allowed for this job type.
    #[prost(uint64, tag = "2")]
    pub max_concurrent_executions: u64,
}
impl ::prost::Name for ExecutorJobQueue {
    const NAME: &'static str = "ExecutorJobQueue";
    const PACKAGE: &'static str = "ora.executors.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.executors.v1.ExecutorJobQueue".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.executors.v1.ExecutorJobQueue".into()
    }
}
/// The heartbeat content.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExecutorHeartbeat {}
impl ::prost::Name for ExecutorHeartbeat {
    const NAME: &'static str = "ExecutorHeartbeat";
    const PACKAGE: &'static str = "ora.executors.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.executors.v1.ExecutorHeartbeat".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.executors.v1.ExecutorHeartbeat".into()
    }
}
/// A job execution has succeeded.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExecutionSucceeded {
    /// The ID of the job execution.
    #[prost(string, tag = "1")]
    pub execution_id: ::prost::alloc::string::String,
    /// The time when the job execution succeeded.
    #[prost(message, optional, tag = "2")]
    pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
    /// The output payload of the job.
    #[prost(string, tag = "3")]
    pub output_payload_json: ::prost::alloc::string::String,
}
impl ::prost::Name for ExecutionSucceeded {
    const NAME: &'static str = "ExecutionSucceeded";
    const PACKAGE: &'static str = "ora.executors.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.executors.v1.ExecutionSucceeded".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.executors.v1.ExecutionSucceeded".into()
    }
}
/// The job execution has failed.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExecutionFailed {
    /// The ID of the job execution.
    #[prost(string, tag = "1")]
    pub execution_id: ::prost::alloc::string::String,
    /// The time when the job execution failed.
    #[prost(message, optional, tag = "2")]
    pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
    /// The error message of the job.
    #[prost(string, tag = "3")]
    pub failure_reason: ::prost::alloc::string::String,
}
impl ::prost::Name for ExecutionFailed {
    const NAME: &'static str = "ExecutionFailed";
    const PACKAGE: &'static str = "ora.executors.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.executors.v1.ExecutionFailed".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.executors.v1.ExecutionFailed".into()
    }
}
/// A message sent from the server.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ServerMessage {
    /// The message.
    #[prost(oneof = "server_message::ServerMessageKind", tags = "1, 2, 3")]
    pub server_message_kind: ::core::option::Option<server_message::ServerMessageKind>,
}
/// Nested message and enum types in `ServerMessage`.
pub mod server_message {
    /// The message.
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum ServerMessageKind {
        /// The properties of the executor.
        #[prost(message, tag = "1")]
        Properties(super::ExecutorProperties),
        /// A job execution is ready to be executed by the executor.
        #[prost(message, tag = "2")]
        ExecutionReady(super::ExecutionReady),
        /// The job execution was cancelled and should be dropped by the executor.
        #[prost(message, tag = "3")]
        ExecutionCancelled(super::ExecutionCancelled),
    }
}
impl ::prost::Name for ServerMessage {
    const NAME: &'static str = "ServerMessage";
    const PACKAGE: &'static str = "ora.executors.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.executors.v1.ServerMessage".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.executors.v1.ServerMessage".into()
    }
}
/// Properties of the executor assigned by the server.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExecutorProperties {
    /// The ID given to the executor.
    #[prost(string, tag = "1")]
    pub executor_id: ::prost::alloc::string::String,
    /// The maximum interval between heartbeats.
    ///
    /// Executors should repeat the executor ping
    /// request at least every `max_heartbeat_interval`.
    ///
    /// Note that delays in the network or the server
    /// may cause the executor to miss the deadline,
    /// so the executor should send the heartbeat
    /// before the deadline to account for this.
    #[prost(message, optional, tag = "2")]
    pub max_heartbeat_interval: ::core::option::Option<::prost_types::Duration>,
}
impl ::prost::Name for ExecutorProperties {
    const NAME: &'static str = "ExecutorProperties";
    const PACKAGE: &'static str = "ora.executors.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.executors.v1.ExecutorProperties".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.executors.v1.ExecutorProperties".into()
    }
}
/// A job execution is ready to be executed by the executor.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExecutionReady {
    /// The ID of the job.
    #[prost(string, tag = "1")]
    pub job_id: ::prost::alloc::string::String,
    /// The execution ID of the job.
    #[prost(string, tag = "2")]
    pub execution_id: ::prost::alloc::string::String,
    /// The job type ID.
    #[prost(string, tag = "3")]
    pub job_type_id: ::prost::alloc::string::String,
    /// The attempt number of the job execution.
    ///
    /// The first attempt is 1.
    #[prost(uint64, tag = "4")]
    pub attempt_number: u64,
    /// The input payload of the job.
    #[prost(string, tag = "5")]
    pub input_payload_json: ::prost::alloc::string::String,
    /// The target execution time of the job.
    #[prost(message, optional, tag = "6")]
    pub target_execution_time: ::core::option::Option<::prost_types::Timestamp>,
}
impl ::prost::Name for ExecutionReady {
    const NAME: &'static str = "ExecutionReady";
    const PACKAGE: &'static str = "ora.executors.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.executors.v1.ExecutionReady".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.executors.v1.ExecutionReady".into()
    }
}
/// The job execution was cancelled and should be dropped by the executor.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExecutionCancelled {
    /// The ID of the job execution.
    #[prost(string, tag = "1")]
    pub execution_id: ::prost::alloc::string::String,
}
impl ::prost::Name for ExecutionCancelled {
    const NAME: &'static str = "ExecutionCancelled";
    const PACKAGE: &'static str = "ora.executors.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.executors.v1.ExecutionCancelled".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.executors.v1.ExecutionCancelled".into()
    }
}
/// Generated client implementations.
pub mod execution_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value
    )]
    use tonic::codegen::http::Uri;
    use tonic::codegen::*;
    /// Endpoint on the server for executors to connect to.
    #[derive(Debug, Clone)]
    pub struct ExecutionServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl<T> ExecutionServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> ExecutionServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                    http::Request<tonic::body::Body>,
                    Response = http::Response<
                        <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                    >,
                >,
            <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
                Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            ExecutionServiceClient::new(InterceptedService::new(inner, interceptor))
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// Long-lived bidirectional stream for the executor.
        pub async fn executor_connection(
            &mut self,
            request: impl tonic::IntoStreamingRequest<Message = super::ExecutorConnectionRequest>,
        ) -> std::result::Result<
            tonic::Response<tonic::codec::Streaming<super::ExecutorConnectionResponse>>,
            tonic::Status,
        > {
            self.inner.ready().await.map_err(|e| {
                tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
            })?;
            let codec = tonic_prost::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/ora.executors.v1.ExecutionService/ExecutorConnection",
            );
            let mut req = request.into_streaming_request();
            req.extensions_mut().insert(GrpcMethod::new(
                "ora.executors.v1.ExecutionService",
                "ExecutorConnection",
            ));
            self.inner.streaming(req, path, codec).await
        }
    }
}