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

Open-addressing hash table over a memory-mapped file: implementation. More...

#include "MMappedUUIDHashTable.h"
#include <cassert>
#include <cerrno>
#include <cstring>
#include <new>
#include <stdexcept>
#include <vector>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
Include dependency graph for MMappedUUIDHashTable.cpp:

Go to the source code of this file.

Detailed Description

Open-addressing hash table over a memory-mapped file: implementation.

Implements all methods of MMappedUUIDHashTable declared in MMappedUUIDHashTable.h:

  • MMappedUUIDHashTable(): open/create the backing file and map it.
  • ~MMappedUUIDHashTable(): sync and unmap.
  • add(): insert a UUID and assign the next sequential integer.
  • operator[](): look up an integer by UUID.
  • sync(): flush dirty pages with msync().

Internal helpers:

  • mmap(): map (or remap) length bytes of the backing file.
  • grow(): double the table size and rehash.
  • find(): locate the slot index for a UUID (or NOTHING if absent).
  • set(): write a key-value pair into the table.

Definition in file MMappedUUIDHashTable.cpp.