dart_db 0.2.0
dart_db: ^0.2.0 copied to clipboard
High-performance embedded key-value database for Dart server applications. LMDB-powered with Rust FFI backend. Perfect for APIs, microservices, and backend systems.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased #
0.2.0 - 2025-08-27 #
π Major Simplification & Server Focus #
Added #
- π¦ Published on pub.flutter-io.cn - Easy installation with
dart pub add dart_db
- π§ Simplified JSON handling - Direct
jsonEncode
/jsonDecode
approach - π Simple path resolution - Standard system conventions (no complex hardcoded paths)
- π₯οΈ Server-first design - Explicitly focused on server applications only
- β‘ Improved performance - Streamlined operations and reduced overhead
Changed #
- BREAKING: Simplified API focused on server use cases only
- BREAKING: Removed complex path resolution in favor of standard conventions
- BREAKING: Only functions that exist in Rust backend are exposed
- Streamlined JSON response parsing
- Updated documentation with server-focused examples
- Enhanced error messages for better debugging
Removed #
- BREAKING: Removed
stats()
method (not implemented in Rust backend) - BREAKING: Removed mobile/Flutter compatibility (server-only now)
- Complex hardcoded path arrays
- Redundant JSON parsing layers
Fixed #
- Path resolution using proper
path
package conventions - Corrected FFI bindings to match actual Rust function signatures
- Simplified database operations for better reliability
- Fixed
exists()
,keys()
, andall()
methods implementation
Technical Improvements #
- Direct
jsonEncode
/jsonDecode
instead of complex parsing - Simplified
ServerPathHelper
with standard path conventions - Fallback implementations for optional Rust functions
- Better error handling for missing backend functions
0.1.0 - 2025-01-26 #
Added #
- Initial release of DartDB
- High-performance embedded key-value database for pure Dart backend applications
- Built on LMDB (Lightning Memory-Mapped Database) with Rust FFI integration
- Core database operations:
set(key, value)
- Store data with any JSON-serializable typeget<T>(key)
- Retrieve data with optional type castingget<T>(key, defaultValue)
- Retrieve data with default fallbackexists(key)
- Check if key existsdelete(key)
- Remove datakeys()
- Get all keyskeys(pattern)
- Get keys matching pattern
- Batch operations:
setMultiple(Map<String, dynamic>)
- Set multiple values at oncegetMultiple(List<String>)
- Get multiple values at oncedeleteMultiple(List<String>)
- Delete multiple keys at once
- Advanced operations:
increment(key, by)
- Increment numeric valuesdecrement(key, by)
- Decrement numeric valuessetWithTTL(key, value, duration)
- Set with expiration timestats()
- Get database statistics
- Transaction support:
transaction((txn) async { ... })
- Execute write operations in transactionreadTransaction((txn) async { ... })
- Execute read-only transaction
- Configurable database options:
- Maximum database size configuration
- Read-only mode support
- Custom sync modes (full, lazy, none)
- Compression settings with LZ4 algorithm
- Maximum readers configuration
- Cross-platform support for Linux, macOS, and Windows
- ACID compliance with full transaction support
- Memory-efficient operation with memory-mapped files
- Redis-like API for familiar key-value operations
- Comprehensive error handling and type safety
- Built-in logging with configurable log levels
- Environment variable configuration support
- In-memory database option (
:memory:
) for testing - Full JSON serialization support for complex Dart objects
- Performance optimizations:
- Up to 1M+ read operations per second
- Up to 100K+ write operations per second
- Microsecond-level latency for basic operations
- Efficient batch operations for bulk data handling
- Low memory footprint with memory-mapped storage
- Complete test suite with comprehensive coverage
- Extensive documentation with practical examples:
- Web API caching implementation
- Session storage system
- Configuration management
- Troubleshooting guide
- Performance benchmarks
- MIT License for open source usage
- Ready for pub.flutter-io.cn publication
Technical Details #
- Built with Dart SDK 3.0.0+ compatibility
- FFI integration with Rust for native performance
- LMDB engine for proven reliability and speed
- Memory-mapped file I/O for optimal performance
- Multi-reader, single-writer concurrency model
- Crash-safe operation with automatic recovery
- Flexible data serialization supporting all JSON-compatible types
Use Cases #
- Caching layer for backend applications
- Session storage with persistence
- Configuration and metadata storage
- Job queue and task scheduling
- Metrics collection and analytics
- Embedded analytics and data processing
- High-performance key-value operations in pure Dart environments