Expand description
§Noxu DB — umbrella crate
noxu is the single crate users depend on to get the full
Noxu DB engine. It re-exports the public API of all component crates
behind a single name and version so you write only:
[dependencies]
noxu = "3"§Quick-start
use noxu::{DatabaseConfig, DatabaseEntry, Environment, EnvironmentConfig};
use std::path::PathBuf;
let env = Environment::open(
EnvironmentConfig::new(PathBuf::from("/tmp/mydb"))
.with_allow_create(true)
.with_transactional(true),
)?;
let db_config = DatabaseConfig::new()
.with_allow_create(true)
.with_transactional(true);
let db = env.open_database(None, "kv", &db_config)?;
let txn = env.begin_transaction(None)?;
db.put(
Some(&txn),
&DatabaseEntry::from_bytes(b"hello"),
&DatabaseEntry::from_bytes(b"world"),
)?;
txn.commit()?;§Feature flags
| Feature | Default | What it enables |
|---|---|---|
collections | yes | collections module — StoredMap, StoredSet, StoredList |
persist | yes | persist module — #[derive(Entity)], PrimaryIndex, EntityStore |
xa | yes | xa module — XA two-phase-commit (XaEnvironment) |
replication | no | replication module — master-replica HA, elections |
replication-tls-rustls | no | TLS for replication via pure-Rust rustls |
replication-tls-native | no | TLS for replication via OS/OpenSSL |
observability | no | observe module — tracing + metrics glue |
§Derive macros
With the persist feature (on by default) the derive macros
Entity, PrimaryKey, and SecondaryKey are available directly
through this crate:
use noxu::persist::{Entity, SecondaryKey};
#[derive(Clone, Entity, SecondaryKey)]
struct User {
#[primary_key]
id: u64,
#[secondary_key(name = "by_email", relate = OneToOne)]
email: String,
}Modules§
- bind
- Binding helpers: tuple encoding, entry views, serial encoding.
- cache_
mode - Cache modes for database operations.
- checkpoint_
config - Configuration for manual checkpoint operations.
- collections
- Iterator-based collection views (
StoredMap,StoredSet,StoredList). - cursor
- Cursor handle for Noxu DB.
- cursor_
config - Cursor configuration.
- database
- Database handle.
- database_
config - Database configuration.
- database_
entry - Database entry for keys and data.
- database_
stats - Per-database statistics.
- db_iter
- Lazy iterator adapters for
crate::Database. - disk_
ordered_ cursor - Disk-ordered cursor for high-throughput unordered scans.
- durability
- Durability and sync policies for transactions.
- environment
- Environment handle.
- environment_
config - Environment configuration.
- environment_
mutable_ config - Runtime-mutable environment configuration.
- error
- Error types for Noxu DB.
- extinction_
filter - Filter interface for identifying extinct records.
- get
- Get operation types.
- join_
config - Configuration for JoinCursor.
- join_
cursor - Join cursor for multi-secondary-index intersection queries.
- lock_
mode - Lock modes for read operations.
- observe
- Optional observability integration (
tracing+metrics+ OpenTelemetry). - observe_
crate Internal component of the
noxudatabase.This crate is published only so thenoxuumbrella 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.- operation_
result - Result of database operations.
- operation_
status - Operation status for database operations.
- persist
- Trait-based entity persistence (DPL):
Entity,PrimaryKey,PrimaryIndex,EntityStore, and the derive macros. - preload
- Database preloading configuration and statistics.
- put
- Put operation types.
- read_
options - Read operation options.
- replication
- Master-replica high-availability replication.
- scan_
filter - Filter interface for sequential database scans.
- secondary_
config - Secondary database configuration.
- secondary_
cursor - Secondary cursor for iterating a secondary (index) database.
- secondary_
database - Secondary database handle.
- sequence
- Sequence handle.
- sequence_
config - Sequence configuration.
- sequence_
stats - Sequence statistics.
- stats_
config - Configuration for statistics retrieval operations.
- transaction
- Transaction handle for Noxu DB.
- transaction_
config - Transaction configuration.
- unimplemented_
params - Registry of
EnvironmentConfigparameters that are accepted but not yet implemented. - write_
options - Write operation options.
- xa
- XA distributed transactions (X/Open XA two-phase commit).
Structs§
- AckWait
Error - Error returned by
ReplicaAckCoordinator::await_replica_ackswhen the configured number of replica acks could not be obtained within the supplied timeout. - Btree
Stats - B-tree statistics for a single database.
- Checkpoint
Config - Specifies the attributes of a checkpoint operation invoked via
Environment::checkpoint. - Cursor
- A database cursor for iterating over records.
- Cursor
Config - Configuration for opening a cursor.
- Database
- A database handle.
- Database
Config - Configuration for opening a database.
- Database
Entry - Encodes database key and data items as byte arrays.
- Database
Stats - Base statistics type for a database.
- DbIter
- A forward-scanning iterator over all records in a database.
- DbRange
- A lazy key-range iterator over a database.
- Disk
Ordered Cursor - A cursor that returns records in on-disk order rather than key order.
- Disk
Ordered Cursor Config - Configuration for a
DiskOrderedCursor. - Durability
- Durability characteristics for a transaction.
- Environment
- A database environment.
- Environment
Config - Configuration for opening a Noxu DB environment.
- Environment
Mutable Config - The subset of environment properties that can be changed after the environment has been opened.
- Environment
Stats - Aggregated statistics for the environment.
- Exception
Event - An exception event delivered to an
ExceptionListener. - Exception
Listener Holder - Wrapper around an optional
ExceptionListenerthat implementsDebugandCloneso thatEnvironmentConfigcan keep those derives. - Join
Config - Configuration properties for a
JoinCursor. - Join
Cursor - A cursor that returns records satisfying all secondary-key constraints.
- Operation
Result - Result of a successful database operation.
- Preload
Config - Configuration for database preloading.
- Preload
Stats - Statistics returned from a database preload operation.
- Prepared
LnReplay - A single LN entry queued for replay when a recovered prepared
transaction is committed via
xa_commit(xid). - Prepared
TxnInfo - Information about a transaction that was found prepared (XA phase 1 completed) but not yet committed or rolled back.
- Read
Options - Options for read operations.
- Secondary
Config - Configuration for a secondary database.
- Secondary
Cursor - A cursor that iterates a secondary index database.
- Secondary
Database - A secondary (index) database handle.
- Sequence
- A handle for manipulating a sequence record stored in a
Database. - Sequence
Config - Specifies the attributes of a sequence.
- Sequence
Stats - Statistics for a
Sequencehandle. - Stats
Config - Specifies the attributes of a statistics retrieval operation.
- Transaction
- A transaction handle.
- Transaction
Config - Configuration for transactions.
- Verify
Config - Configuration for verification.
- Verify
Result - Result of an environment verification.
- Write
Options - Options for write operations.
Enums§
- AckWait
Error Kind - Reason an ack-wait did not satisfy the durability contract.
- Cache
Mode - Cache mode for database operations.
- Environment
Failure Reason - Distinguishes the root cause of an
EnvironmentFailure. - Exception
Source - The source subsystem that raised an exception event.
- Extinction
Status - Classification returned by
ExtinctionFilter::get_extinction_status. - Foreign
KeyDelete Action - Action taken when a record in a foreign key database is deleted.
- Get
- Type of get operation for cursors and databases.
- Lock
Mode - Lock mode for read operations.
- Noxu
Error - Errors that can occur when using Noxu DB.
- Operation
Status - Operation status returned by database and cursor operations.
- Prepared
LnOperation - LN operation type for a prepared-txn replay record.
- Put
- Type of put operation for cursors and databases.
- Replica
AckPolicy - Acknowledgment policy for replicated environments.
- Replica
AckPolicy Kind - Replica acknowledgment policy as visible to the durability path.
- Scan
Result - Result returned by
ScanFilter::check_keyto control scan inclusion and termination. - Sync
Policy - Sync policy for local commit synchronization.
- Verify
Error - Types of verification errors.
Traits§
- Exception
Listener - Callback interface for exceptions thrown in background daemon threads.
- Extinction
Filter - Callback for classifying records as extinct.
- Foreign
KeyNullifier - Callback trait for nullifying a single foreign key reference in primary data.
- Foreign
Multi KeyNullifier - Callback trait for nullifying multi-valued foreign key references.
- Replica
AckCoordinator - Coordinates with a replication subsystem to satisfy a replica-ack policy on commit.
- Scan
Filter - Interface for filtering and optionally stopping a sequential scan.
- Secondary
KeyCreator - Callback trait for creating a single secondary key from a primary record.
- Secondary
Multi KeyCreator - Callback trait for creating multiple secondary keys from a primary record.
Functions§
- open_
disk_ ordered_ cursor_ multi - Opens a disk-ordered cursor that scans entries from any of the given databases.
Type Aliases§
- Mutex
- Mutual exclusion primitive backed by a futex.
- Mutex
Guard - RAII guard returned by
Mutex::lock. - Result
- Result type for Noxu DB operations.
- Shared
Replica AckCoordinator - Type alias used in
noxu-db::Environmentto hold the optional installed coordinator.