Skip to content

Commit

Permalink
Only verify relevant buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
simolus3 committed Feb 4, 2025
1 parent c99c043 commit 7ed6945
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/powersync_core/lib/src/bucket_storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class BucketStorage {
final rs =
await select("SELECT powersync_validate_checkpoint(?) as result", [
jsonEncode({
...checkpoint.toJson(),
...checkpoint.toJson(priority: priority),
if (priority != null) 'priority': priority,
})
]);
Expand Down
3 changes: 2 additions & 1 deletion packages/powersync_core/lib/src/sync_types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ final class Checkpoint extends StreamingSyncLine {
.map((b) => BucketChecksum.fromJson(b))
.toList();

Map<String, dynamic> toJson() {
Map<String, dynamic> toJson({int? priority}) {
return {
'last_op_id': lastOpId,
'write_checkpoint': writeCheckpoint,
'buckets': checksums
.where((c) => priority == null || c.priority <= priority)
.map((c) => {'bucket': c.bucket, 'checksum': c.checksum})
.toList(growable: false)
};
Expand Down

0 comments on commit 7ed6945

Please sign in to comment.