![]() |
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 <sstream>#include "MMappedCircuit.h"#include "GenericCircuit.h"#include "Circuit.hpp"#include "provsql_utils_cpp.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. | |
| 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. | |
| GenericCircuit | createGenericCircuit (pg_uuid_t token) |
Build an in-memory GenericCircuit rooted at token. | |
Variables | |
| static MMappedCircuit * | circuit = NULL |
| Singleton pointer to the process-wide mmap-backed provenance circuit. | |
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.
| GenericCircuit createGenericCircuit | ( | pg_uuid_t | token | ) |
Build an in-memory GenericCircuit rooted at token.
Performs a depth-first traversal of the mmap-backed circuit starting from token and copies all reachable gates and wires into a newly constructed GenericCircuit.
| token | UUID of the root gate. |
GenericCircuit containing the sub-circuit. Definition at line 349 of 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 43 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 38 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 344 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 148 of file MMappedCircuit.cpp.


|
static |
Singleton pointer to the process-wide mmap-backed provenance circuit.
Definition at line 36 of file MMappedCircuit.cpp.