Make fields public in RestartPolicy and ChildProcess structs; add default implementation for RestartPolicyType
This commit is contained in:
parent
a565b35b48
commit
1bbe16a85e
14
src/lib.rs
14
src/lib.rs
@ -36,11 +36,11 @@ pub mod config {
|
|||||||
#[derive(Clone, Serialize, Deserialize, prost::Message)]
|
#[derive(Clone, Serialize, Deserialize, prost::Message)]
|
||||||
pub struct RestartPolicy {
|
pub struct RestartPolicy {
|
||||||
#[prost(uint32, tag = "1")]
|
#[prost(uint32, tag = "1")]
|
||||||
max_retries: u32,
|
pub max_retries: u32,
|
||||||
#[prost(uint32, tag = "2")]
|
#[prost(uint32, tag = "2")]
|
||||||
delay_seconds: u32,
|
pub delay_seconds: u32,
|
||||||
#[prost(oneof = "RestartPolicyType", tags = "3, 4")]
|
#[prost(oneof = "RestartPolicyType", tags = "3, 4")]
|
||||||
policy: Option<RestartPolicyType>,
|
pub policy: Option<RestartPolicyType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Serialize, Deserialize, prost::Oneof)]
|
#[derive(Clone, Serialize, Deserialize, prost::Oneof)]
|
||||||
@ -51,6 +51,12 @@ pub mod config {
|
|||||||
OnNonZeroExit(bool),
|
OnNonZeroExit(bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for RestartPolicyType {
|
||||||
|
fn default() -> Self {
|
||||||
|
RestartPolicyType::Always(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Serialize, Deserialize, prost::Message)]
|
#[derive(Clone, Serialize, Deserialize, prost::Message)]
|
||||||
pub struct ChildProcess {
|
pub struct ChildProcess {
|
||||||
#[prost(string, tag = "1")]
|
#[prost(string, tag = "1")]
|
||||||
@ -58,7 +64,7 @@ pub mod config {
|
|||||||
#[prost(string, repeated, tag = "2")]
|
#[prost(string, repeated, tag = "2")]
|
||||||
pub arguments: Vec<String>,
|
pub arguments: Vec<String>,
|
||||||
#[prost(message, optional, tag = "3")]
|
#[prost(message, optional, tag = "3")]
|
||||||
restart: Option<RestartPolicy>,
|
pub restart: Option<RestartPolicy>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Serialize, Deserialize, prost::Message)]
|
#[derive(Clone, Serialize, Deserialize, prost::Message)]
|
||||||
|
Loading…
Reference in New Issue
Block a user