rollblock 0.4.1

A super-fast, block-oriented and rollbackable key-value store.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Filesystem helpers shared by persistence components.

pub mod store_lock;

pub use store_lock::StoreLockGuard;

use crate::error::StoreResult;
use std::path::Path;

/// Sync directory entries to disk to guarantee metadata durability.
pub fn sync_directory(path: &Path) -> StoreResult<()> {
    // Opening directories is platform-dependent. `std::fs::File::open` works on Linux
    // and macOS as long as the path exists.
    let dir = std::fs::File::open(path)?;
    dir.sync_all()?;
    Ok(())
}