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

Append-only vector template backed by a memory-mapped file. More...

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

Go to the source code of this file.

Classes

class  MMappedVector< T >
 Append-only, mmap-backed vector of elements of type T. More...
 
struct  MMappedVector< T >::data_t
 On-disk layout stored at the start of the backing file. More...
 

Detailed Description

Append-only vector template backed by a memory-mapped file.

MMappedVector<T> provides a std::vector-like interface over a memory-mapped file, enabling the provenance circuit data structures (GateInformation, child UUID lists, extra string data) to survive PostgreSQL restarts and be shared across processes.

Design constraints:

  • Append-only: elements are added with add(); existing elements can be updated in-place via operator[]() but cannot be removed.
  • Automatic growth: when capacity is exhausted the backing file is grown by a factor of two and remapped.
  • T must be a trivially copyable type so that it can be stored directly in the memory-mapped region.

The implementation is in MMappedVector.hpp (included from this header).

Definition in file MMappedVector.h.