SyncEngineConfig

Struct SyncEngineConfig 

Source
pub struct SyncEngineConfig {
Show 27 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, pub sql_write_concurrency: usize, pub merkle_log_interval_secs: 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: usize

L1 cache max size in bytes (default: 256 MB)

§max_payload_bytes: usize

Maximum 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: f64

Backpressure thresholds

§backpressure_critical: f64§batch_flush_ms: u64

Batch flush settings

§batch_flush_count: usize§batch_flush_bytes: usize§cuckoo_warmup_batch_size: usize

Cuckoo 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: usize

WAL drain batch size

§cf_snapshot_interval_secs: u64

CF snapshot interval in seconds (0 = disabled)

§cf_snapshot_insert_threshold: u64

CF snapshot after N inserts (0 = disabled)

§redis_eviction_enabled: bool

Redis eviction: enable proactive eviction before Redis LRU kicks in

§redis_eviction_start: f64

Redis eviction: pressure threshold to start evicting (0.0-1.0, default: 0.75)

§redis_eviction_target: f64

Redis eviction: target pressure after eviction (0.0-1.0, default: 0.60)

§merkle_calc_enabled: bool

Merkle 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: u64

Merkle 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: bool

CDC Stream: Enable Change Data Capture output to Redis Stream.

When enabled, every Put/Delete writes to {redis_prefix}:cdc. This enables external replication agents to tail changes. Default: false (opt-in feature)

§cdc_stream_maxlen: u64

CDC Stream: Maximum entries before approximate trimming (MAXLEN ~).

Consumers that fall behind this limit rely on Merkle repair. Default: 100,000 entries

§redis_timeout_ms: u64

Redis 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: u64

Redis response timeout in milliseconds.

Maximum time to wait for Redis to respond after sending a command. Default: 5000 (5 seconds)

§sql_write_concurrency: usize

Maximum concurrent SQL write operations.

Limits simultaneous sql_put_batch and merkle_nodes updates to reduce row-level lock contention and deadlocks under high load. Default: 4 (good balance for most MySQL setups)

§merkle_log_interval_secs: u64
👎Deprecated since 0.2.0: Merkle tick removed; use cold path logging instead

Merkle diagnostic tick interval in seconds (DEPRECATED, no longer used).

Cold path logging now provides better visibility into merkle sync state. This field is retained for backwards compatibility with existing configs.

Trait Implementations§

Source§

impl Clone for SyncEngineConfig

Source§

fn clone(&self) -> SyncEngineConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SyncEngineConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SyncEngineConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SyncEngineConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,