Expand description
§Revoke Framework
A high-performance microservices infrastructure framework built with pure Rust.
§Overview
Revoke provides a comprehensive set of components for building distributed systems:
- API Gateway: High-performance gateway built on Cloudflare Pingora
- Service Registry: Dynamic service discovery with Consul integration
- Configuration Management: Centralized configuration with hot-reloading
- Distributed Tracing: OpenTelemetry-based distributed tracing
- Message Queue: Unified interface for various message queue systems
- Resilience: Circuit breakers, rate limiting, and retry mechanisms
§Quick Start
Add revoke to your Cargo.toml:
[dependencies]
revoke = "0.1"Or with specific features:
[dependencies]
revoke = { version = "0.1", features = ["gateway", "registry"] }§Example
ⓘ
use revoke::prelude::*;
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create service registry
#[cfg(feature = "registry")]
let registry = Arc::new(MemoryRegistry::new());
// Register a service
#[cfg(feature = "registry")]
{
let service = ServiceInfo {
id: uuid::Uuid::new_v4(),
name: "my-service".to_string(),
version: "1.0.0".to_string(),
address: "127.0.0.1".to_string(),
port: 3000,
protocol: Protocol::Http,
metadata: std::collections::HashMap::new(),
};
registry.register(service).await?;
}
// Create and start gateway
#[cfg(all(feature = "gateway", feature = "registry"))]
{
let config = GatewayConfig {
bind: "0.0.0.0:8080".to_string(),
workers: 4,
log_level: "info".to_string(),
enable_health_check: true,
health_check_interval: 10,
backend_refresh_interval: 30,
};
let gateway = RevokeGateway::new(registry)?;
gateway.run(config)?;
}
Ok(())
}§Feature Flags
default: Includes all featuresfull: All components enabledgateway: API gateway componentregistry: Service registry componentconfig: Configuration managementtrace: Distributed tracingmq: Message queue integrationresilience: Circuit breakers and resilience patterns
§Feature Combinations
minimal: Only core functionalityservice-mesh: Gateway + Registry + Config + Tracemessaging: Message Queue + Configreliability: Resilience + Registry
Re-exports§
pub use revoke_gateway as gateway;gatewaypub use revoke_registry as registry;registrypub use revoke_config as config;configpub use revoke_trace as trace;tracepub use revoke_mq as mq;mqpub use revoke_resilience as resilience;resilience
Modules§
- middleware
- prelude
- Prelude module for convenient imports Convenient re-exports of commonly used types
Structs§
- Health
Status - Revoke
App - Main application struct containing all components
- Revoke
Builder - Builder pattern for creating a complete Revoke application
- Service
Context - Service
Info