Skip to main content

Module request_pool

Module request_pool 

Source
Expand description

The composer-installed request pool, made visible to the verb services.

ADR-0029’s pool law: modules are tenant-agnostic and the composing service owns routing to the right database. The composer’s tenant router already inserts the request’s PgPool into the request extensions; bind_request_pool copies it into a task-local for the duration of the handler future, and the write services resolve their database through current with their composed pool as the fallback — so a mount without tenant routing behaves exactly as before, and a verb under a tenant mount writes to that tenant’s database (host-wired ports ride along untouched).

Functions§

bind_request_pool
Middleware that binds the composer-inserted pool for the whole handler call. Requests without an inserted pool pass straight through.
current
The pool this request’s tenant router installed, if any.
with_pool_scope
Run a future with a pool bound as this module’s request pool — the host relay’s per-tenant consumers use this so module-side consumers resolve the tenant database through their rpool() (ADR-0029 pool law).