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§
Sourcefn list_peers(&self) -> Vec<PeerSnapshot>
fn list_peers(&self) -> Vec<PeerSnapshot>
Snapshot of every peer the gossip layer has seen.
Sourcefn cluster_join(&self, target: SocketAddr) -> Result<JoinPlan, ClusterError>
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.
Sourcefn cluster_leave(&self, peer_idx: u32) -> Result<JoinPlan, ClusterError>
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.
Sourcefn cluster_plan_pending(&self) -> Vec<ClusterChange>
fn cluster_plan_pending(&self) -> Vec<ClusterChange>
Snapshot of every staged-but-uncommitted change.
Sourcefn cluster_commit(&self) -> Result<(), ClusterError>
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".