Service Layer high complexity mobile
1
Dependencies
0
Dependents
13
Entities
0
Integrations

Description

Orchestrates automatic synchronization of queued offline mutations and data refreshes when the device regains connectivity. Reads the offline mutation queue from the local SQLite database, batches mutations by entity type, calls the REST API, and marks records as synced or failed. Writes sync progress and unresolvable conflicts to a status table that the foreground app reads on next launch to display user-facing messages.

Feature: Background Sync

background-sync-service

Responsibilities

  • Read pending mutations from offline queue and batch by entity type
  • Execute batched API calls to upload pending changes to backend
  • Download fresh data from backend and update local database
  • Track sync progress and write status for foreground consumption
  • Detect and surface unresolvable data conflicts to the notification system

Interfaces

executeSyncCycle()
uploadPendingMutations(batch: MutationBatch)
downloadFreshData(entityTypes: List<String>)
getSyncStatus(): SyncStatus
getConflicts(): List<SyncConflict>
markRecordSynced(recordId: String)
markRecordFailed(recordId: String, reason: String)
isSyncInProgress(): bool
cancelSync()

Relationships

Dependencies (1)

Components this component depends on