32#ifndef PROVSQL_INTERRUPT_H
33#define PROVSQL_INTERRUPT_H
Generic directed-acyclic-graph circuit template and gate identifier.
Exception type thrown by circuit operations on invalid input.
provsql_interrupt_scope & operator=(const provsql_interrupt_scope &)=delete
provsql_interrupt_scope()
void(* prev_term_)(int)
The SIGTERM handler to restore.
~provsql_interrupt_scope()
void(* prev_)(int)
The SIGINT handler to restore.
provsql_interrupt_scope(const provsql_interrupt_scope &)=delete
bool provsql_interrupted
Set by provsql_sigint_handler: this backend received a cancel.
int provsql_max_memory
Memory, in MB, that the evaluations of a statement may add to the backend's resident set,...
unsigned provsql_poll_count
Polls since the last check of the memory budget.
void provsql_check_result_size(size_t bytes, const char *message)
Throw if a text value of bytes is past what PostgreSQL can hold in a value (1 GB),...
bool provsql_memory_check_due(void)
Whether the last check of the memory budget is old enough for another, whatever the number of polls s...
void provsql_sigint_handler(int)
SIGINT handler setting provsql_interrupted, and PG's cancel flags as PG's own StatementCancelHandler ...
bool provsql_limit_pending(void)
Whether the evaluation stopped at a resource limit (provsql_limit_exceeded), not yet raised: a catch ...
void provsql_cancel_if_interrupted(void)
Raise PG's cancel if the evaluation stopped for one; nothing otherwise.
void provsql_limit_exceeded(const char *tag, const char *message, const char *hint)
Stop the evaluation at a resource limit (provsql.max_memory, provsql.max_worlds): throws,...
void provsql_check_memory_for(size_t extra)
Throw if extra more bytes would take the evaluations of the statement past provsql....
size_t provsql_memory_used(void)
How much the backend's resident memory has grown since the first evaluation of the statement,...
size_t provsql_max_result_size(void)
The size of the largest text value PostgreSQL holds, in bytes.
void provsql_poll_interrupt()
Throw where an evaluation is to stop, its query cancelled.
void provsql_sigterm_handler(int)
SIGTERM handler setting provsql_interrupted, then running PG's own (die), so that a terminated backen...
bool provsql_in_evaluation(void)
Whether a provsql_interrupt_scope is alive: within a ProvSQL evaluation, where an error raised by lon...
void provsql_check_memory(void)
Throw if the evaluations of the statement have made the backend's resident memory grow by more than p...