Skip to main content

ClusterAdmin

Trait ClusterAdmin 

Source
pub trait ClusterAdmin:
    Send
    + Sync
    + Debug {
    // Required methods
    fn list_peers(&self) -> Vec<PeerSnapshot>;
    fn cluster_join(&self, target: SocketAddr) -> Result<JoinPlan, ClusterError>;
    fn cluster_leave(&self, peer_idx: u32) -> Result<JoinPlan, ClusterError>;
    fn cluster_plan_pending(&self) -> Vec<ClusterChange>;
    fn cluster_commit(&self) -> Result<(), ClusterError>;
}
Expand description

Cluster-membership admin surface.

The PBC server consults a &dyn ClusterAdmin for the DynRpb* admin RPCs. The default implementation is PoolClusterAdmin; a NoopClusterAdmin is provided for servers that do not expose admin operations.

Required Methods§

Source

fn list_peers(&self) -> Vec<PeerSnapshot>

Snapshot of every peer the gossip layer has seen.

Source

fn cluster_join(&self, target: SocketAddr) -> Result<JoinPlan, ClusterError>

Stage a Add change for target and return the plan.

§Errors

Returns ClusterError::PeerAlreadyExists when an existing peer already advertises the same host:port.

Source

fn cluster_leave(&self, peer_idx: u32) -> Result<JoinPlan, ClusterError>

Stage a Remove change for peer_idx and return the plan.

§Errors

Returns ClusterError::PeerNotFound when no peer has the requested index, or ClusterError::CannotRemoveLocal when the index points at the local node.

Source

fn cluster_plan_pending(&self) -> Vec<ClusterChange>

Snapshot of every staged-but-uncommitted change.

Source

fn cluster_commit(&self) -> Result<(), ClusterError>

Apply every staged change and clear the staging list.

§Errors

Returns the first staging error encountered. Already- applied changes remain applied.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§