//! Chainfire Core - Embeddable distributed cluster library
//!
//! This crate provides cluster management, distributed KVS, and event callbacks
//! for embedding Raft consensus and SWIM gossip into applications.
//!
//! # Example
//!
//! ```ignore
//! use chainfire_core::{ClusterBuilder, ClusterEventHandler};
//! use std::net::SocketAddr;
//!
//! struct MyHandler;
//!
//! impl ClusterEventHandler for MyHandler {
//!     async fn on_leader_changed(&self, old: Option<u64>, new: u64) {
//!         println!("Leader changed: {:?} -> {}", old, new);
//!     }
//! }
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//!     let cluster = ClusterBuilder::new(1)
//!         .name("node-1")
//!         .gossip_addr("0.0.0.0:7946".parse()?)
//!         .raft_addr("0.0.0.0:2380".parse()?)
//!         .on_cluster_event(MyHandler)
//!         .build()
//!         .await?;
//!
//!     // Use the KVS
//!     cluster.kv().put("key", b"value").await?;
//!
//!     Ok(())
//! }
//! ```

pub mod builder;
pub mod callbacks;
pub mod cluster;
pub mod config;
pub mod error;
pub mod events;
pub mod kvs;

// Re-exports from chainfire-types
pub use chainfire_types::{
    node::{NodeId, NodeInfo, NodeRole},
    RaftRole,
};

// Re-exports from this crate
pub use builder::ClusterBuilder;
pub use callbacks::{ClusterEventHandler, KvEventHandler, LeaveReason};
pub use cluster::{Cluster, ClusterHandle, ClusterState};
pub use config::{ClusterConfig, StorageBackend, StorageBackendConfig};
pub use error::{ClusterError, Result};
pub use events::{ClusterEvent, EventDispatcher, KvEvent};
pub use kvs::{CasResult, Kv, KvEntry, KvHandle, KvNamespace, KvOptions, ReadConsistency};
