You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
3.2 KiB
Rust
128 lines
3.2 KiB
Rust
use crate::unit::JobMode::Replace;
|
|
use crate::time::{TimeSpan, FiniteTimeSpan};
|
|
use crate::time::TimeSpan::Infinite;
|
|
|
|
#[allow(dead_code)]
|
|
pub struct Unit {
|
|
description: String,
|
|
|
|
// Space only
|
|
documentation: Vec<String>,
|
|
|
|
// Space -and- list
|
|
wants: Vec<String>,
|
|
requires: Vec<String>,
|
|
requisite: Vec<String>,
|
|
binds_to: Vec<String>,
|
|
part_of: Vec<String>,
|
|
|
|
// Space only
|
|
conflicts: Vec<String>,
|
|
|
|
// Space -and- list
|
|
before: Vec<String>,
|
|
after: Vec<String>,
|
|
|
|
// Space only
|
|
on_failure: Vec<String>,
|
|
|
|
// Space -and- list
|
|
propagates_reload_to: Vec<String>,
|
|
propagates_reload_from: Vec<String>,
|
|
joins_namespace_of: Vec<String>,
|
|
requires_mounts_for: Vec<String>,
|
|
|
|
on_failure_job_mode: JobMode,
|
|
|
|
ignore_on_isolate: bool,
|
|
stop_when_unneeded: bool,
|
|
refuse_manual_start: bool,
|
|
refuse_manual_stop: bool,
|
|
allow_isolate: bool,
|
|
default_dependencies: bool,
|
|
collect_mode: CollectMode,
|
|
failure_action: UnitAction,
|
|
success_action: UnitAction,
|
|
failure_action_exit_status: u8,
|
|
success_action_exit_status: u8,
|
|
job_timeout_sec: TimeSpan,
|
|
job_running_timeout_sec: TimeSpan,
|
|
job_timeout_action: UnitAction,
|
|
job_timeout_reboot_argument: Option<String>,
|
|
start_limit_interval_sec: FiniteTimeSpan,
|
|
start_limit_burst: usize,
|
|
start_limit_action: UnitAction,
|
|
reboot_argument: Option<String>,
|
|
source_path: Option<String>,
|
|
}
|
|
|
|
impl Default for Unit {
|
|
fn default() -> Self {
|
|
Unit {
|
|
description: "".to_string(),
|
|
documentation: vec![],
|
|
wants: vec![],
|
|
requires: vec![],
|
|
requisite: vec![],
|
|
binds_to: vec![],
|
|
part_of: vec![],
|
|
conflicts: vec![],
|
|
before: vec![],
|
|
after: vec![],
|
|
on_failure: vec![],
|
|
propagates_reload_to: vec![],
|
|
propagates_reload_from: vec![],
|
|
joins_namespace_of: vec![],
|
|
requires_mounts_for: vec![],
|
|
on_failure_job_mode: Replace,
|
|
ignore_on_isolate: false,
|
|
stop_when_unneeded: false,
|
|
refuse_manual_start: false,
|
|
refuse_manual_stop: false,
|
|
allow_isolate: false,
|
|
default_dependencies: true,
|
|
collect_mode: CollectMode::Inactive,
|
|
failure_action: UnitAction::None,
|
|
success_action: UnitAction::None,
|
|
failure_action_exit_status: 0,
|
|
success_action_exit_status: 0,
|
|
job_timeout_sec: Infinite,
|
|
job_running_timeout_sec: Infinite,
|
|
job_timeout_action: UnitAction::None,
|
|
job_timeout_reboot_argument: None,
|
|
start_limit_interval_sec: Default::default(),
|
|
start_limit_burst: 0,
|
|
start_limit_action: UnitAction::None,
|
|
reboot_argument: None,
|
|
source_path: None,
|
|
}
|
|
}
|
|
}
|
|
|
|
enum JobMode {
|
|
Fail,
|
|
Replace,
|
|
ReplaceIrreversibly,
|
|
Isolate,
|
|
Flush,
|
|
IgnoreDependencies,
|
|
IgnoreRequirements,
|
|
}
|
|
|
|
enum CollectMode {
|
|
Inactive,
|
|
InactiveOrFailed,
|
|
}
|
|
|
|
enum UnitAction {
|
|
None,
|
|
Reboot(UnitActionSeverity),
|
|
PowerOff(UnitActionSeverity),
|
|
Exit(UnitActionSeverity),
|
|
}
|
|
|
|
enum UnitActionSeverity {
|
|
None,
|
|
Force,
|
|
Immediate,
|
|
} |