rigatoni-stores
State store implementations for Rigatoni ETL framework - persist resume tokens for fault tolerance.
Overview
State store implementations for persisting MongoDB change stream resume tokens, enabling fault-tolerant ETL pipelines with exactly-once or at-least-once semantics.
Supported Stores
Memory Store (Available)
- Fast - In-memory HashMap for development/testing
- Thread-safe - Uses
Arc<RwLock<HashMap>> - No persistence - Data lost on restart
File Store (Available)
- Persistent - JSON files on disk
- Human-readable - Easy to inspect and debug
- One file per collection - Organized storage
Redis Store (Available)
- Distributed - Share state across multiple pipeline instances
- Connection pooling - Efficient connection management with deadpool
- Production-ready - For multi-instance deployments
- TTL support - Optional token expiration
- Retry logic - Automatic retries with exponential backoff
Installation
[]
= { = "0.1", = ["memory", "file", "redis-store"] }
Available Features
memory- In-memory store (enabled by default)file- File-based store (enabled by default)redis-store- Redis store with connection pooling and retry logicall-stores- All store implementations
Quick Start
Memory Store (Development/Testing)
use MemoryStore;
async
File Store (Persistent)
use FileStore;
async
Redis Store (Distributed)
use ;
use Duration;
async
Redis Configuration Options
url- Redis connection URL (supportsredis://andrediss://schemes)pool_size- Connection pool size (default: 10)ttl- Optional expiration time for resume tokens (recommended: 7-30 days)max_retries- Maximum retry attempts for transient errors (default: 3)connection_timeout- Connection timeout duration (default: 5 seconds)
Note: Redis Cluster mode is not currently implemented. Use Redis Sentinel for high availability.
State Store Trait
All stores implement the StateStore trait from rigatoni-core:
use StateStore;
Custom Store Implementation
Implement your own store for custom backends:
use ;
use async_trait;
use Document;
Use Cases
Development/Testing
Use Memory Store for fast iteration without persistence
Single-Instance Production
Use File Store for simple, reliable persistence
Multi-Instance Production
Use Redis Store for distributed state across pipeline instances with:
- Shared resume tokens across multiple workers
- Connection pooling for efficient Redis usage
- Automatic retry logic for transient failures
- Optional TTL to prevent unbounded growth
Documentation
License
Licensed under the Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0).