Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bucket priorities and partial checkpoints #243

Merged
merged 28 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d0019a1
Use sealed classes for sync lines
simolus3 Jan 28, 2025
1fa7caa
Doc comments on sync lines
simolus3 Jan 29, 2025
6241a18
Add priority field
simolus3 Jan 29, 2025
8a28204
Track bucket priorities
simolus3 Jan 29, 2025
ad25f05
Fix tests
simolus3 Jan 30, 2025
d238769
Validate partial checksums
simolus3 Feb 3, 2025
1bd7447
Use updated format not persisting priorities
simolus3 Feb 3, 2025
f423ffd
Start with status API
simolus3 Feb 3, 2025
c99c043
Add status for each priority
simolus3 Feb 4, 2025
7ed6945
Only verify relevant buckets
simolus3 Feb 4, 2025
793e01e
Tests for partial sync operations
simolus3 Feb 5, 2025
c56188a
Merge remote-tracking branch 'origin/main' into feat/bucket-priorities
simolus3 Feb 10, 2025
9f6fec5
Fix unecessary null checks
simolus3 Feb 10, 2025
0da750c
Fix bad merges
simolus3 Feb 10, 2025
97db1fc
Fix initial hasSynced state
simolus3 Feb 10, 2025
c7bf51a
Merge branch 'main' into feat/bucket-priorities
simolus3 Feb 12, 2025
6feb3e0
Fix checking for completed syncs
simolus3 Feb 17, 2025
e7297c0
Merge branch 'main' into feat/bucket-priorities
simolus3 Feb 18, 2025
fc65039
Raise minimum core version
simolus3 Feb 18, 2025
fe88057
Fix web disconnect tests
simolus3 Feb 18, 2025
9df1e92
Don't pass unused priority to validate checkpoint impl
simolus3 Feb 18, 2025
8ac9f45
Test partial sync with data
simolus3 Feb 19, 2025
4ebad73
Avoid sync "operation" when talking about checkpoints
simolus3 Feb 21, 2025
b060725
Adopt priorities in example app
simolus3 Feb 21, 2025
ebc2652
Update core version
simolus3 Feb 24, 2025
cfdc111
Don't require priority on checksum
simolus3 Feb 24, 2025
505acb7
Clean up wait for first sync in lists widget
simolus3 Feb 24, 2025
12c4124
Rename statusInPriority to priorityStatusEntries
simolus3 Feb 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions demos/benchmarks/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- powersync-sqlite-core (0.3.10)
- powersync-sqlite-core (0.3.11)
- powersync_flutter_libs (0.0.1):
- Flutter
- powersync-sqlite-core (~> 0.3.10)
- powersync-sqlite-core (~> 0.3.11)
- "sqlite3 (3.46.1+1)":
- "sqlite3/common (= 3.46.1+1)"
- "sqlite3/common (3.46.1+1)"
Expand Down Expand Up @@ -50,8 +50,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
powersync-sqlite-core: c7045a44bb1040485ba46b42a3b0acaed424a5cd
powersync_flutter_libs: f33ed290b2813a13809ea4f0e6ae6621f3de8218
powersync-sqlite-core: 63f9e7adb74044ab7786e4f60e86994d13dcc7a9
powersync_flutter_libs: 86c1c5214cbeba9d555798de5aece225ad1f5971
sqlite3: 0bb0e6389d824e40296f531b858a2a0b71c0d2fb
sqlite3_flutter_libs: 9379996d65aa23dcda7585a5b58766cebe0aa042

