Crate cluster_mode
source ·Expand description
Create and manage distributed applications in Rust.
Built with the motto - Plug the crate in, it’ll be taken care of.
Usage
let result = KubernetesDiscoverService::init("demo".to_string(), "default".to_string())
.await;
if let Ok(k8s) = result {
let cluster = Arc::new(Cluster::default());
let client = DiscoveryClient::new(k8s);
let config = ClusterConfig::default();
tokio::spawn(start_cluster(cluster, client, config));
}
The Cluster
struct provides a set of functions for example async fn primaries(&self) -> Option<HashSet<RestClusterNode>>
or async fn is_active(&self) -> bool
to communicate with the cluster.
Checkout Cluster for more details
Structs
Describes a cluster, including operating mode, primaries & secondaries
Set cluster configurations
Describe cluster
An implementation of almost_raft::Node
Enums
Status of a node/instance
Functions
Returns selective information on current cluster
Start the cluster. Note that, this function has infinite loop, so should always spawn a new thread.