maph 1.0.0 High-Performance Memory-Mapped Key-Value Database with O(1) Lookups

Loading...
Searching...
No Matches
Classes | Namespaces | Functions
maph.hpp File Reference

Lean, mean, mmap-based perfect hash JSON mapping. More...

`#include <sys/mman.h>`
`#include <sys/stat.h>`
`#include <fcntl.h>`
`#include <unistd.h>`
`#include <cstring>`
`#include <string>`
`#include <memory>`
`#include <atomic>`
`#include <functional>`
Include dependency graph for maph.hpp:

Go to the source code of this file.

## Classes
struct | maph::Slot
| Storage slot for key-value pairs. More...
struct | maph::Header
| Database file header containing metadata. More...
class | maph::Maph
| Main maph class - lean and fast. More...
class | maph::MaphBuilder

## Namespaces
namespace | maph

## Functions
auto | maph::open (const std::string &path)
std::unique_ptr< Maph > | maph::create (const std::string &path, size_t slots)

## Detailed Description

Lean, mean, mmap-based perfect hash JSON mapping.

Philosophy: Speed at every decision point

- mmap for zero-copy access
- Fixed slots for O(1) everything
- Perfect hash for direct indexing
- JSON for flexibility (only overhead we accept)

Definition in file maph.hpp.

## Class Documentation

## ◆ maph::Header

struct maph::Header

Database file header containing metadata.

The header is exactly 512 bytes and contains database configuration and runtime statistics. It's placed at the beginning of the mmap'd file.

Definition at line 196 of file maph.hpp.

Collaboration diagram for maph::Header:

Class Members
atomic< uint64_t > | generation {0} | Global generation counter (incremented on modifications)
uint32_t | magic {MAGIC_NUMBER} | Magic number for file validation ("MAPH")
uint64_t | num_slots {0} |
char | padding[488] {} |
char | reserved[480] {} | Reserved space for future extensions.
uint64_t | slot_size {sizeof(Slot)} |
uint64_t | static_slots {0} | Number of slots using perfect hashing (no collisions)
uint64_t | total_slots {0} | Total number of slots in database.
uint32_t | version {CURRENT_VERSION} | Database format version.