Module coordinator

Module coordinator 

Source
Expand description

Sync engine coordinator.

The SyncEngine is the main orchestrator that ties together all components:

  • L1 in-memory cache with eviction
  • L2 Redis cache with batch writes
  • L3 MySQL/SQLite archive with WAL durability
  • Cuckoo filters for existence checks
  • Merkle trees for sync verification

§Lifecycle

Created → Connecting → DrainingWal → SyncingRedis → WarmingUp → Ready → Running → ShuttingDown

§Example

use sync_engine::{SyncEngine, SyncEngineConfig, SyncItem, EngineState};
use serde_json::json;
use tokio::sync::watch;

let config = SyncEngineConfig::default();
let (_tx, rx) = watch::channel(config.clone());
let mut engine = SyncEngine::new(config, rx);

assert_eq!(engine.state(), EngineState::Created);

// engine.start().await.expect("Start failed");
// assert!(engine.is_ready());

Structs§

BatchResult
Result of a batch operation.
MerkleDiff
Result of comparing merkle trees between two nodes.
SyncEngine
Main sync engine coordinator.

Enums§

EngineState
Engine lifecycle state.
ItemStatus
Sync status of an item across storage tiers.