v-authorization-impl
LMDB and MDBX implementation for Veda authorization system.
Description
This crate provides LMDB-based and libmdbx-based storage backends for the Veda authorization framework. It implements the AuthorizationContext trait from v_authorization crate using two different database engines:
- LMDB (via heed) - stable, well-tested
- libmdbx - modern fork of LMDB with improvements
Features
- High-performance authorization data storage
- Support for two database backends (LMDB and libmdbx)
- Optional caching layer for improved performance
- Statistics collection support
- Thread-safe read operations
- Separate database paths to prevent data corruption
Database Paths
To prevent accidental database corruption, different backends use different paths:
- LMDB:
./data/acl-indexes/(main),./data/acl-cache-indexes/(cache) - libmdbx:
./data/acl-mdbx-indexes/(main),./data/acl-cache-mdbx-indexes/(cache)
Usage
Using LMDB backend (heed)
use ;
// Create with default settings
let mut az_ctx = default;
// Create with custom max read counter
let mut az_ctx = new;
// Create with full configuration
let mut az_ctx = new_with_config;
Using libmdbx backend
use ;
// Create with default settings
let mut az_ctx = default;
// Create with custom max read counter
let mut az_ctx = new;
// Create with full configuration
let mut az_ctx = new_with_config;
Using unified context (recommended)
use ;
// Choose database type at runtime
let db_type = Mdbx; // or AzDbType::Lmdb
// Create with default settings
let mut az_ctx = new;
// Create with full configuration
let mut az_ctx = new_with_config;
Configuration
The context can be configured with:
max_read_counter: Number of authorization operations before database reconnectionstat_collector_url: Optional URL for statistics collectionstat_mode: Statistics collection mode ("full", "minimal", or "none")use_cache: Enable/disable authorization cache
Dependencies
heed: LMDB Rust bindingslibmdbx: Modern LMDB forkv_authorization: Core authorization frameworknng: Nanomsg-next-generation for statistics reporting