Expand description
Command rows: written by the webserver, applied by the master, kept as the audit trail.
A command is decided once: pending becomes applied (with what it produced) or
rejected (with a reason), and never changes again.
On Postgres a new command also sends a notification on COMMANDS_CHANNEL, so the master
picks it up at once (Database::command_notifications); polling stays the fallback, and
the only way on SQLite (see archive/PROJECT.md, Web UI and CLI).
Structs§
- Command
Notifications - Notifications of new commands and posted named events (Postgres only): a dedicated
connection listening on
COMMANDS_CHANNELandEVENTS_CHANNEL. - Command
Record - A command row, as the CLI and the UI read it.
- Pending
Command - A pending command, as the master reads it.
Enums§
- Notified
- What a notification announced.
- Submitted
- What
Database::submit_commanddid.
Constants§
- COMMANDS_
CHANNEL - The Postgres notification channel a new command is announced on.
- EVENTS_
CHANNEL - The channel a named event posted through the API is announced on (decision 486): the master’s trigger loop looks at once. A lost one is found by the next tick’s probe (the post cleared its listeners’ stored time).
Functions§
- listening_
is_ safe - Whether a
LISTENon connectionywould stay on one Postgres server process, as directly or through a pooler in session mode;falsebehind a pooler in transaction mode (B16). Each round it readsy’s server process, opens a transaction onx(a pooler then usually lendsxthe server connectionyjust gave back), and readsy’s again whilexholds it:xony’s process (two clients on one server process: only a pooler does that) oryon another one is a pooler in transaction mode. Repeated, so a pooler that happens to lend other connections still shows.