Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
d-engine-server
Complete Raft server with gRPC and storage - batteries included
What is this?
This crate provides a complete Raft server implementation with gRPC networking, persistent storage, and cluster orchestration. It's the server runtime component of d-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.
When to use this crate
- ✅ Embedding server in a larger Rust application
- ✅ Need programmatic access to server APIs
- ✅ Building custom tooling around d-engine
- ✅ Already have your own client implementation
When NOT to use this crate
- ❌ Most applications → Use
d-enginefor simpler dependency management - ❌ Need client + server → Use
d-enginewithfeatures = ["server", "client"] - ❌ Quick start preferred → Use
d-enginefor unified API
Quick Start
Add to your Cargo.toml:
[]
= "0.2"
Embedded Mode (zero-overhead local client)
use EmbeddedEngine;
use Duration;
async
Standalone Mode (independent server)
use StandaloneServer;
use watch;
async
Features
This crate provides:
- gRPC Server - Production-ready Raft RPC implementation
- Storage Backends - File-based and RocksDB storage
- Cluster Orchestration - Node lifecycle and membership management
- Snapshot Coordination - Automatic log compaction
- Watch API (optional) - Real-time state change notifications
- EmbeddedEngine API - High-level API for embedded mode
Architecture
┌─────────────────────────────────────────┐
│ d-engine-server │
│ │
│ ┌─────────────────────────────────┐ │
│ │ API Layer │ │
│ │ - EmbeddedEngine │ │
│ │ - StandaloneServer │ │
│ │ - LocalKvClient │ │
│ └──────────────┬──────────────────┘ │
│ │ │
│ ┌──────────────▼──────────────────┐ │
│ │ Node (Raft orchestration) │ │
│ │ - Leader election │ │
│ │ - Log replication │ │
│ │ - Membership changes │ │
│ └───────┬──────────────┬──────────┘ │
│ │ │ │
│ ┌───────▼────────┐ ┌──▼────────────┐ │
│ │ StorageEngine │ │ StateMachine │ │
│ │ (Raft logs) │ │ (KV store) │ │
│ └────────────────┘ └───────────────┘ │
│ │
│ ┌─────────────────────────────────┐ │
│ │ gRPC Services │ │
│ │ - Client RPC (read/write) │ │
│ │ - Cluster RPC (membership) │ │
│ │ - Internal RPC (replication) │ │
│ └─────────────────────────────────┘ │
└─────────────────────────────────────────┘
Storage Backends
File Storage (Default)
Simple file-based storage for development and small deployments.
use ;
let storage = new;
let sm = new;
RocksDB Storage (Production)
High-performance embedded database for production use.
[]
= { = "0.2", = ["rocksdb"] }
use ;
let storage = new;
let sm = new;
Custom Storage
Implement [StateMachine] and [StorageEngine] traits:
use ;
;
;
See the Server Guide for detailed implementation instructions.
EmbeddedEngine API
High-level API for embedding d-engine in Rust applications:
use EmbeddedEngine;
use Duration;
async
Documentation
For comprehensive guides:
Examples
See working examples in the repository:
Related Crates
| Crate | Purpose |
|---|---|
d-engine |
Recommended - Unified API for most users |
d-engine-client |
Client library for Rust applications |
d-engine-core |
Pure Raft algorithm for custom integrations |
d-engine-proto |
Protocol definitions (foundation for all clients) |
License
MIT or Apache-2.0