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§

Cluster
Describes a cluster, including operating mode, primaries & secondaries
ClusterConfig
Set cluster configurations
ClusterInfo
Describe cluster
RestClusterNode
An implementation of almost_raft::Node

Enums§

InstanceMode
Status of a node/instance

Functions§

get_cluster_info
Returns selective information on current cluster
start_cluster
Start the cluster. Note that, this function has infinite loop, so should always spawn a new thread.