-
Notifications
You must be signed in to change notification settings - Fork 22
Protocol changes for sync streams #307
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
Open
simolus3
wants to merge
21
commits into
main
Choose a base branch
from
sync-streams
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🦋 Changeset detectedLatest commit: c77b754 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
81d2ddd
to
92391ab
Compare
rkistner
reviewed
Aug 4, 2025
15dae34
to
0f5aa52
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the first of two PRs to implement the new sync stream functionality in the PowerSync service. The PRs are split like this:
sync-rules
so thatSqlBucketDescriptor
(representing parameter and data queries) isn't the only way to declare buckets. It also adds protocol-level changes required for subscription managements.Overview
Most of this PR is related to protocol changes enabling the second feature. While most of the subscription management happens on the client, they need some help from the sync service. In particular, clients need to know why they're receiving a bucket: We want clients to be able to track progress (and also provide the usual
hasSynced
/lastSyncedAt
fields) for individual stream subscriptions. Since progress is ultimately attached to buckets, clients need enough information to associate buckets with stream subscriptions.Sync-rule changes
In the
sync-rules
package, this PR extracts most methods ofSqlBucketDescriptor
into the newBucketSource
interface. The interface matches most methods, and adds a few new ones (e.g. to obtain a debug representation) to encapsulate functionality that used to access members inSqlBucketDescriptor
directly.When resolving queriers for a request, we add additional information (previously, we'd only pass request and token parameters):
This information is ignored by
SqlBucketDescriptor
, but sync stream definitions will use it to find the right buckets and to recognize parameters.The information returned by queriers has also been expanded: In addition to bucket names and priorities, we add:
Service changes
Most of the service changes are related to just passing the new information to
sync-rules
: This adds optional fields to a sync request that allow clients to specify subscribed streams.Other changes in
BucketChecksumState.ts
are responsible for:SELECT * FROM assets WHERE id IN (request.args() -> 'asset_ids')
and a client subscribing once with{'asset_id': [1]}
and another time with{'asset_id': [1, 2]}
. Here, both subscriptions yield the bucketassets[id=1]
. We obviously don't want the bucket to be included in the checkpoint multiple times, but clients need to know that progress on bucketassets[id=1]
contributes to both stream subscriptions.