Fsck and WAL
Fsck and WAL in Strand Vault — write-ahead log replay, on-disk integrity checks, and automated repair on startup.
Purpose
Policy-aware strand vault with sessions, permissions, storage backends, WAL, fsck, snapshots, and replication.
This page follows the real source shape for Strand Vault and explains the workflow a developer is likely to use first.
Developer workflow
Start from the smallest constructor or builder, perform one meaningful operation, inspect the returned state, then add the relevant policy, storage, or network integration. The examples below should be expanded whenever the crate API changes.
WAL replay runs automatically on Vault::open. You do not need to call fsck manually unless open returns an integrity error or you suspect external file-system tampering.
Primary types to know
AgentPermissions— libs/strand-vault/src/permissions.rsAppendGuard— libs/strand-vault/src/vault.rsAtom— libs/strand-vault/src/vault.rsCreateOptions— libs/strand-vault/src/config.rsDefaultPolicy— libs/strand-vault/src/policy.rsFileMetadataStorage— libs/strand-vault/src/storage/filesystem.rsFileSystemStorage— libs/strand-vault/src/storage/filesystem.rsFileSystemStorageFactory— libs/strand-vault/src/storage/filesystem.rsFileStrandStorage— libs/strand-vault/src/storage/filesystem.rsFsckReport— libs/strand-vault/src/fsck.rsIndexingConfig— libs/strand-vault/src/config.rsLruStoragePool— libs/strand-vault/src/storage/mod.rs
Example shape
use strand_vault::wal::{Wal, WalEntry};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// The Wal lives at `<dir>/wal.log`. Every vault mutation appends a length-
// prefixed bincode WalEntry; replay re-applies them after a crash.
let dir = tempfile::tempdir()?;
let wal = Wal::new(dir.path());
wal.append(&WalEntry::SetNamespace("auditors".into())).await?;
wal.append(&WalEntry::Append {
strand: "audit-log".into(),
seq: 0,
size: 128,
}).await?;
wal.append(&WalEntry::Append {
strand: "audit-log".into(),
seq: 1,
size: 96,
}).await?;
// replay() yields each WalEntry in order so the vault can rebuild its state.
let mut applied = 0u32;
wal.replay(|_entry| { applied += 1; Ok(()) }).await?;
println!("wal_entries_replayed={applied}");
Ok(())
}Replication and Snapshots
Replication and snapshots in Strand Vault — periodic snapshots, incremental replication, and crash-consistent restore.
API Surface
Public API surface for `strand-vault`: 34 structs, 8 enums, 7 traits, 69 functions. Every exported item with its source path under `libs/strand-vault`.