Expand description
Internal component of the
noxudatabase.This crate is published only so the
noxuumbrella crate can depend on it. Usenoxu(noxu = "3") in applications; depend on this crate directly only if you are extending the engine internals. Its API may change without a major version bump.
Engine orchestration for Noxu DB.
Wires together all internal subsystems, manages daemon thread lifecycle, and coordinates environment open/close.
§Overview
The noxu-engine crate is the internal orchestration layer for Noxu DB.
It brings together all the subsystems built in earlier phases:
- noxu-dbi: EnvironmentImpl, DatabaseImpl, CursorImpl
- noxu-txn: Transaction and lock management
- noxu-evictor: Cache eviction
- noxu-cleaner: Log garbage collection
- noxu-recovery: Checkpointing and recovery
§Architecture
The Engine struct is the central coordination point. It:
- Creates and owns all subsystems
- Runs recovery on environment open
- Starts background daemon threads (evictor, cleaner, checkpointer)
- Coordinates orderly shutdown
- Provides unified access to all subsystems
§Usage
use noxu_engine::{Engine, EngineConfig};
// Open an environment
let config = EngineConfig::new("/data/mydb")
.cache_size(128 * 1024 * 1024)
.transactional(true);
let engine = Engine::open(config)?;
// Use the engine...
let stats = engine.get_stats();
println!("Cache usage: {:.1}%", stats.cache_utilization_percent());
// Explicitly close (or drop will close)
engine.close()?;§Configuration
Environment behavior is controlled via EngineConfig:
- Cache size and eviction settings
- Transaction and lock timeouts
- Daemon thread intervals
- Read-only mode
- Checkpoint and cleaning thresholds
§Background Daemons
Three daemon threads run in the background:
- Evictor: Evicts nodes from cache when memory budget is exceeded
- Cleaner: Garbage collects log files when utilization is low
- Checkpointer: Flushes dirty nodes to bound recovery time
All daemons can be individually enabled/disabled via configuration.
§Statistics
EnvironmentStats provides a unified view of all subsystem statistics:
- Cache usage and eviction metrics
- Cleaning progress and file statistics
- Checkpoint frequency and flush counts
- Database and transaction counts
Re-exports§
pub use daemon_manager::DaemonManager;pub use engine::Engine;pub use engine_config::EngineConfig;pub use env_stats::EnvironmentStats;pub use error::EngineError;pub use error::Result;pub use verify::VerifyConfig;pub use verify::VerifyError;pub use verify::VerifyResult;pub use verify::verify_database;pub use verify::verify_database_impl;pub use verify::verify_environment;pub use verify::verify_tree;
Modules§
- daemon_
manager - Background daemon lifecycle management.
- engine
- Main engine implementation for Noxu DB.
- engine_
config - Configuration for the Noxu DB engine.
- env_
stats - Aggregated environment statistics.
- error
- Error types for the Noxu DB engine.
- verify
- Environment verification utilities.