rockraft 0.1.5

A strong consistency KV service library base on Raft and Rocksdb
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::config::Config;
use crate::error::Result;
use crate::node::RaftNode;
use std::sync::Arc;

pub struct RaftNodeBuilder;

impl RaftNodeBuilder {
  /// Build a new RaftNode with the given configuration
  pub async fn build(config: &Config) -> Result<Arc<RaftNode>> {
    config.validate()?;

    let raft_node = RaftNode::create(config).await?;
    RaftNode::start(raft_node.clone()).await?;
    Ok(raft_node)
  }
}