Expand description
Chitchat-backed discovery adapter for HydraCache cluster mode.
This crate is intentionally separate from hydracache so local-only users
do not pay for gossip dependencies. ChitchatDiscovery implements
hydracache::ClusterDiscovery and stores HydraCache candidate metadata in
real chitchat node state.
§Example
use std::net::SocketAddr;
use std::sync::Arc;
use std::time::Duration;
use hydracache::{ClusterGeneration, HydraCache, InMemoryCluster};
use hydracache_cluster_chitchat::{ChitchatDiscovery, ChitchatDiscoveryConfig};
let cluster = Arc::new(InMemoryCluster::new("orders"));
let discovery = Arc::new(
ChitchatDiscovery::spawn_udp(
ChitchatDiscoveryConfig::new(
"orders",
"member-a",
ClusterGeneration::new(1),
"127.0.0.1:7000".parse::<SocketAddr>().unwrap(),
)
.gossip_interval(Duration::from_millis(200)),
)
.await?,
);
let member = HydraCache::member()
.shared_cluster(cluster)
.discovery(discovery)
.node_id("member-a")
.generation(ClusterGeneration::new(1))
.start()
.await?;
assert!(member.cluster_discovery_diagnostics().unwrap().has_candidates());Structs§
- Chitchat
Discovery - Real chitchat-backed implementation of
ClusterDiscovery. - Chitchat
Discovery Config - Configuration for a chitchat-backed HydraCache discovery node.