1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! 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).
use ;
use PgPool;
task_local!
/// The pool this request's tenant router installed, if any.
/// Middleware that binds the composer-inserted pool for the whole handler
/// call. Requests without an inserted pool pass straight through.
pub async
/// 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).
pub async