Skip to main content

LocalStore

Trait LocalStore 

Source
pub trait LocalStore<T>: Send + Sync {
    // Required methods
    fn all(&self) -> SyncResult<Vec<T>>;
    fn remove(&self, id: &str) -> SyncResult<()>;
    fn apply_remote(&self, items: &[T]) -> SyncResult<Vec<ApplyOutcome>>;

    // Provided method
    fn list_page(
        &self,
        _after: Option<&str>,
        _limit: usize,
    ) -> SyncResult<Option<Vec<T>>> { ... }
}
Expand description

The app’s local data. All calls are synchronous.

Required Methods§

Source

fn all(&self) -> SyncResult<Vec<T>>

Source

fn remove(&self, id: &str) -> SyncResult<()>

Remove a locally held item because of a tombstone. Idempotent.

Source

fn apply_remote(&self, items: &[T]) -> SyncResult<Vec<ApplyOutcome>>

Upsert downloaded items; one outcome per input, in order. Err aborts the pass WITHOUT advancing the change token.

Provided Methods§

Source

fn list_page( &self, _after: Option<&str>, _limit: usize, ) -> SyncResult<Option<Vec<T>>>

Optional paged listing so a pass never materialises the whole store. Return up to limit items whose ItemHeader::id is strictly greater (byte-wise) than after (None = from the start), in ascending id order, with no item skipped or repeated across consecutive calls over an unchanged store. Ok(None) (the default) means the store does not page and the engine falls back to all(); it must answer the same way on every call.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§