pub struct SyncService {
pub device_id: String,
}Expand description
Configuration for a sync service.
Fields§
§device_id: StringImplementations§
Source§impl SyncService
impl SyncService
pub fn new(device_id: String) -> Self
Sourcepub async unsafe fn sync(
&self,
db: *mut sqlite3,
session: SyncSession,
local_seq: u64,
cursors: &HashMap<String, u64>,
storage: &dyn SyncStorage,
timestamp: &str,
message: &str,
keypair: &UserKeypair,
library_dir: &LibraryDir,
blob_plan: &dyn BlobPlan,
) -> Result<SyncResult, SyncCycleError>
pub async unsafe fn sync( &self, db: *mut sqlite3, session: SyncSession, local_seq: u64, cursors: &HashMap<String, u64>, storage: &dyn SyncStorage, timestamp: &str, message: &str, keypair: &UserKeypair, library_dir: &LibraryDir, blob_plan: &dyn BlobPlan, ) -> Result<SyncResult, SyncCycleError>
Run a full sync cycle.
This takes the current session, grabs its changeset, drops the session, pulls remote changes, and returns what the caller needs to push and to start a new session.
The message parameter is a human-readable description of what changed
(e.g., “Imported Album One”). Callers derive this from the app event
that triggered the sync.
The caller should:
- Push
outgoingto the storage (if Some). - Persist
updated_cursorsto the sync_cursors table. - Start a new SyncSession on the write connection.
§Safety
db must be a valid, open sqlite3 connection pointer.
The session must have been created on this same connection.
Auto Trait Implementations§
impl Freeze for SyncService
impl RefUnwindSafe for SyncService
impl Send for SyncService
impl Sync for SyncService
impl Unpin for SyncService
impl UnwindSafe for SyncService
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.