Skip to content

Commit acf6b70

Browse files
committed
Enable Rust sync client by default
1 parent aaf6037 commit acf6b70

3 files changed

Lines changed: 24 additions & 14 deletions

File tree

.changeset/neat-papayas-refuse.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@powersync/common': minor
3+
'@powersync/node': minor
4+
'@powersync/react-native': minor
5+
'@powersync/web': minor
6+
---
7+
8+
The [Rust sync client](https://www.powersync.com/blog/speeding-up-powersync-with-a-sqlite-extension-written-in-rust) is now enabled by default.
9+
To keep using the JavaScript client implementation, pass `clientImplementation: SyncClientImplementation.JAVASCRIPT` in `options` when calling
10+
`PowerSync.connect`.
11+
12+
Note that the JavaScript client will be removed in a future version of the SDK. If you choose to it due to issues with the Rust client, please
13+
file an issue or reach out to us.

packages/common/src/client/sync/stream/AbstractStreamingSyncImplementation.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,17 @@ export enum SyncClientImplementation {
4747
*
4848
* This is the default option.
4949
*
50-
* @deprecated Don't use {@link SyncClientImplementation.JAVASCRIPT} directly. Instead, use
51-
* {@link DEFAULT_SYNC_CLIENT_IMPLEMENTATION} or omit the option. The explicit choice to use
52-
* the JavaScript-based sync implementation will be removed from a future version of the SDK.
50+
* @deprecated We recommend the {@link RUST} client implementation for all apps. If you have issues with
51+
* the Rust client, please file an issue or reach out to us. The JavaScript client will be removed in a future
52+
* version of the PowerSync SDK.
5353
*/
5454
JAVASCRIPT = 'js',
5555
/**
5656
* This implementation offloads the sync line decoding and handling into the PowerSync
5757
* core extension.
5858
*
59-
* @experimental
60-
* While this implementation is more performant than {@link SyncClientImplementation.JAVASCRIPT},
61-
* it has seen less real-world testing and is marked as __experimental__ at the moment.
59+
* This option is more performant than the {@link JAVASCRIPT} client, enabled by default and the
60+
* recommended client implementation for all apps.
6261
*
6362
* ## Compatibility warning
6463
*
@@ -77,13 +76,9 @@ export enum SyncClientImplementation {
7776
}
7877

7978
/**
80-
* The default {@link SyncClientImplementation} to use.
81-
*
82-
* Please use this field instead of {@link SyncClientImplementation.JAVASCRIPT} directly. A future version
83-
* of the PowerSync SDK will enable {@link SyncClientImplementation.RUST} by default and remove the JavaScript
84-
* option.
79+
* The default {@link SyncClientImplementation} to use, {@link SyncClientImplementation.RUST}.
8580
*/
86-
export const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.JAVASCRIPT;
81+
export const DEFAULT_SYNC_CLIENT_IMPLEMENTATION = SyncClientImplementation.RUST;
8782

8883
/**
8984
* Abstract Lock to be implemented by various JS environments
@@ -692,6 +687,9 @@ The next upload iteration will be delayed.`);
692687
if (rawTables != null && rawTables.length) {
693688
this.logger.warn('Raw tables require the Rust-based sync client. The JS client will ignore them.');
694689
}
690+
if (this.activeStreams.length) {
691+
this.logger.error('Sync streams require `clientImplementation: SyncClientImplementation.RUST` when connecting.');
692+
}
695693

696694
this.logger.debug('Streaming sync iteration started');
697695
this.options.adapter.startSession();

packages/node/tests/sync-stream.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { describe, vi, expect, onTestFinished } from 'vitest';
2-
import { PowerSyncConnectionOptions, SyncClientImplementation, SyncStreamConnectionMethod } from '@powersync/common';
2+
import { PowerSyncConnectionOptions, SyncStreamConnectionMethod } from '@powersync/common';
33
import Logger from 'js-logger';
44
import { bucket, checkpoint, mockSyncServiceTest, nextStatus, stream, TestConnector } from './utils';
55

66
Logger.useDefaults({ defaultLevel: Logger.WARN });
77

88
describe('Sync streams', () => {
99
const defaultOptions = {
10-
clientImplementation: SyncClientImplementation.RUST,
1110
connectionMethod: SyncStreamConnectionMethod.HTTP
1211
} satisfies PowerSyncConnectionOptions;
1312

0 commit comments

Comments
 (0)