froe 0.10.0

Reader and offline maintenance toolkit for Apache Jackrabbit Oak segment-tar (TarMK) repositories: parse archives and records, extract node data, compact, back up, and recover.
Documentation
//! A directory holding one journal for a rewrite to be pointed at.

use std::sync::atomic::{AtomicU64, Ordering};

pub(in crate::writer::maintenance) const FIRST: &str = "11111111-1111-4111-a111-111111111111:1";

pub(in crate::writer::maintenance) const SECOND: &str = "22222222-2222-4222-a222-222222222222:2";

pub(in crate::writer::maintenance) static NEXT_DIRECTORY: AtomicU64 = AtomicU64::new(0);

pub(in crate::writer::maintenance) struct TestDirectory {
    pub(in crate::writer::maintenance) path: std::path::PathBuf,
}

impl TestDirectory {
    pub(in crate::writer::maintenance) fn new(name: &str) -> Self {
        let serial = NEXT_DIRECTORY.fetch_add(1, Ordering::Relaxed);
        let path = std::env::temp_dir().join(format!(
            "froe-journal-maintenance-{name}-{}-{serial}",
            std::process::id()
        ));
        std::fs::create_dir(&path).expect("create test directory");
        Self { path }
    }

    pub(in crate::writer::maintenance) fn write_journal(&self, bytes: &[u8]) {
        std::fs::write(self.path.join("journal.log"), bytes).expect("write journal");
    }
}

impl Drop for TestDirectory {
    fn drop(&mut self) {
        let _ = std::fs::remove_dir_all(&self.path);
    }
}