Remove one remote workspace from persistence + registry (`connection_id` + `remote_path`).
(&self, connection_id: &str, remote_path: &str)
| 459 | |
| 460 | /// Remove one remote workspace from persistence + registry (`connection_id` + `remote_path`). |
| 461 | pub async fn unregister_remote_workspace_entry(&self, connection_id: &str, remote_path: &str) { |
| 462 | let rp = bitfun_core::service::remote_ssh::normalize_remote_workspace_path(remote_path); |
| 463 | if let Ok(manager) = self.get_ssh_manager_async().await { |
| 464 | if let Err(e) = manager.remove_remote_workspace(connection_id, &rp).await { |
| 465 | log::warn!("Failed to remove persisted remote workspace: {}", e); |
| 466 | } |
| 467 | } |
| 468 | if let Some(state_manager) = |
| 469 | bitfun_core::service::remote_ssh::get_remote_workspace_manager() |
| 470 | { |
| 471 | state_manager |
| 472 | .unregister_remote_workspace(connection_id, &rp) |
| 473 | .await; |
| 474 | } |
| 475 | let mut slot = self.remote_workspace.write().await; |
| 476 | let clear_slot = slot |
| 477 | .as_ref() |
| 478 | .map(|w| { |
| 479 | w.connection_id == connection_id |
| 480 | && bitfun_core::service::remote_ssh::normalize_remote_workspace_path( |
| 481 | &w.remote_path, |
| 482 | ) == rp |
| 483 | }) |
| 484 | .unwrap_or(false); |
| 485 | if clear_slot { |
| 486 | *slot = None; |
| 487 | if let Some(m) = bitfun_core::service::remote_ssh::get_remote_workspace_manager() { |
| 488 | m.set_active_connection_hint(None).await; |
| 489 | } |
| 490 | } |
| 491 | log::info!( |
| 492 | "Remote workspace entry removed: connection_id={}, remote_path={}", |
| 493 | connection_id, |
| 494 | rp |
| 495 | ); |
| 496 | } |
| 497 | |
| 498 | /// Clear current remote pointer and remove its persisted/registry entry (legacy SSH "close"). |
| 499 | pub async fn clear_remote_workspace(&self) { |
no test coverage detected