Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Changelog

## 1.8.2 (unreleased)
## 1.9.0 (unreleased)

- Sync options: `newClientImplementation` is now the default.
- Make `androidx.sqlite:sqlite-bundled` an API dependency of `:core` to avoid toolchain warnings.

## 1.8.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package com.powersync

@ExperimentalPowerSyncAPI
@Throws(PowerSyncException::class)
public actual fun resolvePowerSyncLoadableExtensionPath(): String? = "libpowersync.so"
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
package com.powersync

@ExperimentalPowerSyncAPI
@Throws(PowerSyncException::class)
public actual fun resolvePowerSyncLoadableExtensionPath(): String? = powerSyncExtensionPath
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public open class DriverBasedInMemoryFactory<D : SQLiteDriver>(
* configuring external database connections not managed by PowerSync to work with the PowerSync
* SDK.
*/
@ExperimentalPowerSyncAPI
@Throws(PowerSyncException::class)
public expect fun resolvePowerSyncLoadableExtensionPath(): String?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public interface PowerSyncDatabase : Queries {
crudThrottleMs: Long = 1000L,
retryDelayMs: Long = 5000L,
params: Map<String, JsonParam?> = emptyMap(),
options: SyncOptions = SyncOptions.defaults,
options: SyncOptions = SyncOptions(),
)

/**
Expand Down Expand Up @@ -246,7 +246,6 @@ public interface PowerSyncDatabase : Queries {
* identifier, and uses internal locks to ensure these two databases are not synced at the
* same time (which would be inefficient and can cause consistency issues).
*/
@ExperimentalPowerSyncAPI
public fun opened(
pool: SQLiteConnectionPool,
scope: CoroutineScope,
Expand All @@ -264,7 +263,6 @@ public interface PowerSyncDatabase : Queries {
*
* This can be useful for writing tests relying on PowerSync databases.
*/
@ExperimentalPowerSyncAPI
public fun openInMemory(
factory: InMemoryConnectionFactory,
schema: Schema,
Expand All @@ -285,7 +283,6 @@ public interface PowerSyncDatabase : Queries {
)
}

@ExperimentalPowerSyncAPI
internal fun openedWithGroup(
pool: SQLiteConnectionPool,
scope: CoroutineScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ internal class PowerSyncDatabaseImpl(
return powerSyncVersion
}

@ExperimentalPowerSyncAPI
override suspend fun <T> useConnection(
readOnly: Boolean,
block: suspend (SQLiteConnectionLease) -> T,
Expand Down
3 changes: 1 addition & 2 deletions common/src/commonMain/kotlin/com/powersync/db/Queries.kt
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ public interface Queries {
* connection with a `BEGIN` statement or forgetting to close it, can disrupt the rest of the
* PowerSync SDK. For this reason, this method should only be used if absolutely necessary.
*/
@ExperimentalPowerSyncAPI()
@HiddenFromObjC()
@HiddenFromObjC
public suspend fun <T> useConnection(
readOnly: Boolean = false,
block: suspend (SQLiteConnectionLease) -> T,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import kotlinx.coroutines.runBlocking
* built on. The SDK provides its own pool, but can also use existing implementations (via
* [com.powersync.PowerSyncDatabase.opened]).
*/
@ExperimentalPowerSyncAPI()
public interface SQLiteConnectionPool {
/**
* Calls the callback with a read-only connection temporarily leased from the pool.
Expand Down Expand Up @@ -49,7 +48,6 @@ public interface SQLiteConnectionPool {
public suspend fun close()
}

@ExperimentalPowerSyncAPI
public interface SQLiteConnectionLease {
/**
* Queries the autocommit state on the connection.
Expand Down
65 changes: 29 additions & 36 deletions common/src/commonMain/kotlin/com/powersync/sync/SyncOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import kotlin.native.HiddenFromObjC
* Configuration options for the [PowerSyncDatabase.connect] method, allowing customization of
* the HTTP client used to connect to the PowerSync service.
*/
@OptIn(ExperimentalObjCRefinement::class)
public sealed class SyncClientConfiguration {
/**
* Extends the default Ktor [HttpClient] configuration with the provided block.
Expand All @@ -29,48 +28,42 @@ public sealed class SyncClientConfiguration {
* this method when instantiating the client. The PowerSync SDK does not modify the provided client.
*/
@HiddenFromObjC
@ExperimentalPowerSyncAPI
public class ExistingClient(
public val client: HttpClient,
) : SyncClientConfiguration()
}

/**
* Experimental options that can be passed to [PowerSyncDatabase.connect] to specify an experimental
* connection mechanism.
*
* The new connection implementation is more efficient and we expect it to become the default in
* the future. At the moment, the implementation is not covered by the stability guarantees we offer
* for the rest of the SDK though.
* Options for [PowerSyncDatabase.connect] to customize the connection mechanism.
*/
public class SyncOptions
@ExperimentalPowerSyncAPI
constructor(
@property:ExperimentalPowerSyncAPI
public val newClientImplementation: Boolean = false,
/**
* The user agent to use for requests made to the PowerSync service.
*/
public val userAgent: String = userAgent(),
@property:ExperimentalPowerSyncAPI
/**
* Allows configuring the [HttpClient] used for connecting to the PowerSync service.
*/
public val clientConfiguration: SyncClientConfiguration? = null,
public class SyncOptions(
/**
* Enables the new client implementation written in Rust.
*
* The new implementation is more efficient and enabled by default. It can be disabled if compatibility issues occur.
* The old implementation will be removed in a future version of the PowerSync SDK.
* Please report any issues experienced with the new implementation.
*/
public val newClientImplementation: Boolean = true,
/**
* The user agent to use for requests made to the PowerSync service.
*/
public val userAgent: String = userAgent(),
/**
* Allows configuring the [HttpClient] used for connecting to the PowerSync service.
*/
public val clientConfiguration: SyncClientConfiguration? = null,
/**
* Whether streams that have been defined with `auto_subscribe: true` should be synced even
* when they don't have an explicit subscription.
*/
public val includeDefaultStreams: Boolean = true,
) {
public companion object {
/**
* Whether streams that have been defined with `auto_subscribe: true` should be synced even
* when they don't have an explicit subscription.
* The default sync options, which are safe and stable to use.
*/
public val includeDefaultStreams: Boolean = true,
) {
public companion object {
/**
* The default sync options, which are safe and stable to use.
*
* Constructing non-standard sync options requires an opt-in to experimental PowerSync
* APIs, and those might change in the future.
*/
@OptIn(ExperimentalPowerSyncAPI::class)
public val defaults: SyncOptions = SyncOptions()
}
@Deprecated("Customizing sync options is no longer necessary, use constructor instead", replaceWith = ReplaceWith("SyncOptions()"))
public val defaults: SyncOptions = SyncOptions()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.powersync

import com.powersync.db.runWrapped

@ExperimentalPowerSyncAPI
@Throws(PowerSyncException::class)
public actual fun resolvePowerSyncLoadableExtensionPath(): String? = runWrapped { powersyncExtension }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ private val didLoadExtension by lazy {
true
}

@ExperimentalPowerSyncAPI
@Throws(PowerSyncException::class)
public actual fun resolvePowerSyncLoadableExtensionPath(): String? {
didLoadExtension
Expand Down