armdb 0.10.0

sharded bitcask key-value storage optimized for NVMe
Documentation
//! Transaction-log checkpoint: durable-flush participants, then retire applied
//! records at or below the cut.

use crate::armour::Db;
use crate::error::DbResult;
use crate::sync::lock;

/// Retire everything that is applied, at or below the cut, and durable.
///
/// The cut is one below the lowest transaction id currently in flight, so a
/// commit that started before the checkpoint cannot have its record retired
/// while its apply is still running.
pub(crate) fn run(db: &Db) -> DbResult<usize> {
    let cut = db.txlog().in_flight_floor();
    if cut == 0 {
        return Ok(0);
    }
    for c in lock(&db.collections).iter() {
        c.durable_flush()?;
    }
    db.txlog().checkpoint(cut)
}