Eventuali Core 🚀
A high-performance event sourcing library written in Rust, providing the core foundation for the Eventuali event sourcing ecosystem.
Features
- 🚄 High Performance: 10-60x faster than pure Python implementations
- 🔒 Type Safety: Built with Rust's memory safety guarantees
- 🗄️ Multi-Database: Support for PostgreSQL and SQLite
- 📡 Real-time Streaming: Event streaming with projections and sagas
- 📸 Snapshots: Aggregate snapshot support with compression
- 🔐 Security: Built-in event encryption and tenant isolation
- 🏢 Multi-tenancy: Complete tenant isolation and resource management
- 📊 Observability: OpenTelemetry integration with metrics and tracing
Quick Start
Add to your Cargo.toml:
[]
= "0.1"
Basic Usage
use ;
use Utc;
use json;
use Uuid;
async
Event Streaming
use ;
use async_trait;
// Define a projection
async
Feature Flags
Control which features are compiled:
[]
= { = "0.1", = ["postgres", "sqlite", "observability"] }
Available features:
postgres- PostgreSQL backend supportsqlite- SQLite backend support (included by default)observability- OpenTelemetry tracing and metrics (included by default)
Performance
Eventuali Core achieves exceptional performance through Rust's zero-cost abstractions:
- Event Creation: 50,000+ events/second
- Event Persistence: 25,000+ events/second
- Event Loading: 40,000+ events/second
- Memory Usage: 8-20x more efficient than Python
- Concurrent Throughput: 2x better under load
Architecture
The library is organized into several key modules:
event- Core event types and serializationstore- Event storage abstraction and implementationsstreaming- Real-time event streaming and projectionsaggregate- Aggregate root patterns and versioningsnapshot- Snapshot storage and compressionsecurity- Event encryption and key managementtenancy- Multi-tenant isolation and resource managementobservability- Metrics, tracing, and logging
Database Support
SQLite
let config = sqlite.await?;
let store = create_event_store.await?;
PostgreSQL
let config = postgres.await?;
let store = create_event_store.await?;
Advanced Features
Event Encryption
use ;
let key_manager = new;
let encryption = new;
// Events are automatically encrypted/decrypted
Multi-tenancy
use ;
let tenant_id = new;
let isolated_store = new;
// All operations are automatically scoped to the tenant
Snapshots
use ;
let snapshot_config = SnapshotConfig ;
let snapshot_store = new.await?;
Examples
The examples/ directory contains comprehensive examples:
basic_event_store.rs- Basic event storage and retrievalstreaming_projections.rs- Real-time event streaming and projectionsmulti_tenant.rs- Multi-tenant event isolationrust_streaming_demo.rs- Complete streaming demonstration
Run examples with:
Integration
Eventuali Core is designed to integrate seamlessly with:
- Python: Via eventuali-python PyO3 bindings
- Web Frameworks: Axum, Actix, Warp integration examples
- Databases: PostgreSQL 12+, SQLite 3.35+
- Observability: OpenTelemetry, Prometheus, Jaeger
Contributing
Contributions are welcome! Please see our contributing guidelines.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.