pub struct ClientGuard { /* private fields */ }Expand description
RAII handle held by the proxy task for the lifetime of a client
connection. Mutating methods take &self so the guard can be borrowed
down the call stack without propagating &mut.
Implementations§
Source§impl ClientGuard
impl ClientGuard
pub fn id(&self) -> ClientId
Sourcepub fn set_state(&self, state: ClientState)
pub fn set_state(&self, state: ClientState)
Update the client’s state. Records the transition time so
state_since can be reported in admin output.
Sourcepub fn set_database_and_user(&self, database: &str, user: &str)
pub fn set_database_and_user(&self, database: &str, user: &str)
Record the database and upstream user for this client, typically after parsing the PostgreSQL startup message. Both values are exposed in admin output and can be used by trace span recording.
Sourcepub fn set_waiting_for(&self, target: Option<WaitTarget>)
pub fn set_waiting_for(&self, target: Option<WaitTarget>)
Record (or clear) the wait target while this client is blocked
on a pool checkout. Set to Some right before transitioning to
ClientState::Waiting and to None on wakeup. The field is
surfaced in /admin/clients so operators can see exactly which
role queue a blocked client is sitting on.