#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RemovalDirection {
Remove,
Restore,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RemovalPhase {
Present,
Removed,
Restoring,
Recreated,
Restored,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RemovalParticipant {
pub branch: Option<String>,
pub dirty_at_start: bool,
pub phase: RemovalPhase,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Removal {
pub direction: RemovalDirection,
pub participants: Vec<RemovalParticipant>,
pub retired_at: Option<u64>,
}
impl Removal {
pub fn restoration_complete(&self) -> bool {
self.direction == RemovalDirection::Restore
&& self
.participants
.iter()
.all(|p| matches!(p.phase, RemovalPhase::Present | RemovalPhase::Restored))
}
}
pub struct RemovalResult {
pub nothing_to_recover: bool,
pub task: crate::Task,
pub record: std::path::PathBuf,
pub operation: crate::Operation,
pub problem: Option<crate::Problem>,
pub mutation_started: bool,
pub inspected: bool,
pub record_available: bool,
pub needs_attention: bool,
}