-
Notifications
You must be signed in to change notification settings - Fork 0
10 Crash Recovery and Data Portability
Corresponding Specifications:
sys-arch/09-crash-recovery-architecture.md,sys-arch/33-backup-restore-export-import-archival-portability-architecture.md,sys-arch/ui-ux-16-backup-restore-export-migration-architecture.md
Key Crates:crates/siar-storage,crates/siar-crypto
Mobile devices frequently face sudden power loss, low-memory process kills (Android OOM killer), and OS hard crashes. SIAR's storage subsystem enforces strict crash-consistency invariants:
[Incoming State Mutation]
|
v
[Append to Write-Ahead Log (WAL)] ---> (fsync barrier)
|
v
[Apply to In-Memory Stoolap Tables]
|
v
[Checkpoint / Flush to Disk Pages] ---> (Periodic / Clean Shutdown)
- Journal Replay: On engine startup, the system scans the WAL for uncheckpointed transactions.
- Atomic Roll-Forward: Completed transactions with valid checksums are applied to primary tables.
- Orphaned Chunk Pruning: Incomplete blob chunk writes from interrupted transfers are automatically detected and staged for resumption without corrupting the existing database.
SIAR provides sovereign, zero-knowledge archival export. The resulting archive contains the complete encrypted identity, cryptographic key material, contact trust stores, and message history:
+-------------------------------------------------------------------------------+
| SIAR Encrypted Archive Header |
| - Magic Header: "SIAR_BAK_V1" (12 bytes) |
| - Argon2id Salt (16 bytes) + KDF Parameters (Memory: 64MB, Iterations: 4) |
| - AEAD Nonce (12 bytes) |
+-------------------------------------------------------------------------------+
| Encrypted Payload (ChaCha20-Poly1305) |
| - Stoolap DB Database Dump (SQL dump or binary SQLite/Stoolap stream) |
| - Merkle Blob Store Root & Manifest Index |
| - Identity Root Certificates & Encrypted Private Keystore |
+-------------------------------------------------------------------------------+
| BLAKE3 Authentication Tag (16 bytes) |
+-------------------------------------------------------------------------------+
sequenceDiagram
actor User as User Device
participant Engine as SIAR Backup Engine
participant Disk as Local Storage / External SD
User->>Engine: Initiate Backup with Passphrase ("correct horse battery staple")
Engine->>Engine: Generate 16-byte Cryptographic Salt
Engine->>Engine: Derive Master Key = Argon2id(Passphrase, Salt, Memory=64MB)
Engine->>Engine: Dump Stoolap Database Tables to Tar Stream
Engine->>Engine: Stream Encrypt via ChaCha20-Poly1305 AEAD
Engine->>Disk: Write "siar-backup-2026-08-25.siarbackup"
Engine-->>User: Backup Complete (SHA-256 Checksum Displayed)
When upgrading to a new phone or laptop, users can migrate their complete account and message database directly over local Wi-Fi Direct or high-speed BLE without cloud intermediaries:
- Authentication: New device generates an ephemeral key; old device scans pairing QR code.
- Channel Encryption: Ephemeral X25519 handshake derives a one-time TLS/Iroh direct tunnel.
- P2P Streaming: Old device streams compressed, encrypted database snapshots and media blobs directly to the new device with real-time transfer progress.
-
Instant Handoff: Once verified, the new device activates generation
$N+1$ certificate, and the old device transitions to secondary status.
SIAR — Survivable Identity & Autonomous Routing
Open Source Mesh & DTN Communications Platform | Dual Licensed under MIT / Apache-2.0 / Commercial
Documentation Index • GitHub Repository • System Specifications
- 04-Autonomous-Routing-and-Policy-Engine
- 05-Proximity-and-Hardware-Transports
- 06-Delay-Tolerant-Networking-and-Bundle-Forwarding
- 07-Battery-Aware-Scheduling-and-Emergency-Mesh
- 08-Offline-Event-Log-and-Outbox-Engine
- 09-Robust-Blob-Storage-and-Chunk-Transfers
- 10-Crash-Recovery-and-Data-Portability
- 11-Realtime-Audio-Video-Calling-Architecture
- 12-Cross-Platform-Client-Architecture
- 13-Messaging-Timeline-Composer-and-Inbox
- 14-Contacts-Groups-and-Security-Center
- 15-Nearby-Discovery-and-Out-of-Band-Pairing
- 16-Notifications-Presence-and-Background-Lifecycle
- 17-Local-Knowledge-Retrieval-and-Search
- 25-Design-System-Tokens-and-Responsive-Layouts
- 26-UI-UX-Performance-Testing-and-Quality-Gates
- 18-Protocol-Extensions-and-WASM-Plugins
- 19-Headless-Daemons-and-Embedded-Nodes
- 20-C-ABI-FFI-and-Native-Language-Bindings
- 21-Testing-Fuzzing-and-Network-Diagnostics
- 22-Getting-Started-and-Developer-Guide
- 23-Off-Grid-Survival-and-Field-Operations-Guide
- 24-System-Comparison-and-Benchmarking