Skip to content

Add sync implementation from core extension #192

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
wants to merge 25 commits into
base: main
Choose a base branch
from
Open

Conversation

simolus3
Copy link
Contributor

@simolus3 simolus3 commented May 8, 2025

This integrates the new sync logic implemented in the core extension (at powersync-ja/powersync-sqlite-core#70) into the Kotlin SDK.

Internally, the existing implementation has been renamed to "legacy implementation" (and I've annotated methods related to it with @LegacySyncImplementation which should make it easier to identify which methods we can eventually remove after we finish the migration).
For now however, the new implementation is marked as experimental, and not enabled by default. Users will have to use Kotlin's opt-in mechanism for ExperimentalPowerSyncAPI to use it. So, the only API changes are:

  • Adding the SyncOptions class. Constructing a non-default instance of this class requires opting in to ExperimentalPowerSyncAPI.
    • On that class, a newClientImplementation field can be set to true to use the new Rust client.
    • Similarly, method can be set to ConnectionMethod.Http or to ConnectionMethod.WebSocket.

In the sync stream, I've moved the existing methods into an inner LegacyIteration class, the new ActiveIteration class implements the sync logic by forwarding it to the PowerSync control interface in the core extension. I've tested the new sync logic with websockets manually (although it might be worth setting up an internal RSocket server for that in the future). All sync tests are now running against both client implementations.

@simolus3 simolus3 marked this pull request as ready for review June 19, 2025 07:48
@simolus3 simolus3 requested a review from stevensJourney June 19, 2025 07:49
@simolus3 simolus3 changed the title WIP: Add sync implementation from core extension Add sync implementation from core extension Jun 19, 2025
@simolus3 simolus3 force-pushed the rust-sync-client branch 2 times, most recently from 2fad7ca to e3ebef1 Compare June 19, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants