use std::fmt;
use display_more::DisplayOptionExt;
use crate::RaftTypeConfig;
use crate::Vote;
use crate::type_config::alias::LogIdOf;
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd)]
pub struct FlushPoint<C>
where C: RaftTypeConfig
{
pub vote: Vote<C::LeaderId>,
pub last_log_id: Option<LogIdOf<C>>,
}
impl<C> fmt::Display for FlushPoint<C>
where C: RaftTypeConfig
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "FlushPoint({}, {})", self.vote, self.last_log_id.display(),)
}
}
impl<C> FlushPoint<C>
where C: RaftTypeConfig
{
pub fn new(vote: Vote<C::LeaderId>, last_log_id: Option<LogIdOf<C>>) -> Self {
Self { vote, last_log_id }
}
}