Sync Queue Repository
Component Detail
Data Layer
medium complexity
mobile
1
Dependencies
1
Dependents
0
Entities
0
Integrations
Description
Provides durable, ordered storage for pending sync operations in the local SQLite database. Each entry records the operation type, target entity ID, serialized payload, timestamp, retry count, and last error. The queue survives app restarts and supports ordered retrieval, status updates, and flagging of failed items.
sync-queue-repository
Responsibilities
- Persist pending sync operations with full metadata including operation type, entity ID, payload, retry count, and last error
- Retrieve the ordered queue of pending operations for sequential processing
- Update item status across the lifecycle: pending, in_progress, completed, failed, flagged
- Increment retry counters and record error messages on failure
- Expose flagged items for the user-facing error review surface
Interfaces
enqueue(operation: SyncOperation): Future<void>
dequeueNext(): Future<SyncOperation?>
getPendingCount(): Future<int>
markCompleted(id: String): Future<void>
markFailed(id: String, error: String, retryCount: int): Future<void>
flagForReview(id: String): Future<void>
getFlaggedItems(): Future<List<SyncOperation>>
clearCompleted(): Future<void>