SyncEngine
Drives offline, cross-device delta sync for user-owned resources through one generic loop. Resources plug in as SyncResourceAdapters; this engine owns the contract invariants (ack guard, pending guard, full-snapshot tombstone reconciliation, pagination drain, fullResyncRequired), so they hold identically for all resources and a new resource cannot accidentally skip one.
This is a plain, DI-framework-agnostic class: construct it with your own SyncCursorStore and (optionally) a SyncTelemetrySink, and wire it into whatever DI container your app uses.
Coroutine cancellation is never converted into a failed Result: cancelling the caller cancels the pass and rethrows CancellationException, and is not reported as a sync failure.
Parameters
wall-clock source for lastSyncedAt and telemetry durations; override in tests.
Constructors
Functions
Runs a single resource's sync pass with one unbounded push and response pages of limit rows.
Runs a resource with at most pushBatchSize pending rows per request, counting upserts and deletes together. limit still controls response page size and is sent unchanged.
Runs adapters in sequence under one sync pass. Per-resource isolation: one resource failing does not abort the others; the first failure (if any) is returned once all adapters have been attempted, with later failures attached via Throwable.addSuppressed.
Runs all resources with opt-in bounded pushes. See sync for the server requirements and the distinction between limit and pushBatchSize. Failures remain isolated per resource.