omni_orchestrator/initialization/
setup_cluster_management.rs

1use std::sync::Arc;
2use colored::Colorize;
3use crate::{SERVER_CONFIG, RwLock, SharedState};
4
5pub fn setup_cluster_management() -> (Arc<RwLock<SharedState>>, Arc<str>) {
6    // Initialize node state and cluster management
7    let node_id: Arc<str> =
8        format!("{}:{}", SERVER_CONFIG.address.clone(), SERVER_CONFIG.port).into();
9    log::info!("{}", format!("Node ID: {}", node_id).magenta());
10
11    let state = Arc::new(RwLock::new(SharedState::new(node_id.clone())));
12    (state, node_id)
13}