ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
provsql_rmgr.h
Go to the documentation of this file.
1/**
2 * @file provsql_rmgr.h
3 * @brief WAL-logging the circuit store: the entry points other files use.
4 *
5 * See @c provsql_rmgr.c for what is logged, what replay does with it, and
6 * why the feature is off by default.
7 */
8#ifndef PROVSQL_RMGR_H
9#define PROVSQL_RMGR_H
10
11#include "postgres.h"
12
13/** Global variable set by the provsql.wal_logging run-time configuration
14 * parameter: when true, every mutation of the circuit store is written
15 * to the WAL before it is written to the store. */
16extern bool provsql_wal_logging;
17
18/**
19 * @brief Register ProvSQL's resource manager with PostgreSQL.
20 *
21 * Must be called from @c _PG_init under @c shared_preload_libraries, and
22 * is called unconditionally -- registration is what lets any WAL that
23 * already contains ProvSQL records be replayed, whether or not this
24 * cluster is currently writing them. A no-op before PostgreSQL 15.
25 */
26void provsql_register_rmgr(void);
27
28/**
29 * @brief Write one store message to the WAL, if WAL logging is on.
30 *
31 * @param data The complete message, starting with its opcode byte.
32 * @param len Its length in bytes.
33 */
34void provsql_wal_log_store_message(const char *data, size_t len);
35
36/**
37 * @brief Whether this process may write to the circuit store.
38 *
39 * False in a hot-standby backend: the standby's store is maintained by
40 * replay, and a backend writing to it would make the two diverge for
41 * good. True in the startup process while it replays a ProvSQL record,
42 * which is the one write recovery is supposed to make.
43 */
45
46/**
47 * @brief Feed a logged store message back to the worker.
48 *
49 * Implemented in @c provsql_mmap.c, where the IPC primitives live.
50 */
51void provsql_replay_store_message(const char *data, size_t len);
52
53#endif /* PROVSQL_RMGR_H */
bool provsql_wal_logging
Global variable set by the provsql.wal_logging run-time configuration parameter: when true,...
void provsql_replay_store_message(const char *data, size_t len)
Feed a logged store message back to the worker.
void provsql_register_rmgr(void)
Register ProvSQL's resource manager with PostgreSQL.
void provsql_wal_log_store_message(const char *data, size_t len)
Write one store message to the WAL, if WAL logging is on.
bool provsql_store_write_allowed(void)
Whether this process may write to the circuit store.