Fast, synchronous, optionally-encrypted key-value store for Flutter powered by Rust
A high-performance, synchronous key-value store for Flutter apps with the storage engine written in Rust and bridged via flutter_rust_bridge. Provides zero-async-overhead reads and writes, TTL expiry, AES-256-GCM encryption with AAD binding, crash-safe WAL persistence, and reactive event streams.
Rodinia is a fast, synchronous, optionally-encrypted key-value store designed for Flutter applications. The core storage engine is built in Rust for maximum speed, memory safety, and deterministic performance, exposed seamlessly to Dart via flutter_rust_bridge.
Think of it as a local key-value cache and persistent store featuring TTLs, AES-256-GCM authenticated encryption, and a live reactive event stream — completely eliminating Future and asynchronous overhead for everyday reads and writes.
Rodinia is designed with clear layer separation, from the high-level ergonomic Dart API down to the low-level Rust storage engine:
Dart app
│
▼
RodiniaStore (rodinia_flutter/lib/rodinia_store.dart) ← ergonomic Dart API (set/get/watch/...)
│ calls generated bindings in lib/src/rust/api/store.dart
▼
api::store (rodinia_ffi/src/api/store.rs) ← #[frb] wire functions, the FFI surface
│ holds a process-wide `static STORE: OnceLock<Store>`
▼
Store (rodinia_ffi/src/store.rs) ← the actual engine
├── cache: RwLock<HashMap<String, Entry>> in-memory index
├── wal: Mutex<Wal> on-disk append-only log (crash recovery)
├── encryption_key: RwLock<Option<EncryptionKey>> AES-256-GCM, set at runtime
└── events: EventBus pub/sub → StreamSink<StorageEvent> to Dart
set, get, contains, delete, clear, keys, and len.Future allocations and microtask queuing on the common execution path, enabling instant state access in Flutter widget build methods and controllers.ttl duration on set).purgeExpired() reclaim memory for stale entries without blocking foreground operations.setEncryptionKey() installs an in-memory AES-256-GCM encryption key at runtime.encrypted: true on set encrypts values before writing to the log or memory.crypto.rs), preventing ciphertext swapping attacks between different keys.wal.rs) before updating the in-memory cache.Store::open automatically replays the WAL on initialization to rebuild state after app termination or crash.compact() defragments and rewrites the log file to retain only active, unexpired entries.watch(pattern) returns a typed Stream<StorageEvent> emitting events (KeyCreated, KeyUpdated, KeyDeleted, KeyExpired, StorageCleared).'*'), scoped prefixes ('auth.*'), and exact key subscriptions.increment(key, delta: ...) operation executed directly in Rust.The project is structured as a modular mono-repository:
rodinia/
├── rodinia_ffi/ # Standalone Rust crate (cargo test, no Flutter required)
│ ├── src/
│ │ ├── api/store.rs # #[frb] wire functions & FFI surface
│ │ ├── store.rs # In-memory index & store coordinator
│ │ ├── wal.rs # On-disk append-only Write-Ahead Log
│ │ ├── crypto.rs # AES-256-GCM encryption & AAD binding
│ │ └── events.rs # EventBus & pub/sub implementation
├── rodinia_flutter/ # Flutter plugin package
│ ├── lib/
│ │ ├── rodinia_store.dart # Ergonomic Dart public API
│ │ └── src/rust/ # Generated flutter_rust_bridge bindings
│ └── justfile # Generation scripts (just gen)
└── examples/
└── rodinia_flutter_example/ # Demo app showcasing CRUD, TTL, & reactive UI
flutter_rust_bridge Integration: Generates zero-copy, type-safe Dart-Rust bindings with support for synchronous wire functions and asynchronous streams.RwLock for concurrent multi-reader access to in-memory entries and Mutex on the WAL to serialize disk writes without blocking reads.rodinia_ffi can be compiled, benchmarked, and tested with standard cargo test independently of the Flutter toolchain.