Crate d_engine

Source
Expand description

§d_engine

codecov License CI

A lightweight, strongly-consistent Raft engine for building reliable distributed systems.

§Features

  • Strong Consistency: Full Raft protocol implementation
  • Pluggable Storage: Supports RocksDB, Sled, and in-memory backends
  • Observability: Metrics, logging, and tracing
  • Runtime Agnostic: Built for tokio
  • Extensible: Decoupled protocol and application logic

§Quick Start

use d_engine::NodeBuilder;
use tokio::sync::watch;
use tracing::error;
use tracing::info;

#[tokio::main(flavor = "current_thread")]
async fn main() {
    let (graceful_tx, graceful_rx) = watch::channel(());

    let node = NodeBuilder::new(None, graceful_rx)
        .build()
        .start_rpc_server()
        .await
        .ready().unwrap();

    if let Err(e) = node.run().await {
        error!("node stops: {:?}", e);
    } else {
        info!("node stops.");
    }
}

§Core Concepts

Data Flow

For production deployments, a minimum cluster size of 3 nodes is required.

Modules§

client
Client module for distributed consensus system
config
Configuration management module for distributed Raft consensus engine.
node
Core node implementation for the distributed consensus system
proto
Protocol Buffer definitions and generated code for RPC services.

Enums§

ConsensusError
ElectionError
Error
MembershipError
NetworkError
ReadSendError
ReplicationError
SerializationError
StorageError
SystemError
WriteSendError