Expand description
§d-engine - Distributed Coordination Engine
d-engine is a lightweight distributed coordination engine written in Rust, designed for embedding into applications that need strong consistency—the consensus layer for building reliable distributed systems.
Built with a simple vision: make distributed coordination accessible - cheap to run, simple to use. Built on a core philosophy: choose simple architectures over complex ones.
d-engine’s Raft core uses a single-threaded event loop to guarantee strong consistency and strict ordering while keeping the codebase clean and performant. Production-ready Raft implementation with flexible read consistency (Linearizable/Lease-Based/Eventual) and pluggable storage backends. Start with one node, scale to a cluster when needed.
§🚀 New to d-engine? Start Here
Follow this learning path to get started quickly:
1. Is d-engine Right for You? (1 minute)
↓
2. Choose Integration Mode (1 minute)
↓
3a. Quick Start - Embedded (5 minutes)
OR
3b. Quick Start - Standalone (5 minutes)
↓
4. Scale to Cluster (optional)→ Start: Is d-engine Right for You?
§Recommended Entry Point
This is the recommended crate for most users. It re-exports all functionality from the internal crates below.
[dependencies]
d-engine = "0.2" # This is all you need§Crate Organization
| Crate | Purpose |
|---|---|
| d-engine-proto | Protocol definitions (Prost) |
| d-engine-core | Core Raft algorithm & traits |
| d-engine-client | Client library for applications |
| d-engine-server | Server runtime implementation |
§Quick Start
§Embedded Mode (Rust)
use d_engine::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let engine = EmbeddedEngine::start_with("d-engine.toml").await?;
engine.wait_ready(std::time::Duration::from_secs(5)).await?;
let client = engine.client();
client.put(b"key".to_vec(), b"value".to_vec()).await?;
Ok(())
}§Standalone Mode (Any Language)
cd examples/three-nodes-standalone
make start-cluster→ Standalone Guide
§Documentation Index
§Getting Started
- Is d-engine Right for You? - Common use cases
- Integration Modes - Embedded vs Standalone
- Quick Start - Embedded
- Quick Start - Standalone
§Guides by Role
§Client Developers
- Read Consistency - Choosing consistency policies
- Error Handling
§Server Operators
§Examples & Performance
- HA Deployment with Load Balancing - Production HA setup
- Single Node Expansion - Scale from 1 to 3 nodes
- Three-Node Standalone Cluster - Standalone mode cluster
- Throughput Optimization
- Benchmarking Guide - Run embedded and standalone benchmarks
§License
MIT or Apache-2.0
Modules§
- api
- Public API layer for different deployment modes
- client
- Client protocol types
- cluster_
types - Cluster management protocol types
- common
- Common Raft protocol types
- docs
- Documentation modules
- node
- Node lifecycle management
- prelude
- Convenient prelude for importing common types
- protocol
- Protocol types needed for client operations
- server_
storage - Server storage protocol types
- storage
- Storage layer implementations
Structs§
- Apply
Result - Result of applying a single log entry to the state machine
- Client
- Main entry point for interacting with the d-engine cluster.
- Client
Builder - Configurable builder for
Clientinstances - Client
Config - Client configuration parameters for network connection management
- Client
Inner - Connection
Pool - Manages connections to cluster nodes
- Embedded
Client - Zero-overhead KV client for embedded mode.
- Embedded
Engine - Embedded d-engine with automatic lifecycle management.
- File
State Machine - File-based state machine implementation with persistence
- File
Storage Engine - File-based Raft log storage
- Grpc
Client - gRPC-based key-value store client
- Hard
State - Leader
Info - Leader election information Used at: Application layer (internal Raft protocol notifications) Purpose: Notify applications about leader changes via watch channel Fields: Minimal - only what Raft protocol needs
- Node
- Raft consensus node
- Node
Builder - Builder for creating a Raft node
- Raft
- RocksDB
State Machine - RocksDB-based state machine implementation with lease support
- RocksDB
Storage Engine - RocksDB-based Raft log storage
- Standalone
Engine - Standalone d-engine engine for independent deployment
Enums§
- Client
ApiError - Error
- Prost
Error - Wrapper for prost encoding/decoding errors
- Snapshot
Error - Storage
Error
Traits§
- Client
Api - Unified key-value store interface.
- LogStore
- Meta
Store - Metadata storage operations
- State
Machine - State machine trait for Raft consensus
- Storage
Engine - High-performance storage abstraction for Raft consensus
Functions§
- get_
duration_ since_ epoch - get_
now_ as_ u32 - Returns seconds since epoch as u32
Type Aliases§
- Client
ApiResult - Result type for KV operations