nitrite_fjall_adapter

Crates.ionitrite_fjall_adapter
lib.rsnitrite_fjall_adapter
version0.1.0
created_at2025-12-16 19:47:04.877771+00
updated_at2025-12-16 19:47:04.877771+00
descriptionFjall storage adapter for Nitrite database - persistent LSM-tree storage
homepage
repositoryhttps://github.com/nitrite/nitrite-rust
max_upload_size
id1988525
size282,273
Anindya Chatterjee (anidotnet)

documentation

README

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::nitrite::Nitrite;
use nitrite_fjall_adapter::FjallModule;

// Create with default configuration
let storage = FjallModule::with_config()
    .db_path("/path/to/database")
    .build();

let db = Nitrite::builder()
    .load_module(storage)
    .open_or_create(None, None)
    .expect("Failed to create database");

Configuration Presets

Production Preset

Balanced settings for production workloads:

let storage = FjallModule::with_config()
    .production_preset()
    .db_path("/path/to/database")
    .build();

High Throughput Preset

Optimized for batch imports and write-heavy workloads:

let storage = FjallModule::with_config()
    .high_throughput_preset()
    .db_path("/path/to/database")
    .build();

Low Memory Preset

Reduced memory footprint for constrained environments:

let storage = FjallModule::with_config()
    .low_memory_preset()
    .db_path("/path/to/database")
    .build();

Custom Configuration

Override specific settings after applying a preset:

let storage = FjallModule::with_config()
    .production_preset()
    .block_cache_capacity(128 * 1024 * 1024)  // 128MB cache
    .fsync_frequency(50)                       // More frequent fsyncs
    .db_path("/path/to/database")
    .build();

Persistence

// Write data
let collection = db.collection("items").unwrap();
collection.insert(doc!{"key": "value"}).unwrap();

// Commit changes to disk
db.commit().unwrap();

// Close database
db.close().unwrap();

License

Apache License 2.0

Commit count: 0

cargo fmt