ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
MMappedUUIDHashTable.h File Reference

Open-addressing hash table mapping UUIDs to integers, backed by an mmap file. More...

#include <cstddef>
#include <utility>
#include "provsql_utils.h"
Include dependency graph for MMappedUUIDHashTable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  MMappedUUIDHashTable
 Persistent open-addressing hash table mapping UUIDs to integers. More...
 
struct  MMappedUUIDHashTable::value_t
 One slot in the hash table: a UUID key and its associated integer value. More...
 
struct  MMappedUUIDHashTable::table_t
 On-disk layout of the hash table stored in the mmap file. More...
 

Detailed Description

Open-addressing hash table mapping UUIDs to integers, backed by an mmap file.

MMappedUUIDHashTable provides a persistent hash table that maps 128-bit UUID keys to sequential unsigned-long integers (used as gate indices into the MMappedVector of GateInformation). The table is stored in a memory-mapped file so that it survives PostgreSQL restarts and is accessible by multiple processes.

Design constraints:

  • Append-only: elements can be added but never removed.
  • Open addressing: collisions are resolved by linear probing.
  • Trivial hash: the first 8 bytes of the UUID are reinterpreted as a 64-bit integer and taken modulo the table capacity. UUIDs are generated uniformly at random (version 4), so this is effectively uniform.
  • Automatic growth: when the load factor exceeds MAXIMUM_LOAD_FACTOR the table is doubled in size and rehashed.

Access to the table from multiple processes is serialised via the ProvSQL LWLock in provsqlSharedState.

Definition in file MMappedUUIDHashTable.h.