pub struct ClusterManager { /* private fields */ }Expand description
Manages a distributed cluster of vector database nodes
Implementations§
Source§impl ClusterManager
impl ClusterManager
Sourcepub fn new(
config: ClusterConfig,
node_id: String,
discovery: Box<dyn DiscoveryService>,
) -> Result<Self>
pub fn new( config: ClusterConfig, node_id: String, discovery: Box<dyn DiscoveryService>, ) -> Result<Self>
Create a new cluster manager
Sourcepub async fn add_node(&self, node: ClusterNode) -> Result<()>
pub async fn add_node(&self, node: ClusterNode) -> Result<()>
Add a node to the cluster
Sourcepub async fn remove_node(&self, node_id: &str) -> Result<()>
pub async fn remove_node(&self, node_id: &str) -> Result<()>
Remove a node from the cluster
Sourcepub fn get_node(&self, node_id: &str) -> Option<ClusterNode>
pub fn get_node(&self, node_id: &str) -> Option<ClusterNode>
Get node by ID
Sourcepub fn list_nodes(&self) -> Vec<ClusterNode>
pub fn list_nodes(&self) -> Vec<ClusterNode>
List all nodes in the cluster
Sourcepub fn healthy_nodes(&self) -> Vec<ClusterNode>
pub fn healthy_nodes(&self) -> Vec<ClusterNode>
Get healthy nodes only
Sourcepub fn list_shards(&self) -> Vec<ShardInfo>
pub fn list_shards(&self) -> Vec<ShardInfo>
List all shards
Sourcepub fn assign_shard(&self, shard_id: u32) -> Result<ShardInfo>
pub fn assign_shard(&self, shard_id: u32) -> Result<ShardInfo>
Assign a shard to nodes using consistent hashing
Sourcepub async fn run_health_checks(&self) -> Result<()>
pub async fn run_health_checks(&self) -> Result<()>
Run periodic health checks
Sourcepub async fn start(&self) -> Result<()>
pub async fn start(&self) -> Result<()>
Start the cluster manager (health checks, discovery, etc.)
Sourcepub fn get_stats(&self) -> ClusterStats
pub fn get_stats(&self) -> ClusterStats
Get cluster statistics
Sourcepub fn router(&self) -> Arc<ShardRouter>
pub fn router(&self) -> Arc<ShardRouter>
Get the shard router
Sourcepub fn consensus(&self) -> Option<Arc<DagConsensus>>
pub fn consensus(&self) -> Option<Arc<DagConsensus>>
Get the consensus engine
Auto Trait Implementations§
impl Freeze for ClusterManager
impl !RefUnwindSafe for ClusterManager
impl Send for ClusterManager
impl Sync for ClusterManager
impl Unpin for ClusterManager
impl !UnwindSafe for ClusterManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more