Replication and Snapshots
Replication and snapshots in Strand Vault — periodic snapshots, incremental replication, and crash-consistent restore.
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.
Network contract
Document peer identity, topic selection, message framing, session lifetime, retry behavior, metrics, and what must be stable between releases. Any change here can strand peers, so examples should be exercised with at least two real processes.
For large vaults, ship a recent snapshot before opening a replication stream. Snapshot-bootstrap + tail replication is significantly faster than block-by-block backfill from genesis.
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::{ReplicationMode, ReplicationOptions, StrandId};
fn main() {
// ReplicationOptions describes a replication session against one or more
// strands. The vault hosts the schedule; mode picks Push / Pull / Sync.
let strands = vec![
StrandId::Name("audit-log".into()),
StrandId::Name("metrics".into()),
];
let live_pull = ReplicationOptions {
strands: strands.clone(),
mode: ReplicationMode::Pull,
live: true,
encrypted: true,
bandwidth_limit: Some(2 * 1024 * 1024), // 2 MiB/s cap
capability: Some(b"cap.v1.subscriber".to_vec()),
start_from: Some(vec![(strands[0].clone(), 0), (strands[1].clone(), 12)]),
};
let bulk_sync = ReplicationOptions {
strands,
mode: ReplicationMode::Sync,
live: false,
..ReplicationOptions::default()
};
println!(
"live_pull={:?} bulk_sync_streams={} encrypted_pull={}",
live_pull.mode,
bulk_sync.strands.len(),
live_pull.encrypted,
);
}