![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Background worker registration and IPC primitives for mmap-backed storage. More...
#include "provsql_mmap.h"#include "provsql_shmem.h"#include "provsql_utils.h"#include <errno.h>#include <unistd.h>#include <poll.h>#include <math.h>#include <assert.h>#include "postgres.h"#include "postmaster/bgworker.h"#include "fmgr.h"#include "funcapi.h"#include "utils/array.h"#include "access/htup_details.h"#include "utils/builtins.h"#include "circuit_cache.h"
Go to the source code of this file.
Functions | |
| __attribute__ ((visibility("default"))) | |
| Background worker entry point: initialises the mmap circuit store and runs the main loop. | |
| void | RegisterProvSQLMMapWorker (void) |
| Register the ProvSQL mmap background worker with PostgreSQL. | |
| Datum | get_gate_type (PG_FUNCTION_ARGS) |
| PostgreSQL-callable wrapper for get_gate_type(). | |
| Datum | create_gate (PG_FUNCTION_ARGS) |
| PostgreSQL-callable wrapper for create_gate(). | |
| Datum | set_prob (PG_FUNCTION_ARGS) |
| PostgreSQL-callable wrapper for set_prob(). | |
| Datum | set_infos (PG_FUNCTION_ARGS) |
| PostgreSQL-callable wrapper for set_infos(). | |
| Datum | set_extra (PG_FUNCTION_ARGS) |
| PostgreSQL-callable wrapper for set_extra(). | |
| Datum | get_extra (PG_FUNCTION_ARGS) |
| PostgreSQL-callable wrapper for get_extra(). | |
| Datum | get_nb_gates (PG_FUNCTION_ARGS) |
| PostgreSQL-callable wrapper for get_nb_gates(). | |
| Datum | get_children (PG_FUNCTION_ARGS) |
| PostgreSQL-callable wrapper for get_children(). | |
| Datum | get_prob (PG_FUNCTION_ARGS) |
| PostgreSQL-callable wrapper for get_prob(). | |
| Datum | get_infos (PG_FUNCTION_ARGS) |
| PostgreSQL-callable wrapper for get_infos(). | |
Variables | |
| char | buffer [PIPE_BUF] ={} |
Shared write buffer used with STARTWRITEM / ADDWRITEM / SENDWRITEM. | |
| unsigned | bufferpos =0 |
Current write position within buffer. | |
Background worker registration and IPC primitives for mmap-backed storage.
Implements the PostgreSQL background worker lifecycle functions declared in provsql_mmap.h:
RegisterProvSQLMMapWorker(): registers the worker with the postmaster during _PG_init().provsql_mmap_worker(): worker entry point; sets up signal handlers and enters provsql_mmap_main_loop().The IPC between normal backends and the background worker is handled in MMappedCircuit.cpp. This file provides the PostgreSQL-specific glue (background worker API, signal handling).
Also declares the shared write buffer buffer[] and position counter bufferpos used by the STARTWRITEM / ADDWRITEM / SENDWRITEM macros in provsql_mmap.h.
The gate-creation SQL functions (e.g. create_gate()) that backends call are also implemented here; they acquire the IPC lock, write a message to the background worker, and wait for an acknowledgment.
Definition in file provsql_mmap.c.
| __attribute__ | ( | (visibility("default")) | ) |
Background worker entry point: initialises the mmap circuit store and runs the main loop.
Definition at line 48 of file provsql_mmap.c.

| Datum create_gate | ( | PG_FUNCTION_ARGS | ) |
PostgreSQL-callable wrapper for create_gate().
Definition at line 125 of file provsql_mmap.c.

| Datum get_children | ( | PG_FUNCTION_ARGS | ) |
PostgreSQL-callable wrapper for get_children().
Definition at line 357 of file provsql_mmap.c.

| Datum get_extra | ( | PG_FUNCTION_ARGS | ) |
PostgreSQL-callable wrapper for get_extra().
Definition at line 304 of file provsql_mmap.c.

| Datum get_gate_type | ( | PG_FUNCTION_ARGS | ) |
PostgreSQL-callable wrapper for get_gate_type().
Definition at line 89 of file provsql_mmap.c.

| Datum get_infos | ( | PG_FUNCTION_ARGS | ) |
PostgreSQL-callable wrapper for get_infos().
Definition at line 457 of file provsql_mmap.c.

| Datum get_nb_gates | ( | PG_FUNCTION_ARGS | ) |
PostgreSQL-callable wrapper for get_nb_gates().
Definition at line 339 of file provsql_mmap.c.

| Datum get_prob | ( | PG_FUNCTION_ARGS | ) |
PostgreSQL-callable wrapper for get_prob().
Definition at line 428 of file provsql_mmap.c.

| void RegisterProvSQLMMapWorker | ( | void | ) |
Register the ProvSQL mmap background worker with PostgreSQL.
Must be called from the extension's _PG_init() function so that the postmaster starts the worker on the next connection.
Definition at line 62 of file provsql_mmap.c.

| Datum set_extra | ( | PG_FUNCTION_ARGS | ) |
PostgreSQL-callable wrapper for set_extra().
Definition at line 276 of file provsql_mmap.c.

| Datum set_infos | ( | PG_FUNCTION_ARGS | ) |
PostgreSQL-callable wrapper for set_infos().
Definition at line 246 of file provsql_mmap.c.

| Datum set_prob | ( | PG_FUNCTION_ARGS | ) |
PostgreSQL-callable wrapper for set_prob().
Definition at line 217 of file provsql_mmap.c.

| char buffer[PIPE_BUF] ={} |
Shared write buffer used with STARTWRITEM / ADDWRITEM / SENDWRITEM.
Definition at line 44 of file provsql_mmap.c.
| unsigned bufferpos =0 |
Current write position within buffer.
Definition at line 45 of file provsql_mmap.c.