pub struct SyncEngineConfig {Show 25 fields
pub redis_url: Option<String>,
pub redis_prefix: Option<String>,
pub sql_url: Option<String>,
pub l1_max_bytes: usize,
pub max_payload_bytes: usize,
pub backpressure_warn: f64,
pub backpressure_critical: f64,
pub batch_flush_ms: u64,
pub batch_flush_count: usize,
pub batch_flush_bytes: usize,
pub cuckoo_warmup_batch_size: usize,
pub wal_path: Option<String>,
pub wal_max_items: Option<u64>,
pub wal_drain_batch_size: usize,
pub cf_snapshot_interval_secs: u64,
pub cf_snapshot_insert_threshold: u64,
pub redis_eviction_enabled: bool,
pub redis_eviction_start: f64,
pub redis_eviction_target: f64,
pub merkle_calc_enabled: bool,
pub merkle_calc_jitter_ms: u64,
pub enable_cdc_stream: bool,
pub cdc_stream_maxlen: u64,
pub redis_timeout_ms: u64,
pub redis_response_timeout_ms: u64,
}Expand description
Configuration for the sync engine.
All fields have sensible defaults. At minimum, you should configure
redis_url and sql_url for production use.
Fields§
§redis_url: Option<String>Redis connection string (e.g., “redis://localhost:6379”)
redis_prefix: Option<String>Redis key prefix for namespacing (e.g., “myapp:” → keys become “myapp:user.alice”) Allows sync-engine to coexist with other data in the same Redis instance.
sql_url: Option<String>SQL connection string (e.g., “sqlite:sync.db” or “mysql://user:pass@host/db”)
l1_max_bytes: usizeL1 cache max size in bytes (default: 256 MB)
max_payload_bytes: usizeMaximum payload size in bytes (default: 16 MB)
Payloads larger than this will be rejected with an error. This prevents a single large item (e.g., 1TB file) from exhausting the L1 cache. Set to 0 for unlimited (not recommended).
Important: This is a safety limit. Developers should choose a value appropriate for their use case. For binary blobs, consider using external object storage (S3, GCS) and storing only references here.
backpressure_warn: f64Backpressure thresholds
backpressure_critical: f64§batch_flush_ms: u64Batch flush settings
batch_flush_count: usize§batch_flush_bytes: usize§cuckoo_warmup_batch_size: usizeCuckoo filter warmup
wal_path: Option<String>WAL path (SQLite file for durability during MySQL outages)
wal_max_items: Option<u64>WAL max items before backpressure
wal_drain_batch_size: usizeWAL drain batch size
cf_snapshot_interval_secs: u64CF snapshot interval in seconds (0 = disabled)
cf_snapshot_insert_threshold: u64CF snapshot after N inserts (0 = disabled)
redis_eviction_enabled: boolRedis eviction: enable proactive eviction before Redis LRU kicks in
redis_eviction_start: f64Redis eviction: pressure threshold to start evicting (0.0-1.0, default: 0.75)
redis_eviction_target: f64Redis eviction: target pressure after eviction (0.0-1.0, default: 0.60)
merkle_calc_enabled: boolMerkle calculation: enable merkle tree updates on this instance.
In a multi-instance deployment with shared SQL, only a few nodes need to run merkle calculations for resilience. Set to false on most nodes. Default: true (single-instance default)
merkle_calc_jitter_ms: u64Merkle calculation: jitter range in milliseconds.
Adds random delay (0 to N ms) before merkle batch calculation to reduce contention when multiple instances are calculating. Default: 0 (no jitter)
enable_cdc_stream: boolCDC Stream: Enable Change Data Capture output to Redis Stream.
When enabled, every Put/Delete writes to {redis_prefix}__local__:cdc.
This enables external replication agents to tail changes.
Default: false (opt-in feature)
cdc_stream_maxlen: u64CDC Stream: Maximum entries before approximate trimming (MAXLEN ~).
Consumers that fall behind this limit rely on Merkle repair. Default: 100,000 entries
redis_timeout_ms: u64Redis command timeout in milliseconds.
Maximum time to wait for a Redis command to complete before timing out. Under high load, increase this value to avoid spurious timeouts. Default: 5000 (5 seconds)
redis_response_timeout_ms: u64Redis response timeout in milliseconds.
Maximum time to wait for Redis to respond after sending a command. Default: 5000 (5 seconds)
Trait Implementations§
Source§impl Clone for SyncEngineConfig
impl Clone for SyncEngineConfig
Source§fn clone(&self) -> SyncEngineConfig
fn clone(&self) -> SyncEngineConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SyncEngineConfig
impl Debug for SyncEngineConfig
Source§impl Default for SyncEngineConfig
impl Default for SyncEngineConfig
Source§impl<'de> Deserialize<'de> for SyncEngineConfig
impl<'de> Deserialize<'de> for SyncEngineConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for SyncEngineConfig
impl RefUnwindSafe for SyncEngineConfig
impl Send for SyncEngineConfig
impl Sync for SyncEngineConfig
impl Unpin for SyncEngineConfig
impl UnwindSafe for SyncEngineConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more