MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / remove_session

Method remove_session

graphlite/src/session/manager.rs:144–170  ·  view source on GitHub ↗

Remove a session from the registry

(&self, session_id: &str)

Source from the content-addressed store, hash-verified

142
143 /// Remove a session from the registry
144 pub fn remove_session(&self, session_id: &str) -> Result<(), String> {
145 let partition_idx = self.partition_index(session_id);
146 let mut partition = self.sessions[partition_idx]
147 .write()
148 .map_err(|_| "Failed to acquire partition write lock")?;
149
150 if let Some(session_arc) = partition.remove(session_id) {
151 // Mark session as inactive
152 if let Ok(mut session) = session_arc.write() {
153 session.deactivate();
154 }
155 }
156
157 // Release partition lock before catalog persistence
158 drop(partition);
159
160 // Persist catalogs when session is removed to ensure data is saved
161 if let Ok(catalog_manager) = self.catalog_manager.write() {
162 let persist_result =
163 SESSION_RUNTIME.with(|rt| rt.block_on(catalog_manager.persist_all()));
164 if let Err(e) = persist_result {
165 log::warn!("Failed to persist catalogs during session removal: {}", e);
166 }
167 }
168
169 Ok(())
170 }
171
172 /// Get all active session IDs
173 pub fn get_active_session_ids(&self) -> Vec<String> {

Callers 2

close_sessionMethod · 0.45

Calls 4

partition_indexMethod · 0.80
deactivateMethod · 0.80
persist_allMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected