pub struct SyncEngine { /* private fields */ }Expand description
Serialized synchronization state machine.
Implementations§
Source§impl SyncEngine
impl SyncEngine
Sourcepub fn new(
sync_id: String,
neg_subscription_id: String,
event_subscription_id: String,
since_timestamp: Option<i64>,
checkpoint_timestamp: i64,
) -> Result<Self, SoftchatError>
pub fn new( sync_id: String, neg_subscription_id: String, event_subscription_id: String, since_timestamp: Option<i64>, checkpoint_timestamp: i64, ) -> Result<Self, SoftchatError>
Construct one synchronization coordinator.
§Errors
Returns a stable sync-state error for invalid identifiers, timestamps, or an inverted checkpoint range.
Sourcepub fn begin(&mut self) -> Result<SyncAction, SoftchatError>
pub fn begin(&mut self) -> Result<SyncAction, SoftchatError>
Start synchronization by requesting the first platform snapshot.
§Errors
Returns a stable sync-state error when called outside Idle.
Sourcepub fn accept_snapshot(
&mut self,
items: Vec<NegentropyItem>,
frame_size_limit: u64,
) -> Result<SyncAction, SoftchatError>
pub fn accept_snapshot( &mut self, items: Vec<NegentropyItem>, frame_size_limit: u64, ) -> Result<SyncAction, SoftchatError>
Consume one bounded local snapshot and produce NEG-OPEN.
Items may arrive in any order; the coordinator computes the oldest timestamp and the reviewed Negentropy engine canonicalizes the set.
§Errors
Returns a stable synchronization/Negentropy error for a stale phase, oversized page, duplicate ID, invalid timestamp, or invalid frame size.
Sourcepub fn reconcile(
&mut self,
subscription_id: String,
message: Vec<u8>,
) -> Result<Vec<SyncAction>, SoftchatError>
pub fn reconcile( &mut self, subscription_id: String, message: Vec<u8>, ) -> Result<Vec<SyncAction>, SoftchatError>
Consume one correlated NEG-MSG and emit all resulting actions.
Have/need IDs accumulate across every frame. Stale subscription IDs and messages after reconciliation closes are rejected.
§Errors
Returns a stable sync/Negentropy error for malformed or stale input.
Sourcepub fn record_fetched_event(
&mut self,
subscription_id: String,
event_id: String,
) -> Result<(), SoftchatError>
pub fn record_fetched_event( &mut self, subscription_id: String, event_id: String, ) -> Result<(), SoftchatError>
Record one requested event received on the current subscription.
Authentication and persistence are separate; this call alone does not permit checkpoint advancement.
§Errors
Returns a stable sync-state error for a stale subscription, duplicate, malformed, or unrequested event ID.
Sourcepub fn confirm_committed(
&mut self,
event_ids: Vec<String>,
) -> Result<(), SoftchatError>
pub fn confirm_committed( &mut self, event_ids: Vec<String>, ) -> Result<(), SoftchatError>
Confirm an authoritative platform transaction committed requested IDs.
§Errors
Returns a stable sync-state error for a stale phase, duplicate, unrequested, or not-yet-received ID.
Sourcepub fn finish_fetch(
&mut self,
subscription_id: String,
) -> Result<Vec<SyncAction>, SoftchatError>
pub fn finish_fetch( &mut self, subscription_id: String, ) -> Result<Vec<SyncAction>, SoftchatError>
Close the ordinary event fetch only after every requested ID committed.
§Errors
Returns a stable sync-state error for a stale subscription or incomplete receipt set.
Sourcepub fn checkpoint_saved(
&mut self,
checkpoint_timestamp: i64,
) -> Result<SyncAction, SoftchatError>
pub fn checkpoint_saved( &mut self, checkpoint_timestamp: i64, ) -> Result<SyncAction, SoftchatError>
Confirm the platform durably saved the final checkpoint.
§Errors
Returns a stable sync-state error for a stale phase or mismatched value.
Sourcepub fn cancel(&mut self) -> SyncEngineSnapshot
pub fn cancel(&mut self) -> SyncEngineSnapshot
Cancel and clear process-local reconciliation state.
Sourcepub fn snapshot(&self) -> SyncEngineSnapshot
pub fn snapshot(&self) -> SyncEngineSnapshot
Return one redacted serializable snapshot.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SyncEngine
impl RefUnwindSafe for SyncEngine
impl Send for SyncEngine
impl Sync for SyncEngine
impl Unpin for SyncEngine
impl UnsafeUnpin for SyncEngine
impl UnwindSafe for SyncEngine
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
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more