Restart Policy
add RestartPolicy message and integrate into ChildProcess configuration on both proto and rust structs
This commit is contained in:
parent
dd4b0f7f9f
commit
101577a784
@ -30,10 +30,20 @@ message EnvironmentEntry {
|
|||||||
string value = 2;
|
string value = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message RestartPolicy {
|
||||||
|
uint32 max_retries = 1;
|
||||||
|
uint32 delay_seconds = 2;
|
||||||
|
oneof policy {
|
||||||
|
bool ALWAYS = 3;
|
||||||
|
bool ON_NON_ZERO_EXIT = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Represents a child process configuration
|
// Represents a child process configuration
|
||||||
message ChildProcess {
|
message ChildProcess {
|
||||||
string path = 1;
|
string path = 1;
|
||||||
repeated string arguments = 2;
|
repeated string arguments = 2;
|
||||||
|
RestartPolicy restart_policy = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
service ConfigManager {
|
service ConfigManager {
|
||||||
|
19
src/lib.rs
19
src/lib.rs
@ -33,6 +33,23 @@ pub mod config {
|
|||||||
#[prost(string, tag = "2")]
|
#[prost(string, tag = "2")]
|
||||||
pub value: String,
|
pub value: String,
|
||||||
}
|
}
|
||||||
|
#[derive(Clone, Serialize, Deserialize, prost::Message)]
|
||||||
|
pub struct RestartPolicy {
|
||||||
|
#[prost(uint32, tag = "1")]
|
||||||
|
max_retries: u32,
|
||||||
|
#[prost(uint32, tag = "2")]
|
||||||
|
delay_seconds: u32,
|
||||||
|
#[prost(oneof = "RestartPolicyType", tags = "3, 4")]
|
||||||
|
policy: Option<RestartPolicyType>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Serialize, Deserialize, prost::Oneof)]
|
||||||
|
pub enum RestartPolicyType {
|
||||||
|
#[prost(bool, tag = "3")]
|
||||||
|
Always(bool),
|
||||||
|
#[prost(bool, tag = "4")]
|
||||||
|
OnNonZeroExit(bool),
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Serialize, Deserialize, prost::Message)]
|
#[derive(Clone, Serialize, Deserialize, prost::Message)]
|
||||||
pub struct ChildProcess {
|
pub struct ChildProcess {
|
||||||
@ -40,6 +57,8 @@ pub mod config {
|
|||||||
pub path: String,
|
pub path: String,
|
||||||
#[prost(string, repeated, tag = "2")]
|
#[prost(string, repeated, tag = "2")]
|
||||||
pub arguments: Vec<String>,
|
pub arguments: Vec<String>,
|
||||||
|
#[prost(message, optional, tag = "3")]
|
||||||
|
restart_policy: Option<RestartPolicy>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Serialize, Deserialize, prost::Message)]
|
#[derive(Clone, Serialize, Deserialize, prost::Message)]
|
||||||
|
Loading…
Reference in New Issue
Block a user