24#ifndef MMAPPED_CIRCUIT_H
25#define MMAPPED_CIRCUIT_H
Semiring-agnostic in-memory provenance circuit.
GenericCircuit createGenericCircuit(pg_uuid_t token)
Build an in-memory GenericCircuit rooted at token.
Open-addressing hash table mapping UUIDs to integers, backed by an mmap file.
Template implementation of MMappedVector<T>.
In-memory provenance circuit with semiring-generic evaluation.
Persistent mmap-backed representation of the provenance circuit.
void setExtra(pg_uuid_t token, const std::string &s)
Attach a variable-length string annotation to a gate.
MMappedUUIDHashTable mapping
UUID → gate-index hash table.
void createGate(pg_uuid_t token, gate_type type, const std::vector< pg_uuid_t > &children)
Persist a new gate to the mmap store.
std::string getExtra(pg_uuid_t token) const
Return the variable-length string annotation for gate token.
unsigned long getNbGates() const
Return the total number of gates stored in the circuit.
static constexpr const char * GATES_FILENAME
Backing file for gates.
gate_type getGateType(pg_uuid_t token) const
Return the type of the gate identified by token.
void sync()
Flush all backing files to disk with msync().
static constexpr const char * WIRES_FILENAME
Backing file for wires.
bool setProb(pg_uuid_t token, double prob)
Set the probability associated with a gate.
static constexpr const char * EXTRA_FILENAME
Backing file for extra.
static constexpr const char * MAPPING_FILENAME
Backing file for mapping.
MMappedVector< char > extra
Variable-length string data.
double getProb(pg_uuid_t token) const
Return the probability stored for the gate identified by token.
std::vector< pg_uuid_t > getChildren(pg_uuid_t token) const
Return the child UUIDs of the gate identified by token.
MMappedVector< GateInformation > gates
Gate metadata array.
~MMappedCircuit()
Sync all backing files before destruction.
MMappedVector< pg_uuid_t > wires
Flattened child UUID array.
MMappedCircuit(bool read_only=false)
Open all four mmap backing files.
void setInfos(pg_uuid_t token, unsigned info1, unsigned info2)
Update the info1 / info2 annotations of a gate.
std::pair< unsigned, unsigned > getInfos(pg_uuid_t token) const
Return the info1 / info2 pair for the gate token.
Persistent open-addressing hash table mapping UUIDs to integers.
Append-only, mmap-backed vector of elements of type T.
unsigned long nbElements() const
Return the number of elements currently stored.
Core types, constants, and utilities shared across ProvSQL.
gate_type
Possible gate type in the provenance circuit.