pub struct MemoryBackend { /* private fields */ }Implementations§
Source§impl MemoryBackend
impl MemoryBackend
pub fn new() -> Self
pub fn set_offline(&self, offline: bool)
pub fn set_page_size(&self, n: usize)
pub fn expire_token_once(&self)
Sourcepub fn fail_after_saves(&self, n: Option<usize>)
pub fn fail_after_saves(&self, n: Option<usize>)
Next save_records calls accept n records in total, then fail the
rest with a transient error (partial batch success).
Sourcepub fn concurrent_write_before_next_save(&self, record: RawRecord)
pub fn concurrent_write_before_next_save(&self, record: RawRecord)
Simulate a concurrent write by another device between fetch and save.
pub fn save_calls(&self) -> usize
pub fn saved_records(&self) -> usize
pub fn put_record(&self, record: RawRecord)
pub fn delete_record(&self, name: &str)
pub fn record(&self, name: &str) -> Option<RawRecord>
pub fn record_count(&self) -> usize
Trait Implementations§
Source§impl Backend for MemoryBackend
impl Backend for MemoryBackend
Source§fn prepare(&self) -> SyncResult<()>
fn prepare(&self) -> SyncResult<()>
Create zone/subscription (idempotent).
Source§fn fetch_changes(&self, since: Option<&[u8]>) -> SyncResult<ChangePage>
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, name: &str) -> SyncResult<Option<RawRecord>>
fn fetch_record(&self, 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>>
fn save_records( &self, records: &[RawRecord], policy: SavePolicy, ) -> SyncResult<Vec<RecordOutcome>>
Non-atomic batch save: one outcome per input.
Err = whole call failed.fn max_batch(&self) -> usize
Source§impl Clone for MemoryBackend
impl Clone for MemoryBackend
Auto Trait Implementations§
impl Freeze for MemoryBackend
impl RefUnwindSafe for MemoryBackend
impl Send for MemoryBackend
impl Sync for MemoryBackend
impl Unpin for MemoryBackend
impl UnsafeUnpin for MemoryBackend
impl UnwindSafe for MemoryBackend
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