pub struct BookmarksSyncEngine { /* private fields */ }
Implementations§
source§impl BookmarksSyncEngine
impl BookmarksSyncEngine
pub fn new(db: Arc<SharedPlacesDb>) -> Result<Self>
Trait Implementations§
source§impl SyncEngine for BookmarksSyncEngine
impl SyncEngine for BookmarksSyncEngine
source§fn wipe(&self) -> Result<()>
fn wipe(&self) -> Result<()>
Erases all local items. Unlike reset
, this keeps all synced items
until the next sync, when they will be replaced with tombstones. This
also preserves the sync ID and last sync time.
Conceptually, the next sync will merge an empty local tree, and a full remote tree.
fn collection_name(&self) -> CollectionName
source§fn stage_incoming(
&self,
inbound: Vec<IncomingBso>,
telem: &mut Engine,
) -> Result<()>
fn stage_incoming( &self, inbound: Vec<IncomingBso>, telem: &mut Engine, ) -> Result<()>
Stage some incoming records. This might be called multiple times in the same sync
if we fetch the incoming records in batches. Read more
source§fn apply(
&self,
timestamp: ServerTimestamp,
telem: &mut Engine,
) -> Result<Vec<OutgoingBso>>
fn apply( &self, timestamp: ServerTimestamp, telem: &mut Engine, ) -> Result<Vec<OutgoingBso>>
Apply the staged records, returning outgoing records.
Ideally we would adjust this model to better support batching of outgoing records
without needing to keep them all in memory (ie, an iterator or similar?)
source§fn set_uploaded(
&self,
new_timestamp: ServerTimestamp,
ids: Vec<SyncGuid>,
) -> Result<()>
fn set_uploaded( &self, new_timestamp: ServerTimestamp, ids: Vec<SyncGuid>, ) -> Result<()>
Indicates that the given record IDs were uploaded successfully to the server.
This may be called multiple times per sync, once for each batch. Batching is determined
dynamically based on payload sizes and counts via the server’s advertised limits.
source§fn sync_finished(&self) -> Result<()>
fn sync_finished(&self) -> Result<()>
Called once the sync is finished. Not currently called if uploads fail (which
seems sad, but the other batching confusion there needs sorting out first).
Many engines will have nothing to do here, as most “post upload” work should be
done in
set_uploaded()
source§fn get_collection_request(
&self,
server_timestamp: ServerTimestamp,
) -> Result<Option<CollectionRequest>>
fn get_collection_request( &self, server_timestamp: ServerTimestamp, ) -> Result<Option<CollectionRequest>>
The engine is responsible for building a single collection request. Engines
typically will store a lastModified timestamp and use that to build a
request saying “give me full records since that date” - however, other
engines might do something fancier. It can return None if the server timestamp
has not advanced since the last sync.
This could even later be extended to handle “backfills”, and we might end up
wanting one engine to use multiple collections (eg, as a “foreign key” via guid), etc.
source§fn get_sync_assoc(&self) -> Result<EngineSyncAssociation>
fn get_sync_assoc(&self) -> Result<EngineSyncAssociation>
Get persisted sync IDs. If they don’t match the global state we’ll be
reset()
with the new IDs.source§fn reset(&self, assoc: &EngineSyncAssociation) -> Result<()>
fn reset(&self, assoc: &EngineSyncAssociation) -> Result<()>
Reset the engine (and associated store) without wiping local data,
ready for a “first sync”.
assoc
defines how this store is to be associated with sync.§fn prepare_for_sync(
&self,
_get_client_data: &dyn Fn() -> ClientData,
) -> Result<(), Error>
fn prepare_for_sync( &self, _get_client_data: &dyn Fn() -> ClientData, ) -> Result<(), Error>
Prepares the engine for syncing. The tabs engine currently uses this to
store the current list of clients, which it uses to look up device names
and types. Read more
§fn set_local_encryption_key(&mut self, _key: &str) -> Result<(), Error>
fn set_local_encryption_key(&mut self, _key: &str) -> Result<(), Error>
Tells the engine what the local encryption key is for the data managed
by the engine. This is only used by collections that store data
encrypted locally and is unrelated to the encryption used by Sync.
The intent is that for such collections, this key can be used to
decrypt local data before it is re-encrypted by Sync and sent to the
storage servers, and similarly, data from the storage servers will be
decrypted by Sync, then encrypted by the local encryption key before
being added to the local database. Read more
Auto Trait Implementations§
impl Freeze for BookmarksSyncEngine
impl !RefUnwindSafe for BookmarksSyncEngine
impl Send for BookmarksSyncEngine
impl Sync for BookmarksSyncEngine
impl Unpin for BookmarksSyncEngine
impl !UnwindSafe for BookmarksSyncEngine
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
§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
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>
Read more