Nitrite Fjall Adapter
Persistent storage adapter for Nitrite using Fjall, an LSM-based key-value store.
Features
- Persistent Storage - Data survives process restarts
- LSM-tree Architecture - Optimized for write-heavy workloads
- Configurable Presets - Pre-configured settings for common use cases
- Custom Configuration - Fine-grained control over storage behavior
Usage
use Nitrite;
use FjallModule;
// Create with default configuration
let storage = with_config
.db_path
.build;
let db = builder
.load_module
.open_or_create
.expect;
Configuration Presets
Production Preset
Balanced settings for production workloads:
let storage = with_config
.production_preset
.db_path
.build;
High Throughput Preset
Optimized for batch imports and write-heavy workloads:
let storage = with_config
.high_throughput_preset
.db_path
.build;
Low Memory Preset
Reduced memory footprint for constrained environments:
let storage = with_config
.low_memory_preset
.db_path
.build;
Custom Configuration
Override specific settings after applying a preset:
let storage = with_config
.production_preset
.block_cache_capacity // 128MB cache
.fsync_frequency // More frequent fsyncs
.db_path
.build;
Persistence
// Write data
let collection = db.collection.unwrap;
collection.insert.unwrap;
// Commit changes to disk
db.commit.unwrap;
// Close database
db.close.unwrap;
License
Apache License 2.0