#[cfg(feature = "bench")]
#[cfg(test)]
mod bench;
pub(crate) mod display_vec_progress;
pub(crate) mod entry;
pub(crate) mod id_val;
pub(crate) mod inflight;
pub(crate) mod inflight_id;
pub(crate) mod progress_stats;
pub(crate) mod stream_id;
pub(crate) mod vec_progress;
use std::borrow::Borrow;
use std::slice::Iter;
use id_val::IdVal;
#[allow(unused_imports)]
pub(crate) use inflight::Inflight;
pub(crate) use vec_progress::VecProgress;
use crate::quorum::QuorumSet;
pub(crate) trait Progress<ID, Ent, Prog, QS>
where
ID: PartialEq + 'static,
Ent: Borrow<Prog>,
Prog: PartialOrd + Clone,
QS: QuorumSet<ID>,
{
fn update_with<F>(&mut self, id: &ID, f: F) -> Result<&Prog, &Prog>
where F: FnOnce(&mut Ent);
fn update(&mut self, id: &ID, value: Ent) -> Result<&Prog, &Prog> {
self.update_with(id, |x| *x = value)
}
fn increase_to(&mut self, id: &ID, value: Ent) -> Result<&Prog, &Prog>
where Ent: PartialOrd {
self.update_with(id, |x| {
if value > *x {
*x = value;
}
})
}
#[allow(dead_code)]
fn try_get(&self, id: &ID) -> Option<&Ent>;
fn get_mut(&mut self, id: &ID) -> Option<&mut Ent>;
#[allow(dead_code)]
fn get(&self, id: &ID) -> &Ent;
#[allow(dead_code)]
fn quorum_accepted(&self) -> &Prog;
#[allow(dead_code)]
fn quorum_set(&self) -> &QS;
fn iter(&self) -> Iter<'_, IdVal<ID, Ent>>;
fn collect_mapped<F, T, C>(&self, f: F) -> C
where
F: Fn(&IdVal<ID, Ent>) -> T,
C: FromIterator<T>,
{
self.iter().map(f).collect()
}
fn upgrade_quorum_set(
self,
quorum_set: QS,
learner_ids: impl IntoIterator<Item = ID>,
default_v: impl Fn() -> Ent,
) -> Self;
fn is_voter(&self, id: &ID) -> Option<bool>;
}