Skip to content

Commit d238769

Browse files
committed
Validate partial checksums
1 parent ad25f05 commit d238769

File tree

7 files changed

+41
-35
lines changed

7 files changed

+41
-35
lines changed

demos/django-todolist/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*.swp
66
.DS_Store
77
.atom/
8+
.build/
89
.buildlog/
910
.history
1011
.svn/
12+
.swiftpm/
1113
migrate_working_dir/
1214

1315
# IntelliJ related

demos/django-todolist/macos/Podfile.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ PODS:
33
- path_provider_foundation (0.0.1):
44
- Flutter
55
- FlutterMacOS
6-
- powersync-sqlite-core (0.1.6)
6+
- powersync-sqlite-core (0.3.9)
77
- powersync_flutter_libs (0.0.1):
88
- FlutterMacOS
9-
- powersync-sqlite-core (~> 0.1.6)
9+
- powersync-sqlite-core (~> 0.3.8)
1010
- shared_preferences_foundation (0.0.1):
1111
- Flutter
1212
- FlutterMacOS
@@ -55,13 +55,13 @@ EXTERNAL SOURCES:
5555

5656
SPEC CHECKSUMS:
5757
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
58-
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
59-
powersync-sqlite-core: 4c38c8f470f6dca61346789fd5436a6826d1e3dd
60-
powersync_flutter_libs: 1eb1c6790a72afe08e68d4cc489d71ab61da32ee
61-
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
58+
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
59+
powersync-sqlite-core: 7515d321eb8e3c08b5259cdadb9d19b1876fe13a
60+
powersync_flutter_libs: 330d8309223a121ec15a7334d9edc105053e5f82
61+
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
6262
sqlite3: 292c3e1bfe89f64e51ea7fc7dab9182a017c8630
63-
sqlite3_flutter_libs: 5ca46c1a04eddfbeeb5b16566164aa7ad1616e7b
63+
sqlite3_flutter_libs: 03311aede9d32fb2d24e32bebb8cd01c3b2e6239
6464

6565
PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367
6666

67-
COCOAPODS: 1.15.2
67+
COCOAPODS: 1.16.2
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import Cocoa
22
import FlutterMacOS
33

4-
@NSApplicationMain
4+
@main
55
class AppDelegate: FlutterAppDelegate {
66
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
77
return true
88
}
9+
10+
override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
11+
return true
12+
}
913
}

demos/django-todolist/macos/Runner/Configs/AppInfo.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
PRODUCT_NAME = PowerSync Django Demo
99

1010
// The application's bundle identifier
11-
PRODUCT_BUNDLE_IDENTIFIER = co.powersync.demotodolist
11+
PRODUCT_BUNDLE_IDENTIFIER = co.powersync.demotodolist.django
1212

1313
// The copyright displayed in application information
1414
PRODUCT_COPYRIGHT = Copyright © 2023 Journey Mobile, Inc. All rights reserved.

