Skip to content

Commit 4ebad73

Browse files
committed
Avoid sync "operation" when talking about checkpoints
1 parent 8ac9f45 commit 4ebad73

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

packages/powersync_core/lib/src/database/powersync_db_mixin.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,14 @@ mixin PowerSyncDatabaseMixin implements SqliteConnection {
159159
}
160160
}
161161

162-
/// Returns a [Future] which will resolve once a synchronization operation has
163-
/// completed.
162+
/// Returns a [Future] which will resolve once at least one full sync cycle
163+
/// has completed (meaninng that the first consistent checkpoint has been
164+
/// reached across all buckets).
164165
///
165-
/// When [priority] is null (the default), this method waits for a full sync
166-
/// operation to complete. When set to a [BucketPriority] however, it also
167-
/// completes once a partial sync operation containing that priority has
168-
/// completed.
166+
/// When [priority] is null (the default), this method waits for the first
167+
/// full sync checkpoint to complete. When set to a [BucketPriority] however,
168+
/// it completes once all buckets within that priority (as well as those in
169+
/// higher priorities) have been synchronized at least once.
169170
Future<void> waitForFirstSync({BucketPriority? priority}) async {
170171
bool matches(SyncStatus status) {
171172
if (priority == null) {

packages/powersync_core/lib/src/sync_status.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,15 @@ final class SyncStatus {
9797
return downloadError ?? uploadError;
9898
}
9999

100-
/// Returns [lastSyncedAt] and [hasSynced] information for a partial sync
101-
/// operation, or `null` if the status for that priority is unknown.
100+
/// Returns information for [lastSyncedAt] and [hasSynced] information at a
101+
/// partial sync priority, or `null` if the status for that priority is
102+
/// unknown.
102103
///
103104
/// The information returned may be more generic than requested. For instance,
104-
/// a completed sync operation (as expressed by [lastSyncedAt]) also
105-
/// guarantees that every bucket priority was synchronized before that.
105+
/// a fully-completed sync cycle (as expressed by [lastSyncedAt]) necessarily
106+
/// includes all buckets across all priorities. So, if no further partial
107+
/// checkpoints have been received since that complete sync,
108+
/// [statusForPriority] may return information for that complete sync.
106109
/// Similarly, requesting the sync status for priority `1` may return
107110
/// information extracted from the lower priority `2` since each partial sync
108111
/// in priority `2` necessarily includes a consistent view over data in

0 commit comments

Comments
 (0)