ora 0.12.7

Part of the Ora scheduler framework.
Documentation
// This file is @generated by prost-build.
/// Definition of a job type.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct JobType {
    /// The ID of the job type.
    ///
    /// The ID must only contain ASCII letters (a-z, A-Z), digits (0-9), and underscores.
    /// It must start with an ASCII letter (a-z, A-Z).
    ///
    /// Examples of valid job IDs: "MyJob", "MyJob123", "send_email", "data_backup"
    ///
    /// Optionally the ID can be prefixed with one or more namespaces
    /// separated by dots. Each namespace must follow the same rules as the ID.
    ///
    /// Examples of valid namespaced job IDs: "com.example.SendEmail", "org.myorg.jobs.MyJob", "data_service.CreateBackup"
    #[prost(string, tag = "1")]
    pub id: ::prost::alloc::string::String,
    /// The description of the job type.
    #[prost(string, optional, tag = "3")]
    pub description: ::core::option::Option<::prost::alloc::string::String>,
    /// The input JSON schema of the job type.
    #[prost(string, optional, tag = "4")]
    pub input_schema_json: ::core::option::Option<::prost::alloc::string::String>,
    /// The output JSON schema of the job type.
    #[prost(string, optional, tag = "5")]
    pub output_schema_json: ::core::option::Option<::prost::alloc::string::String>,
}
impl ::prost::Name for JobType {
    const NAME: &'static str = "JobType";
    const PACKAGE: &'static str = "ora.jobs.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.jobs.v1.JobType".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.jobs.v1.JobType".into()
    }
}
/// Definition of a job.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Job {
    /// The ID of the job type.
    #[prost(string, tag = "1")]
    pub job_type_id: ::prost::alloc::string::String,
    /// The target execution time of the job.
    #[prost(message, optional, tag = "2")]
    pub target_execution_time: ::core::option::Option<::prost_types::Timestamp>,
    /// The job input payload JSON that is passed to the executor.
    #[prost(string, tag = "3")]
    pub input_payload_json: ::prost::alloc::string::String,
    /// The labels of the job.
    #[prost(message, repeated, tag = "4")]
    pub labels: ::prost::alloc::vec::Vec<super::super::common::v1::Label>,
    /// The timeout policy of the job.
    #[prost(message, optional, tag = "5")]
    pub timeout_policy: ::core::option::Option<TimeoutPolicy>,
    /// Retry policy for the job.
    #[prost(message, optional, tag = "6")]
    pub retry_policy: ::core::option::Option<RetryPolicy>,
}
impl ::prost::Name for Job {
    const NAME: &'static str = "Job";
    const PACKAGE: &'static str = "ora.jobs.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.jobs.v1.Job".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.jobs.v1.Job".into()
    }
}
/// Timeout policy for a job.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TimeoutPolicy {
    /// The timeout for the job.
    #[prost(message, optional, tag = "1")]
    pub timeout: ::core::option::Option<::prost_types::Duration>,
    /// The base time for the timeout.
    ///
    /// The timeout is calculated from this time.
    #[prost(enumeration = "TimeoutBaseTime", tag = "2")]
    pub base_time: i32,
}
impl ::prost::Name for TimeoutPolicy {
    const NAME: &'static str = "TimeoutPolicy";
    const PACKAGE: &'static str = "ora.jobs.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.jobs.v1.TimeoutPolicy".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.jobs.v1.TimeoutPolicy".into()
    }
}
/// Retry policy for a job.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RetryPolicy {
    /// The number of retries for the job.
    ///
    /// If the number of retries is zero, the job is not retried.
    #[prost(uint64, tag = "1")]
    pub retries: u64,
    /// The backoff duration between retries.
    ///
    /// By default, the backoff duration is zero,
    /// which means that the job is retried immediately after a failure.
    #[prost(message, optional, tag = "2")]
    pub backoff_duration: ::core::option::Option<::prost_types::Duration>,
    /// The maximum backoff duration between retries.
    ///
    /// If the backoff duration is greater than the maximum backoff duration,
    /// the backoff duration is capped at the maximum backoff duration.
    ///
    /// This option is only applicable when the backoff strategy is exponential.
    #[prost(message, optional, tag = "3")]
    pub max_backoff_duration: ::core::option::Option<::prost_types::Duration>,
    /// The backoff strategy for retries.
    #[prost(enumeration = "BackoffStrategy", tag = "4")]
    pub backoff_strategy: i32,
}
impl ::prost::Name for RetryPolicy {
    const NAME: &'static str = "RetryPolicy";
    const PACKAGE: &'static str = "ora.jobs.v1";
    fn full_name() -> ::prost::alloc::string::String {
        "ora.jobs.v1.RetryPolicy".into()
    }
    fn type_url() -> ::prost::alloc::string::String {
        "/ora.jobs.v1.RetryPolicy".into()
    }
}
/// The base time for the timeout.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TimeoutBaseTime {
    /// The base time is unspecified and depends on the implementation.
    Unspecified = 0,
    /// The base time is the target execution time of the job.
    ///
    /// Note that if the target execution time is not set,
    /// the timeout is calculated from the start time of the job.
    ///
    /// If the target execution time is in the past,
    /// the jobs may be immediately timed out.
    TargetExecutionTime = 1,
    /// The base time is the start time of the job.
    StartTime = 2,
}
impl TimeoutBaseTime {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "TIMEOUT_BASE_TIME_UNSPECIFIED",
            Self::TargetExecutionTime => "TIMEOUT_BASE_TIME_TARGET_EXECUTION_TIME",
            Self::StartTime => "TIMEOUT_BASE_TIME_START_TIME",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "TIMEOUT_BASE_TIME_UNSPECIFIED" => Some(Self::Unspecified),
            "TIMEOUT_BASE_TIME_TARGET_EXECUTION_TIME" => Some(Self::TargetExecutionTime),
            "TIMEOUT_BASE_TIME_START_TIME" => Some(Self::StartTime),
            _ => None,
        }
    }
}
/// The backoff strategy for retries.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum BackoffStrategy {
    /// The backoff strategy is unspecified and depends on the implementation.
    Unspecified = 0,
    /// The backoff strategy is fixed, which means that the backoff duration is constant between retries.
    Fixed = 1,
    /// The backoff strategy is exponential, which means that the backoff duration increases exponentially between retries.
    Exponential = 2,
}
impl BackoffStrategy {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "BACKOFF_STRATEGY_UNSPECIFIED",
            Self::Fixed => "BACKOFF_STRATEGY_FIXED",
            Self::Exponential => "BACKOFF_STRATEGY_EXPONENTIAL",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "BACKOFF_STRATEGY_UNSPECIFIED" => Some(Self::Unspecified),
            "BACKOFF_STRATEGY_FIXED" => Some(Self::Fixed),
            "BACKOFF_STRATEGY_EXPONENTIAL" => Some(Self::Exponential),
            _ => None,
        }
    }
}