Expand Down
8 changes: 4 additions & 4 deletions demos/django-todolist/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- powersync-sqlite-core (0.3.10)
- powersync-sqlite-core (0.3.11)
- powersync_flutter_libs (0.0.1):
- Flutter
- powersync-sqlite-core (~> 0.3.10)
- powersync-sqlite-core (~> 0.3.11)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
Expand Down Expand Up @@ -57,8 +57,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
powersync-sqlite-core: c7045a44bb1040485ba46b42a3b0acaed424a5cd
powersync_flutter_libs: f33ed290b2813a13809ea4f0e6ae6621f3de8218
powersync-sqlite-core: 63f9e7adb74044ab7786e4f60e86994d13dcc7a9
powersync_flutter_libs: 86c1c5214cbeba9d555798de5aece225ad1f5971
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sqlite3: 4922312598b67e1825c6a6c821296dcbf6783046
sqlite3_flutter_libs: 3c323550ef3b928bc0aa9513c841e45a7d242832
Expand Down
16 changes: 8 additions & 8 deletions demos/django-todolist/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- powersync-sqlite-core (0.1.6)
- powersync-sqlite-core (0.3.9)
- powersync_flutter_libs (0.0.1):
- FlutterMacOS
- powersync-sqlite-core (~> 0.1.6)
- powersync-sqlite-core (~> 0.3.8)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
Expand Down Expand Up @@ -55,13 +55,13 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
powersync-sqlite-core: 4c38c8f470f6dca61346789fd5436a6826d1e3dd
powersync_flutter_libs: 1eb1c6790a72afe08e68d4cc489d71ab61da32ee
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
powersync-sqlite-core: 7515d321eb8e3c08b5259cdadb9d19b1876fe13a
powersync_flutter_libs: 330d8309223a121ec15a7334d9edc105053e5f82
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sqlite3: 292c3e1bfe89f64e51ea7fc7dab9182a017c8630
sqlite3_flutter_libs: 5ca46c1a04eddfbeeb5b16566164aa7ad1616e7b
sqlite3_flutter_libs: 03311aede9d32fb2d24e32bebb8cd01c3b2e6239

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
6 changes: 5 additions & 1 deletion demos/django-todolist/macos/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import Cocoa
import FlutterMacOS

@NSApplicationMain
@main
class AppDelegate: FlutterAppDelegate {
override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}

override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
PRODUCT_NAME = PowerSync Django Demo

// The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = co.powersync.demotodolist
PRODUCT_BUNDLE_IDENTIFIER = co.powersync.demotodolist.django