demos/django-todolist/pubspec.lock

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ packages:
55
dependency: transitive
66
description:
77
name: args
8-
sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
8+
sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "2.5.0"
11+
version: "2.6.0"
1212
async:
1313
dependency: transitive
1414
description:
@@ -152,14 +152,6 @@ packages:
152152
url: "https://pub.dev"
153153
source: hosted
154154
version: "4.0.2"
155-
js:
156-
dependency: transitive
157-
description:
158-
name: js
159-
sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
160-
url: "https://pub.dev"
161-
source: hosted
162-
version: "0.7.1"
163155
json_annotation:
164156
dependency: transitive
165157
description:
@@ -318,21 +310,21 @@ packages:
318310
path: "../../packages/powersync"
319311
relative: true
320312
source: path
321-
version: "1.10.0"
313+
version: "1.11.2"
322314
powersync_core:
323315
dependency: "direct overridden"
324316
description:
325317
path: "../../packages/powersync_core"
326318
relative: true
327319
source: path
328-
version: "1.0.0"
320+
version: "1.1.2"
329321
powersync_flutter_libs:
330322
dependency: "direct overridden"
331323
description:
332324
path: "../../packages/powersync_flutter_libs"
333325
relative: true
334326
source: path
335-
version: "0.4.3"
327+
version: "0.4.4"
336328
pub_semver:
337329
dependency: transitive
338330
description:
@@ -430,10 +422,10 @@ packages:
430422
dependency: transitive
431423
description:
432424
name: sqlite3
433-
sha256: bb174b3ec2527f9c5f680f73a89af8149dd99782fbb56ea88ad0807c5638f2ed
425+
sha256: "35d3726fe18ab1463403a5cc8d97dbc81f2a0b08082e8173851363fcc97b6627"
434426
url: "https://pub.dev"
435427
source: hosted
436-
version: "2.4.7"
428+
version: "2.7.2"
437429
sqlite3_flutter_libs:
438430
dependency: transitive
439431
description:
@@ -446,18 +438,18 @@ packages:
446438
dependency: transitive
447439
description:
448440
name: sqlite3_web
449-
sha256: f22d1dda7a40be0867984f55cdf5c2d599e5f05d3be4a642d78f38b38983f554
441+
sha256: "870f287c2375117af1f769893c5ea0941882ee820444af5c3dcceec3b217aab1"
450442
url: "https://pub.dev"
451443
source: hosted
452-
version: "0.2.0"
444+
version: "0.3.0"
453445
sqlite_async:
454446
dependency: "direct main"
455447
description:
456448
name: sqlite_async
457-
sha256: d66fb6e6d07c1a834743326c033029f75becbb1fad6823d709f921872abc3d5b
449+
sha256: "70836e6a5dae2d14ce585934d1d6ce22433c1be825e78908a4b2a18333f7073c"
458450
url: "https://pub.dev"
459451
source: hosted
460-
version: "0.11.0"
452+
version: "0.11.2"
461453
stack_trace:
462454
dependency: transitive
463455
description:
@@ -563,5 +555,5 @@ packages:
563555
source: hosted
564556
version: "3.1.2"
565557
sdks:
566-
dart: ">=3.4.0 <4.0.0"
558+
dart: ">=3.5.0 <4.0.0"
567559
flutter: ">=3.22.0"

packages/powersync_core/lib/src/bucket_storage.dart

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class BucketStorage {
114114

115115
Future<SyncLocalDatabaseResult> syncLocalDatabase(Checkpoint checkpoint,
116116
{int? forPriority}) async {
117-
final r = await validateChecksums(checkpoint);
117+
final r = await validateChecksums(checkpoint, priority: forPriority);
118118

119119
if (!r.checkpointValid) {
120120
for (String b in r.checkpointFailures ?? []) {
@@ -165,10 +165,15 @@ class BucketStorage {
165165
}, flush: true);
166166
}
167167

168-
Future<SyncLocalDatabaseResult> validateChecksums(
169-
Checkpoint checkpoint) async {
170-
final rs = await select("SELECT powersync_validate_checkpoint(?) as result",
171-
[jsonEncode(checkpoint)]);
168+
Future<SyncLocalDatabaseResult> validateChecksums(Checkpoint checkpoint,
169+
{int? priority}) async {
170+
final rs =
171+
await select("SELECT powersync_validate_checkpoint(?) as result", [
172+
jsonEncode({
173+
...checkpoint.toJson(),
174+
if (priority != null) 'priority': priority,
175+
})
176+
]);
172177
final result = jsonDecode(rs[0]['result']);
173178
if (result['valid']) {
174179
return SyncLocalDatabaseResult(ready: true);

packages/powersync_core/lib/src/sync_types.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ sealed class StreamingSyncLine {
1313
} else if (line.containsKey('checkpoint_complete')) {
1414
return StreamingSyncCheckpointComplete.fromJson(
1515
line['checkpoint_complete']);
16+
} else if (line.containsKey('partial_checkpoint_complete')) {
17+
return StreamingSyncCheckpointPartiallyComplete.fromJson(
18+
line['partial_checkpoint_complete']);
1619
} else if (line.containsKey('data')) {
1720
return SyncBucketData.fromJson(line['data']);
1821
} else if (line.containsKey('token_expires_in')) {

0 commit comments

Comments
 (0)