use crate::*;
pub struct Vacuum {
mvcc_id: Id,
latest: TxnId,
active: std::collections::BTreeSet<TxnId>
}
impl Vacuum {
pub fn new(mvcc: &Mvcc)->Vacuum {
Vacuum {
mvcc_id: mvcc.id(),
latest: *mvcc.current.lock(),
active: mvcc.txns.keys()
}
}
pub fn clean<T:?Sized>(&self, cell:&MvccCell<T>) {
assert_eq!(self.mvcc_id, cell.0.mvcc_id);
cell.0.history.lock().vacuum(self.latest, &self.active);
}
}