Port HeroLib OurDB Package from V to Rust #1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Port HeroLib OurDB Package from V to Rust
Overview
This issue involves porting the
ourdb
package from the HeroLib V codebase to a Rust implementation. OurDB is a lightweight, efficient key-value database implementation that provides data persistence with history tracking capabilities. The port should maintain all existing functionality while leveraging Rust's memory safety, performance, and ecosystem.What is OurDB?
OurDB is a simple yet powerful key-value database designed for scenarios where you need fast key-value storage with the ability to track changes over time. It features a layered architecture with a frontend API, lookup table for efficient key-to-location mapping, and backend storage for actual data persistence.
Key characteristics:
Current Implementation Details
Architecture
OurDB consists of three main components working together in a layered architecture:
Frontend (db.v)
Lookup Table (lookup.v)
Backend Storage (backend.v)
Core Data Structures
The V implementation consists of these primary structures:
Key Operations
The current implementation provides these core operations:
Storage Format
Record Format
Each record in the backend storage includes:
Lookup Table Optimization
The lookup table automatically optimizes its key size based on the database configuration:
File Management
${path}/${file_nr}.db
${path}/lookup_dump.db
Implementation Details
Data Storage and Retrieval
Storage Process (set)
Retrieval Process (get)
History Tracking (get_history)
Lookup Table Management
The lookup table maps IDs to physical locations in the storage files. It supports:
File Management
OurDB supports multiple storage files:
Requirements for Rust Port
The Rust implementation should:
Proposed Rust Structure
Implementation Considerations
File I/O:
Memory Management:
Error Handling:
Concurrency:
Performance Optimizations:
Use Cases
OurDB is particularly useful for:
Acceptance Criteria
Resources
github/freeflowuniverse/herolib/lib/data/ourdb
architecture defined:
5c5225c8f7
ported with
0eedec9ed0