![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
C-linkage interface to the in-process provenance circuit cache. More...
#include "provsql_utils.h"

Go to the source code of this file.
Functions | |
| bool | circuit_cache_create_gate (pg_uuid_t token, gate_type type, unsigned nb_children, pg_uuid_t *children) |
| Insert a new gate into the circuit cache. | |
| unsigned | circuit_cache_get_children (pg_uuid_t token, pg_uuid_t **children) |
| Retrieve the children of a cached gate. | |
| gate_type | circuit_cache_get_type (pg_uuid_t token) |
| Retrieve the type of a cached gate. | |
C-linkage interface to the in-process provenance circuit cache.
The circuit cache is a bounded, LRU-evicting in-memory store that avoids repeated round-trips to the mmap-backed persistent circuit storage for recently accessed gates. It is implemented in C++ (see CircuitCache.h / CircuitCache.cpp) but exposed to the C parts of the extension through this header.
Gates evicted from the cache are flushed to the background mmap worker via the shared-memory pipe. Lookups that miss the cache fall back to reading the mmap files directly.
Definition in file circuit_cache.h.
| bool circuit_cache_create_gate | ( | pg_uuid_t | token, |
| gate_type | type, | ||
| unsigned | nb_children, | ||
| pg_uuid_t * | children | ||
| ) |
Insert a new gate into the circuit cache.
Records the gate identified by token with the given type and nb_children children. If the cache is full the oldest entry is evicted (and flushed to persistent storage) to make room.
| token | UUID identifying the new gate. |
| type | Gate type (e.g. gate_input, gate_plus). |
| nb_children | Number of child gates. |
| children | Array of nb_children child UUIDs. |
true if the gate was inserted, false if it was already present in the cache. Definition at line 55 of file CircuitCache.cpp.


Retrieve the children of a cached gate.
Looks up token in the cache and, on a hit, allocates an array of child UUIDs in the current memory context and writes its address to *children.
| token | UUID of the gate to look up. |
| children | Output parameter: set to a freshly allocated array of child UUIDs on success; untouched on a cache miss. |
UINT_MAX on a cache miss. Definition at line 60 of file CircuitCache.cpp.


Retrieve the type of a cached gate.
| token | UUID of the gate to look up. |
gate_type of the gate, or gate_invalid on a miss. Definition at line 76 of file CircuitCache.cpp.

