MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / list_all

Method list_all

nodedb/src/control/security/session_registry.rs:137–153  ·  view source on GitHub ↗

List all active sessions with full details for SHOW SESSIONS.

(&self)

Source from the content-addressed store, hash-verified

135
136 /// List all active sessions with full details for SHOW SESSIONS.
137 pub fn list_all(&self) -> Vec<SessionInfo> {
138 let sessions = self.sessions.read().unwrap_or_else(|p| p.into_inner());
139 sessions
140 .iter()
141 .map(|(id, s)| SessionInfo {
142 session_id: id.clone(),
143 user_id: s.user_id.clone(),
144 db_user: s.db_user.clone(),
145 auth_method: s.auth_method.clone(),
146 connected_at: s.connected_at,
147 last_active: s.last_active.load(std::sync::atomic::Ordering::Relaxed),
148 client_ip: s.peer_addr.clone(),
149 protocol: s.protocol.clone(),
150 tenant_id: s.tenant_id,
151 })
152 .collect()
153 }
154}
155
156/// Session info for SHOW SESSIONS output.

Callers

nothing calls this directly

Calls 5

collectMethod · 0.80
readMethod · 0.45
iterMethod · 0.45
cloneMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected