TabsEngine

Struct TabsEngine 

Source
pub struct TabsEngine {
    pub local_id: RwLock<String>,
    /* private fields */
}

Fields§

§local_id: RwLock<String>

Implementations§

Source§

impl TabsEngine

Source

pub fn new(store: Arc<TabsStore>) -> Self

Trait Implementations§

Source§

impl SyncEngine for TabsEngine

Source§

fn collection_name(&self) -> CollectionName

Source§

fn last_sync(&self) -> Result<Option<ServerTimestamp>>

Return the last sync timestamp, only called for bridged engines.
Source§

fn reset_last_sync(&self) -> Result<()>

Reset the last sync timestampf or the engine, only called for bridged engines.
Source§

fn set_clients(&self, get_client_data: &dyn Fn() -> ClientData) -> Result<()>

Supplies the engine with the current set of Sync clients (ie, other devices connected to the account). Might be called at any time.
Source§

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>>

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<Guid>, ) -> 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 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 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.
Source§

fn wipe(&self) -> Result<()>

Wipes the engine’s local data. Triggered by a client command (only bookmarks at time of writing), or to wipe local data when disconnecting (currently only on desktop via a bridged-engine).
Source§

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.
§

fn sync_started(&self) -> Result<(), Error>

Indicates that a sync is starting.
§

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
§

fn sync_finished(&self) -> Result<(), Error>

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()

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. 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, 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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,