// The copyright displayed in application information
PRODUCT_COPYRIGHT = Copyright © 2023 Journey Mobile, Inc. All rights reserved.
6 changes: 3 additions & 3 deletions demos/django-todolist/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -310,21 +310,21 @@ packages:
path: "../../packages/powersync"
relative: true
source: path
version: "1.11.2"
version: "1.11.3"
powersync_core:
dependency: "direct overridden"
description:
path: "../../packages/powersync_core"
relative: true
source: path
version: "1.1.2"
version: "1.1.3"
powersync_flutter_libs:
dependency: "direct overridden"
description:
path: "../../packages/powersync_flutter_libs"
relative: true
source: path
version: "0.4.4"
version: "0.4.5"
pub_semver:
dependency: transitive
description:
Expand Down
8 changes: 4 additions & 4 deletions demos/firebase-nodejs-todolist/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- powersync-sqlite-core (0.3.10)
- powersync-sqlite-core (0.3.11)
- powersync_flutter_libs (0.0.1):
- Flutter
- powersync-sqlite-core (~> 0.3.10)
- powersync-sqlite-core (~> 0.3.11)
- RecaptchaInterop (100.0.0)
- shared_preferences_foundation (0.0.1):
- Flutter
Expand Down Expand Up @@ -149,8 +149,8 @@ SPEC CHECKSUMS:
GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d
GTMSessionFetcher: 257ead9ba8e15a2d389d79496e02b9cc5dd0c62c
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
powersync-sqlite-core: c7045a44bb1040485ba46b42a3b0acaed424a5cd
powersync_flutter_libs: f33ed290b2813a13809ea4f0e6ae6621f3de8218
powersync-sqlite-core: 63f9e7adb74044ab7786e4f60e86994d13dcc7a9
powersync_flutter_libs: 86c1c5214cbeba9d555798de5aece225ad1f5971
RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sqlite3: 4922312598b67e1825c6a6c821296dcbf6783046
Expand Down
8 changes: 4 additions & 4 deletions demos/supabase-anonymous-auth/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- powersync-sqlite-core (0.3.10)
- powersync-sqlite-core (0.3.11)
- powersync_flutter_libs (0.0.1):
- Flutter
- powersync-sqlite-core (~> 0.3.10)
- powersync-sqlite-core (~> 0.3.11)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
Expand Down Expand Up @@ -68,8 +68,8 @@ SPEC CHECKSUMS:
app_links: 3da4c36b46cac3bf24eb897f1a6ce80bda109874
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
powersync-sqlite-core: c7045a44bb1040485ba46b42a3b0acaed424a5cd
powersync_flutter_libs: f33ed290b2813a13809ea4f0e6ae6621f3de8218
powersync-sqlite-core: 63f9e7adb74044ab7786e4f60e86994d13dcc7a9
powersync_flutter_libs: 86c1c5214cbeba9d555798de5aece225ad1f5971
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sqlite3: 4922312598b67e1825c6a6c821296dcbf6783046
sqlite3_flutter_libs: 3c323550ef3b928bc0aa9513c841e45a7d242832
Expand Down
8 changes: 4 additions & 4 deletions demos/supabase-edge-function-auth/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- powersync-sqlite-core (0.3.10)
- powersync-sqlite-core (0.3.11)
- powersync_flutter_libs (0.0.1):
- Flutter
- powersync-sqlite-core (~> 0.3.10)
- powersync-sqlite-core (~> 0.3.11)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
Expand Down Expand Up @@ -68,8 +68,8 @@ SPEC CHECKSUMS:
app_links: 3da4c36b46cac3bf24eb897f1a6ce80bda109874
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
powersync-sqlite-core: c7045a44bb1040485ba46b42a3b0acaed424a5cd
powersync_flutter_libs: f33ed290b2813a13809ea4f0e6ae6621f3de8218
powersync-sqlite-core: 63f9e7adb74044ab7786e4f60e86994d13dcc7a9
powersync_flutter_libs: 86c1c5214cbeba9d555798de5aece225ad1f5971
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sqlite3: 4922312598b67e1825c6a6c821296dcbf6783046
sqlite3_flutter_libs: 3c323550ef3b928bc0aa9513c841e45a7d242832
Expand Down
8 changes: 4 additions & 4 deletions demos/supabase-simple-chat/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- powersync-sqlite-core (0.3.10)
- powersync-sqlite-core (0.3.11)
- powersync_flutter_libs (0.0.1):
- Flutter
- powersync-sqlite-core (~> 0.3.10)
- powersync-sqlite-core (~> 0.3.11)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
Expand Down Expand Up @@ -68,8 +68,8 @@ SPEC CHECKSUMS:
app_links: 3da4c36b46cac3bf24eb897f1a6ce80bda109874
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
powersync-sqlite-core: c7045a44bb1040485ba46b42a3b0acaed424a5cd
powersync_flutter_libs: f33ed290b2813a13809ea4f0e6ae6621f3de8218
powersync-sqlite-core: 63f9e7adb74044ab7786e4f60e86994d13dcc7a9
powersync_flutter_libs: 86c1c5214cbeba9d555798de5aece225ad1f5971
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sqlite3: 4922312598b67e1825c6a6c821296dcbf6783046
sqlite3_flutter_libs: 3c323550ef3b928bc0aa9513c841e45a7d242832
Expand Down
8 changes: 4 additions & 4 deletions demos/supabase-todolist-drift/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- powersync-sqlite-core (0.3.10)
- powersync-sqlite-core (0.3.11)
- powersync_flutter_libs (0.0.1):
- Flutter
- powersync-sqlite-core (~> 0.3.10)
- powersync-sqlite-core (~> 0.3.11)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
Expand Down Expand Up @@ -74,8 +74,8 @@ SPEC CHECKSUMS:
camera_avfoundation: 04b44aeb14070126c6529e5ab82cc7c9fca107cf
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
powersync-sqlite-core: c7045a44bb1040485ba46b42a3b0acaed424a5cd
powersync_flutter_libs: f33ed290b2813a13809ea4f0e6ae6621f3de8218
powersync-sqlite-core: 63f9e7adb74044ab7786e4f60e86994d13dcc7a9
powersync_flutter_libs: 86c1c5214cbeba9d555798de5aece225ad1f5971
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sqlite3: 4922312598b67e1825c6a6c821296dcbf6783046
sqlite3_flutter_libs: 3c323550ef3b928bc0aa9513c841e45a7d242832
Expand Down
8 changes: 4 additions & 4 deletions demos/supabase-todolist-optional-sync/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- powersync-sqlite-core (0.3.10)
- powersync-sqlite-core (0.3.11)
- powersync_flutter_libs (0.0.1):
- Flutter
- powersync-sqlite-core (~> 0.3.10)
- powersync-sqlite-core (~> 0.3.11)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
Expand Down Expand Up @@ -73,8 +73,8 @@ SPEC CHECKSUMS:
camera_avfoundation: 7262a4e34c2e028f6aa5fb523ae74c9b74d3bd76
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
powersync-sqlite-core: c7045a44bb1040485ba46b42a3b0acaed424a5cd
powersync_flutter_libs: f33ed290b2813a13809ea4f0e6ae6621f3de8218
powersync-sqlite-core: 63f9e7adb74044ab7786e4f60e86994d13dcc7a9
powersync_flutter_libs: 86c1c5214cbeba9d555798de5aece225ad1f5971
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sqlite3: 0bb0e6389d824e40296f531b858a2a0b71c0d2fb
sqlite3_flutter_libs: 9379996d65aa23dcda7585a5b58766cebe0aa042
Expand Down
20 changes: 20 additions & 0 deletions demos/supabase-todolist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ Create a new PowerSync instance, connecting to the database of the Supabase proj

