feat(controller): start, stop, restart, destroy and wipe commands

This commit is contained in:
2025-12-10 19:20:42 +01:00
parent a01f511311
commit 6d16748cb3
7 changed files with 440 additions and 42 deletions

View File

@@ -84,10 +84,14 @@ impl StateManager {
self.0.borrow().instances.get(project_name).cloned()
}
pub fn set(&self, project_name: String, state: InstanceState) {
pub fn upsert(&self, project_name: String, state: InstanceState) {
self.0.borrow_mut().instances.insert(project_name, state);
}
pub fn remove(&self, project_name: &str) -> Option<InstanceState> {
self.0.borrow_mut().instances.remove(project_name)
}
pub fn get_highest_used_port(&self) -> Option<u16> {
self.0.borrow().instances.values().map(|i| i.port).max()
}