Skip to content

LEDazzio01/LokiKV

Repository files navigation

LokiKV: High-Performance Persistent LSM-Tree Engine

CI

LokiKV is a specialized Key-Value storage engine built with Modern C++20, focusing on Data Durability (WAL), Thread-Safety (Shared Mutex), and Binary Persistence (SSTables).

🛠 Architectural Pillars

  • Durability Layer (WAL): Every write is serialized to an append-only binary Log-Structured file before hitting memory, ensuring 100% recovery from system crashes.

  • Concurrency Layer (MemTable): Utilizes std::shared_mutex to implement a high-performance Reader-Writer pattern, allowing concurrent lookups while maintaining exclusive write integrity.

  • Persistence Layer (SSTable): Implements immutable on-disk storage with a Binary Index Footer, enabling $O(\log N)$ point-lookups without loading the entire dataset into memory.

  • Compaction Engine: Background multi-way merge-sort logic leveraging C++20 std::jthread and std::stop_token for graceful, leak-free termination.

🧪 Test-Driven Development (TDD) Roadmap

This project was built following a strict "Red-Green-Refactor" cycle, verified by Catch2 and AddressSanitizer (ASan).

Phase Component Verification
Phase 1 WAL Asserted that cleared MemTables can be reconstructed from binary logs
Phase 2 MemTable Verified thread-safety by simulating 1,000+ concurrent writes across multiple worker threads
Phase 3 SSTable Validated on-disk binary search logic and footer-offset calculation
Phase 4 Integration Full engine orchestration tests ensuring cohesive interaction between all layers

🚀 Technical Specifications

Specification Technology
Language C++20
Build System CMake + Ninja
Dependency Management vcpkg + Vendored Headers (GSL, Catch2)
Memory Safety Strict adherence to Microsoft GSL (Guidelines Support Library) using gsl::span
CI/CD GitHub Actions automation with ASan validation for memory leak prevention

📦 Build & Run

# Configure with AddressSanitizer for safety verification
cmake -S . -B build -DCMAKE_CXX_FLAGS="-fsanitize=address"
cmake --build build

# Run the comprehensive test suite
./build/Integration_Tests

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published