Persistence and Recovery
Persistence Model
Section titled “Persistence Model”Vaylix currently uses:
- encrypted snapshots
- segmented encrypted WAL
- a manifest describing the durable snapshot baseline
- storage format version
3 - MessagePack-based engine serialization inside encrypted persistence files
- persisted binary-safe values and value versions in WAL, snapshots, replication snapshots, and logical backups
Snapshot Flow
Section titled “Snapshot Flow”- purge expired keys
- optionally rotate the active storage key
- seal the active WAL segment
- serialize the in-memory state
- encrypt the snapshot payload
- write a temp snapshot file
fsyncthe temp file- atomically rename it into place
- write the manifest
fsyncthe manifest- create a new active WAL segment
- prune sealed segments older than retention
Recovery Flow
Section titled “Recovery Flow”- load or create the keyring
- load the manifest
- verify and decrypt the snapshot
- deserialize the snapshot state
- replay and verify retained WAL segments on top of it
WAL Behavior
Section titled “WAL Behavior”WAL lives under:
<data-dir>/wal/Current segment naming:
- active segment:
active-<start_sequence>.wal - sealed segment:
<start_sequence>-<end_sequence>.wal
Each WAL entry is:
- serialized
- encrypted
- checksummed
- appended using the configured sync policy
The current engine treats one WAL entry as the atomic durability unit for committed changes.
In 0.8.0, value-bearing WAL operations preserve exact byte payloads and the
stored u64 value version used by compare-and-set writes.
Storage Keyring
Section titled “Storage Keyring”At-rest encryption is server-managed.
- there is no user-facing data-key flag
- new persisted data is encrypted with the active storage key
- older data can still be decrypted with retained previous keys
- recovery fails closed on key mismatch, authentication failure, checksum mismatch, or unsupported storage format
Logical Backup and Restore
Section titled “Logical Backup and Restore”Logical backup commands are separate from physical snapshotting.
Current commands:
backupbackup to <path>backup verify <logical-dump-json>backup verify from <path>restore <logical-dump-json>restore from <path>restore check <logical-dump-json>restore check from <path>
File-backed backups use a sidecar:
<backup>.manifest.jsonThat manifest records the backup version, creation time, source sequence, entry count, byte length, SHA-256 digest, and hash algorithm.
As of 0.8.0, new logical backups use v2 with base64 value encoding so opaque
byte payloads round-trip correctly. Existing v1 text logical backups are still
restorable.
Offline Storage and PITR Operations
Section titled “Offline Storage and PITR Operations”The server binary provides offline commands for storage verification, migration, and PITR-oriented restore:
vaylix storage verify --data-dir /var/lib/vaylixvaylix storage migrate --data-dir /var/lib/vaylixvaylix pitr inspect --data-dir /var/lib/vaylixvaylix pitr restore \ --source-dir /var/lib/vaylix \ --target-dir /tmp/vaylix-restore \ --to-sequence 1234Current PITR scope is offline-first only. Restore writes a new target directory and does not mutate the source data directory in place.