Skip to content

Commit bce37a9

Browse files
committed
Enable Rust client by default
1 parent b027608 commit bce37a9

File tree

11 files changed

+36
-49
lines changed

11 files changed

+36
-49
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 1.8.2 (unreleased)
4+
5+
- Sync options: `newClientImplementation` is now the default.
6+
37
## 1.8.1
48

59
- Add POM name and description for `:common` project.
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
package com.powersync
22

3-
@ExperimentalPowerSyncAPI
43
@Throws(PowerSyncException::class)
54
public actual fun resolvePowerSyncLoadableExtensionPath(): String? = "libpowersync.so"
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
package com.powersync
22

3-
@ExperimentalPowerSyncAPI
43
@Throws(PowerSyncException::class)
54
public actual fun resolvePowerSyncLoadableExtensionPath(): String? = powerSyncExtensionPath

common/src/commonMain/kotlin/com/powersync/ConnectionFactory.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public open class DriverBasedInMemoryFactory<D : SQLiteDriver>(
5959
* configuring external database connections not managed by PowerSync to work with the PowerSync
6060
* SDK.
6161
*/
62-
@ExperimentalPowerSyncAPI
6362
@Throws(PowerSyncException::class)
6463
public expect fun resolvePowerSyncLoadableExtensionPath(): String?
6564

common/src/commonMain/kotlin/com/powersync/PowerSyncDatabase.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ public interface PowerSyncDatabase : Queries {
246246
* identifier, and uses internal locks to ensure these two databases are not synced at the
247247
* same time (which would be inefficient and can cause consistency issues).
248248
*/
249-
@ExperimentalPowerSyncAPI
250249
public fun opened(
251250
pool: SQLiteConnectionPool,
252251
scope: CoroutineScope,
@@ -264,7 +263,6 @@ public interface PowerSyncDatabase : Queries {
264263
*
265264
* This can be useful for writing tests relying on PowerSync databases.
266265
*/
267-
@ExperimentalPowerSyncAPI
268266
public fun openInMemory(
269267
factory: InMemoryConnectionFactory,
270268
schema: Schema,
@@ -285,7 +283,6 @@ public interface PowerSyncDatabase : Queries {
285283
)
286284
}
287285

288-
@ExperimentalPowerSyncAPI
289286
internal fun openedWithGroup(
290287
pool: SQLiteConnectionPool,
291288
scope: CoroutineScope,

common/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ internal class PowerSyncDatabaseImpl(
326326
return powerSyncVersion
327327
}
328328

329-
@ExperimentalPowerSyncAPI
330329
override suspend fun <T> useConnection(
331330
readOnly: Boolean,
332331
block: suspend (SQLiteConnectionLease) -> T,

common/src/commonMain/kotlin/com/powersync/db/Queries.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ public interface Queries {
196196
* connection with a `BEGIN` statement or forgetting to close it, can disrupt the rest of the
197197
* PowerSync SDK. For this reason, this method should only be used if absolutely necessary.
198198
*/
199-
@ExperimentalPowerSyncAPI()
200-
@HiddenFromObjC()
199+
@HiddenFromObjC
201200
public suspend fun <T> useConnection(
202201
readOnly: Boolean = false,
203202
block: suspend (SQLiteConnectionLease) -> T,

common/src/commonMain/kotlin/com/powersync/db/driver/SQLiteConnectionPool.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import kotlinx.coroutines.runBlocking
1313
* built on. The SDK provides its own pool, but can also use existing implementations (via
1414
* [com.powersync.PowerSyncDatabase.opened]).
1515
*/
16-
@ExperimentalPowerSyncAPI()
1716
public interface SQLiteConnectionPool {
1817
/**
1918
* Calls the callback with a read-only connection temporarily leased from the pool.
@@ -49,7 +48,6 @@ public interface SQLiteConnectionPool {
4948
public suspend fun close()
5049
}
5150

52-
@ExperimentalPowerSyncAPI
5351
public interface SQLiteConnectionLease {
5452
/**
5553
* Queries the autocommit state on the connection.

common/src/commonMain/kotlin/com/powersync/sync/SyncOptions.kt

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import kotlin.native.HiddenFromObjC
1111
* Configuration options for the [PowerSyncDatabase.connect] method, allowing customization of
1212
* the HTTP client used to connect to the PowerSync service.
1313
*/
14-
@OptIn(ExperimentalObjCRefinement::class)
1514
public sealed class SyncClientConfiguration {
1615
/**
1716
* Extends the default Ktor [HttpClient] configuration with the provided block.
@@ -29,48 +28,44 @@ public sealed class SyncClientConfiguration {
2928
* this method when instantiating the client. The PowerSync SDK does not modify the provided client.
3029
*/
3130
@HiddenFromObjC
32-
@ExperimentalPowerSyncAPI
3331
public class ExistingClient(
3432
public val client: HttpClient,
3533
) : SyncClientConfiguration()
3634
}
3735

3836
/**
39-
* Experimental options that can be passed to [PowerSyncDatabase.connect] to specify an experimental
40-
* connection mechanism.
41-
*
42-
* The new connection implementation is more efficient and we expect it to become the default in
43-
* the future. At the moment, the implementation is not covered by the stability guarantees we offer
44-
* for the rest of the SDK though.
37+
* Options for [PowerSyncDatabase.connect] to customize the connection mechanism.
4538
*/
46-
public class SyncOptions
47-
@ExperimentalPowerSyncAPI
48-
constructor(
49-
@property:ExperimentalPowerSyncAPI
50-
public val newClientImplementation: Boolean = false,
51-
/**
52-
* The user agent to use for requests made to the PowerSync service.
53-
*/
54-
public val userAgent: String = userAgent(),
55-
@property:ExperimentalPowerSyncAPI
56-
/**
57-
* Allows configuring the [HttpClient] used for connecting to the PowerSync service.
58-
*/
59-
public val clientConfiguration: SyncClientConfiguration? = null,
39+
public class SyncOptions(
40+
/**
41+
* Whether to use a new client implementation written in Rust.
42+
*
43+
* The new implementation is more efficient is the default. It can be disabled if there are issues with the new
44+
* implementation, but we expect to remove the old implementation in a future version of the PowerSync SDK. So if
45+
* you run into issues with the new client, please share them with us!
46+
*/
47+
public val newClientImplementation: Boolean = true,
48+
/**
49+
* The user agent to use for requests made to the PowerSync service.
50+
*/
51+
public val userAgent: String = userAgent(),
52+
/**
53+
* Allows configuring the [HttpClient] used for connecting to the PowerSync service.
54+
*/
55+
public val clientConfiguration: SyncClientConfiguration? = null,
56+
/**
57+
* Whether streams that have been defined with `auto_subscribe: true` should be synced even
58+
* when they don't have an explicit subscription.
59+
*/
60+
public val includeDefaultStreams: Boolean = true,
61+
) {
62+
public companion object {
6063
/**
61-
* Whether streams that have been defined with `auto_subscribe: true` should be synced even
62-
* when they don't have an explicit subscription.
64+
* The default sync options, which are safe and stable to use.
65+
*
66+
* Constructing non-standard sync options requires an opt-in to experimental PowerSync
67+
* APIs, and those might change in the future.
6368
*/
64-
public val includeDefaultStreams: Boolean = true,
65-
) {
66-
public companion object {
67-
/**
68-
* The default sync options, which are safe and stable to use.
69-
*
70-
* Constructing non-standard sync options requires an opt-in to experimental PowerSync
71-
* APIs, and those might change in the future.
72-
*/
73-
@OptIn(ExperimentalPowerSyncAPI::class)
74-
public val defaults: SyncOptions = SyncOptions()
75-
}
69+
public val defaults: SyncOptions = SyncOptions()
7670
}
71+
}

common/src/jvmMain/kotlin/com/powersync/ConnectionFactory.jvm.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package com.powersync
22

33
import com.powersync.db.runWrapped
44

5-
@ExperimentalPowerSyncAPI
65
@Throws(PowerSyncException::class)
76
public actual fun resolvePowerSyncLoadableExtensionPath(): String? = runWrapped { powersyncExtension }
87

0 commit comments

Comments
 (0)