Data Layer medium complexity mobile
0
Dependencies
0
Dependents
1
Entities
0
Integrations

Description

Persistent local queue that captures every create, update, and delete performed while offline. Provides ordered access for the sync engine and supports removal of successfully reconciled entries.

Feature: Background Sync

sync-outbox-store

Sources & reasoning

Second canonical feature of the Offline & Sync area per §8. The Core/Shared architecture block explicitly describes mutation outbox, retry/backoff, ID mapping, and conflict resolver - all responsibilities of this feature. MVP because offline support is unsafe without reconciliation.

  • Offline-first persistence (Drift + SQLCipher encrypted local DB, mutation outbox, sync queue with retry/backoff, ID mapping for offline-created entities, conflict resolver)
  • Optimistic mutations with automatic rollback on failure (contact edits and paginated list updates)
  • offline-sync | Offline & Sync | Offline Data Support, Background Sync

Responsibilities

  • Persist pending mutations across app restarts
  • Enqueue mutations in the order they were performed
  • Expose ordered iteration for the sync engine to drain
  • Remove or mark entries as completed after successful sync
  • Track retry attempts and failure metadata per entry

Interfaces

enqueue(mutation): OutboxEntryId
peek(limit): OutboxEntry[]
markCompleted(entryId): void
markFailed(entryId, error): void
getQueueDepth(): number

Related Data Entities (1)

Data entities managed by this component