Skip to main content

Backend

Trait Backend 

Source
pub trait Backend: Send + Sync {
    // Required methods
    fn prepare(&self) -> SyncResult<()>;
    fn fetch_changes(&self, since: Option<&[u8]>) -> SyncResult<ChangePage>;
    fn fetch_record(&self, record_name: &str) -> SyncResult<Option<RawRecord>>;
    fn save_records(
        &self,
        records: &[RawRecord],
        policy: SavePolicy,
    ) -> SyncResult<Vec<RecordOutcome>>;

    // Provided method
    fn max_batch(&self) -> usize { ... }
}
Expand description

The cloud zone. Method set mirrors the iOS CloudSyncService.

Required Methods§

Source

fn prepare(&self) -> SyncResult<()>

Create zone/subscription (idempotent).

Source

fn fetch_changes(&self, since: Option<&[u8]>) -> SyncResult<ChangePage>

ONE delta page since since (None = first fetch). Report an expired token as SyncError::TokenExpired and a missing zone as ZoneMissing.

Source

fn fetch_record(&self, record_name: &str) -> SyncResult<Option<RawRecord>>

Point read, used to obtain a change tag for a known record.

Source

fn save_records( &self, records: &[RawRecord], policy: SavePolicy, ) -> SyncResult<Vec<RecordOutcome>>

Non-atomic batch save: one outcome per input. Err = whole call failed.

Provided Methods§

Source

fn max_batch(&self) -> usize

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§