Skip to main content

journal_check

Function journal_check 

Source
pub fn journal_check(tallies: &JournalTallies) -> DoctorCheck
Expand description

The journal check: whether the cooperation journal’s file holds what the journal holds. A failed append keeps the event in memory and in replication, loses it from this machine’s disk and is not acknowledged as durable; an unreadable line is one the last reload could not use; unread bytes lie beyond the reload bound.

use majordomus_cli::mesh::doctor::journal_check;
use majordomus_cli::mesh::journal::JournalTallies;
assert!(journal_check(&JournalTallies::default()).ok);
let lost = JournalTallies { write_failures: 2, ..Default::default() };
let check = journal_check(&lost);
assert!(!check.ok && check.detail.contains("2 event(s)"));
let beyond = JournalTallies { unread_bytes: 4096, ..Default::default() };
let check = journal_check(&beyond);
assert!(!check.ok && check.detail.contains("4096 byte(s)"));