Expand description
Postgres: the connection pool, this server’s schema, and the LISTEN connection that fans changes out to every replica.
SQL is written with chess. table prefixes; Db::sql swaps in the
configured schema name. The server keeps its own players, API tokens
and sessions there; a host site’s (site., CHESS_SITE_SCHEMA) are read
once, to import the players who already used chess there. Explicit names rather than a
search_path because Neon’s pooler (transaction pooling) doesn’t keep
session settings.
Structs§
Enums§
- Note
- A change other replicas (and local streams) need to hear about.
Functions§
- direct_
host - Neon’s pooled hostname (
ep-x-123-pooler.region…) → the direct one, which LISTEN needs (transaction poolers don’t deliver notifications). - listen_
url - The URL for LISTEN: a Neon
-poolerhost swapped for the direct one (the host is replaced, not added: tokio-postgres would try a second host only if the first failed, and the pooler doesn’t fail, it just never delivers notifications). Anything else is used as given. - notify
- Send
notefrom inside a transaction (delivered to every replica on commit). Payloads over Postgres’s 8000-byte limit are trimmed to a reload instruction. - quote_
ident