Skip to content

Commit

Permalink
Merge pull request #243 from powersync-ja/feat/bucket-priorities
Browse files Browse the repository at this point in the history
Support bucket priorities and partial checkpoints
  • Loading branch information
simolus3 authored Feb 27, 2025
2 parents ba18a9f + 12c4124 commit 1d60e98
Show file tree
Hide file tree
Showing 36 changed files with 715 additions and 310 deletions.
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

0 comments on commit 1d60e98

Please sign in to comment.