summaryrefslogtreecommitdiff
path: root/makima/src/server/state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/server/state.rs')
-rw-r--r--makima/src/server/state.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/makima/src/server/state.rs b/makima/src/server/state.rs
index 479eadf..d022834 100644
--- a/makima/src/server/state.rs
+++ b/makima/src/server/state.rs
@@ -884,6 +884,29 @@ impl AppState {
.collect()
}
+ /// Find an alternative daemon for a task, excluding specified daemon IDs.
+ /// Returns the daemon ID and connection info if found.
+ pub fn find_alternative_daemon(
+ &self,
+ owner_id: Uuid,
+ exclude_daemon_ids: &[Uuid],
+ ) -> Option<Uuid> {
+ self.daemon_connections
+ .iter()
+ .find(|entry| {
+ let daemon = entry.value();
+ daemon.owner_id == owner_id && !exclude_daemon_ids.contains(&daemon.id)
+ })
+ .map(|entry| entry.value().id)
+ }
+
+ /// Check if a specific daemon is connected.
+ pub fn is_daemon_connected(&self, daemon_id: Uuid) -> bool {
+ self.daemon_connections
+ .iter()
+ .any(|entry| entry.value().id == daemon_id)
+ }
+
// =========================================================================
// Tool Key Management
// =========================================================================