pub struct SyncConfig {
pub agent_id: String,
pub tenant_id: String,
pub store_id: String,
pub buffer_capacity: usize,
pub batch_size: usize,
pub outbox_capacity: usize,
pub outbox_path: Option<String>,
}Expand description
Configuration for the sync engine.
Maps to the JS SyncConfig (agent_id, tenant_id, store_id) plus
tuning knobs for buffer capacity and batch sizes.
§Examples
use stateset_sync::SyncConfig;
let config = SyncConfig::new("agent-1", "tenant-1", "store-1");
assert_eq!(config.agent_id, "agent-1");
assert_eq!(config.buffer_capacity, 1000);Fields§
§agent_id: StringUnique identifier for this agent.
tenant_id: StringTenant identifier for multi-tenancy.
store_id: StringStore identifier within the tenant.
buffer_capacity: usizeMaximum number of events the in-memory buffer can hold.
batch_size: usizeMaximum events per push/pull batch.
outbox_capacity: usizeMaximum pending local events in the outbox.
outbox_path: Option<String>Optional durable outbox snapshot path.
Implementations§
Source§impl SyncConfig
impl SyncConfig
Sourcepub fn new(
agent_id: impl Into<String>,
tenant_id: impl Into<String>,
store_id: impl Into<String>,
) -> Self
pub fn new( agent_id: impl Into<String>, tenant_id: impl Into<String>, store_id: impl Into<String>, ) -> Self
Create a new SyncConfig with sensible defaults.
Sourcepub const fn with_buffer_capacity(self, capacity: usize) -> Self
pub const fn with_buffer_capacity(self, capacity: usize) -> Self
Set the buffer capacity.
Sourcepub const fn with_batch_size(self, batch_size: usize) -> Self
pub const fn with_batch_size(self, batch_size: usize) -> Self
Set the batch size.
Sourcepub const fn with_outbox_capacity(self, capacity: usize) -> Self
pub const fn with_outbox_capacity(self, capacity: usize) -> Self
Set the outbox capacity.
Sourcepub fn with_outbox_path(self, path: impl Into<String>) -> Self
pub fn with_outbox_path(self, path: impl Into<String>) -> Self
Set the durable outbox path.
Sourcepub fn resolved_buffer_capacity(&self) -> usize
pub fn resolved_buffer_capacity(&self) -> usize
Resolve a valid buffer capacity.
Sourcepub fn resolved_batch_size(&self) -> usize
pub fn resolved_batch_size(&self) -> usize
Resolve a valid batch size.
Sourcepub fn resolved_outbox_capacity(&self) -> usize
pub fn resolved_outbox_capacity(&self) -> usize
Resolve a valid outbox capacity.
Trait Implementations§
Source§impl Clone for SyncConfig
impl Clone for SyncConfig
Source§fn clone(&self) -> SyncConfig
fn clone(&self) -> SyncConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SyncConfig
impl Debug for SyncConfig
Source§impl<'de> Deserialize<'de> for SyncConfig
impl<'de> Deserialize<'de> for SyncConfig
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SyncConfig
impl RefUnwindSafe for SyncConfig
impl Send for SyncConfig
impl Sync for SyncConfig
impl Unpin for SyncConfig
impl UnsafeUnpin for SyncConfig
impl UnwindSafe for SyncConfig
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
Mutably borrows from an owned value. Read more