use crate::tier::Tier;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum UnavailableReason {
Partition,
QuorumUnreachable,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Outcome {
Committed(Tier),
Local,
Stale { lag_ops: usize },
Unavailable(UnavailableReason),
}
impl Outcome {
pub fn is_committed(&self) -> bool {
matches!(self, Outcome::Committed(_))
}
pub fn is_available(&self) -> bool {
!matches!(self, Outcome::Unavailable(_))
}
pub fn tier(&self) -> Option<Tier> {
match self {
Outcome::Committed(tier) => Some(*tier),
_ => None,
}
}
}