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

Description

Manages the persistent FIFO queue of serialized mutation operations captured while the device is offline or the backend is unreachable. Each entry stores the operation type, target API endpoint, serialized JSON payload, retry count, and creation timestamp. Built on drift (type-safe SQLite) ensuring durability across app restarts.

Feature: Offline Support & Data Sync

offline-queue-repository

Responsibilities

  • Enqueue pending mutations with full serialized payload and metadata
  • Dequeue operations in FIFO order for sync processing
  • Track retry counts and mark failed operations for backoff
  • Purge successfully synced operations from the queue
  • Expose queue depth for UI status display

Interfaces

enqueue(operation: PendingOperation): Future<void>
dequeueNext(): Future<PendingOperation?>
peekAll(): Future<List<PendingOperation>>
markSuccess(id: int): Future<void>
markFailed(id: int, error: String): Future<void>
incrementRetry(id: int): Future<void>
delete(id: int): Future<void>
clearAll(): Future<void>
getQueueDepth(): Future<int>
watchQueueDepth(): Stream<int>
getFailedOperations(): Future<List<PendingOperation>>

Relationships

Dependencies (1)

Components this component depends on

Dependents (2)

Components that depend on this component

Related Data Entities (1)

Data entities managed by this component