| 226 | } |
| 227 | |
| 228 | async fn list(&self) -> Result<Vec<String>> { |
| 229 | let mut session_ids = Vec::new(); |
| 230 | |
| 231 | let mut entries = fs::read_dir(&self.dir) |
| 232 | .await |
| 233 | .with_context(|| format!("Failed to read session directory: {}", self.dir.display()))?; |
| 234 | |
| 235 | while let Some(entry) = entries.next_entry().await? { |
| 236 | let path = entry.path(); |
| 237 | |
| 238 | if path.extension().is_some_and(|ext| ext == "json") { |
| 239 | if let Some(stem) = path.file_stem() { |
| 240 | if let Some(id) = stem.to_str() { |
| 241 | session_ids.push(id.to_string()); |
| 242 | } |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | Ok(session_ids) |
| 248 | } |
| 249 | |
| 250 | async fn exists(&self, id: &str) -> Result<bool> { |
| 251 | let path = self.session_path(id); |