Then deploy the following sync rules:

```yaml
bucket_definitions:
user_lists:
priority: 1
parameters: select id as list_id from lists where owner_id = request.user_id()
data:
- select * from lists where id = bucket.list_id

user_todos:
parameters: select id as list_id from lists where owner_id = request.user_id()
data:
- select * from todos where list_id = bucket.list_id
```

**Note**: These rules showcase [prioritized sync](https://docs.powersync.com/usage/use-case-examples/prioritized-sync),
by syncing a user's lists with a higher priority than the items within a list (todos). This can be
useful to keep the list overview page reactive during a large sync cycle affecting many
rows in the `user_todos` bucket. The two buckets can also be unified into a single one if
priorities are not important (the app will work without changes):

```yaml
bucket_definitions:
user_lists:
Expand Down
8 changes: 4 additions & 4 deletions demos/supabase-todolist/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- powersync-sqlite-core (0.3.10)
- powersync-sqlite-core (0.3.11)
- powersync_flutter_libs (0.0.1):
- Flutter
- powersync-sqlite-core (~> 0.3.10)
- powersync-sqlite-core (~> 0.3.11)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
Expand Down Expand Up @@ -74,8 +74,8 @@ SPEC CHECKSUMS:
camera_avfoundation: 04b44aeb14070126c6529e5ab82cc7c9fca107cf
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
powersync-sqlite-core: c7045a44bb1040485ba46b42a3b0acaed424a5cd
powersync_flutter_libs: f33ed290b2813a13809ea4f0e6ae6621f3de8218
powersync-sqlite-core: 63f9e7adb74044ab7786e4f60e86994d13dcc7a9
powersync_flutter_libs: 86c1c5214cbeba9d555798de5aece225ad1f5971
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
sqlite3: 4922312598b67e1825c6a6c821296dcbf6783046
sqlite3_flutter_libs: 3c323550ef3b928bc0aa9513c841e45a7d242832
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down
Loading