Skip to main content

SyncEngine

Struct SyncEngine 

Source
pub struct SyncEngine { /* private fields */ }
Expand description

Serialized synchronization state machine.

Implementations§

Source§

impl SyncEngine

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn cancel(&mut self) -> SyncEngineSnapshot

Cancel and clear process-local reconciliation state.

Source

pub fn snapshot(&self) -> SyncEngineSnapshot

Return one redacted serializable snapshot.

Trait Implementations§

Source§

impl Debug for SyncEngine

Source§

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

Formats the value using the given formatter. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. 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> Same for T

Source§

type Output = T

Should always be Self
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.
§

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

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,