run_single_sync_cycle

Function run_single_sync_cycle 

Source
pub async unsafe fn run_single_sync_cycle(
    storage: &dyn SyncStorage,
    device_id: &str,
    hlc: &Hlc,
    clock: &dyn Clock,
    raw_db: *mut sqlite3,
    session: SyncSession,
    encryption: &RwLock<EncryptionService>,
    user_keypair: &UserKeypair,
    db: &dyn SyncBookkeeping,
    library_dir: &LibraryDir,
    cloud_home: Option<&dyn CloudHome>,
    blob_plan: &dyn BlobPlan,
    observer: Option<&dyn BlobUploadObserver>,
) -> SyncCycleOutcome
Expand description

Run a single sync cycle: grab changeset, push, pull, restart session.

This manages all the state (local_seq, cursors, staging, snapshots) by loading/persisting from the database each cycle, rather than keeping mutable state across calls.

Always tries to return a usable session, even on error.

ยงSafety

raw_db must be a valid sqlite3 write connection pointer that outlives this call. session is consumed and a new one is started on raw_db.