![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Persistent mmap-backed circuit: implementation and background-worker entry points. More...
#include <cerrno>#include <cmath>#include <map>#include <sstream>#include <string>#include "MMappedCircuit.h"#include "GenericCircuit.h"#include "Circuit.hpp"#include "provsql_utils_cpp.h"#include "miscadmin.h"#include "provsql_mmap.h"#include "provsql_shmem.h"
Go to the source code of this file.
Functions | |
| void | initialize_provsql_mmap () |
| Open (or create) the mmap files and initialise the circuit store. | |
| void | destroy_provsql_mmap () |
| Unmap and close the mmap files. | |
| static MMappedCircuit * | getCircuit (Oid db_oid) |
Return (creating lazily if needed) the circuit for db_oid. | |
| void | provsql_mmap_main_loop () |
| Main processing loop of the mmap background worker. | |
| bool | operator< (const pg_uuid_t a, const pg_uuid_t b) |
Lexicographic less-than comparison for pg_uuid_t. | |
Variables | |
| static std::map< Oid, MMappedCircuit * > | circuits |
| Per-database mmap-backed provenance circuits, keyed by database OID. | |
Persistent mmap-backed circuit: implementation and background-worker entry points.
Implements the MMappedCircuit methods declared in MMappedCircuit.h, the createGenericCircuit() free function, and the background-worker entry points declared in provsql_mmap.h:
initialize_provsql_mmap(): called by the background worker at startup; opens all four mmap files and creates the singleton MMappedCircuit instance.destroy_provsql_mmap(): called on shutdown; syncs and deletes the singleton.provsql_mmap_main_loop(): the worker's main loop; receives gate- creation messages from backends over the IPC pipe and writes them to the mmap store.The createGenericCircuit() function performs a BFS from a root UUID, reading gates from the mmap store and building an in-memory GenericCircuit.
Definition in file MMappedCircuit.cpp.
| void destroy_provsql_mmap | ( | void | ) |
Unmap and close the mmap files.
Called by the background worker on shutdown to release resources and ensure all dirty pages are synced to disk via msync().
Definition at line 60 of file MMappedCircuit.cpp.

|
static |
Return (creating lazily if needed) the circuit for db_oid.
Definition at line 197 of file MMappedCircuit.cpp.

| void initialize_provsql_mmap | ( | void | ) |
Open (or create) the mmap files and initialise the circuit store.
Called once by the background worker at startup. Creates the four mmap-backed data files if they do not yet exist and maps them into the worker's address space.
Definition at line 55 of file MMappedCircuit.cpp.

Lexicographic less-than comparison for pg_uuid_t.
| a | Left UUID. |
| b | Right UUID. |
true if a is lexicographically less than b. Definition at line 645 of file MMappedCircuit.cpp.
| void provsql_mmap_main_loop | ( | void | ) |
Main processing loop of the mmap background worker.
Waits for gate-creation requests from backend processes, processes them by writing to the mmap files, and handles SIGTERM for graceful shutdown.
Definition at line 207 of file MMappedCircuit.cpp.


|
static |
Per-database mmap-backed provenance circuits, keyed by database OID.
Definition at line 39 of file MMappedCircuit.cpp.