SQLiteConnectionPool

An implementation of a connection pool providing asynchronous access to a single writer and multiple readers.

This is the underlying pool implementation on which the higher-level PowerSync Kotlin SDK is built on. The SDK provides its own pool, but can also use existing implementations (via com.powersync.PowerSyncDatabase.opened).

Properties

Link copied to clipboard
abstract val updates: SharedFlow<Set<String>>

Returns a flow of table updates made on the write connection.

Functions

Link copied to clipboard
abstract suspend fun close()

Closes the connection pool and associated resources.

Link copied to clipboard
abstract suspend fun <T> read(callback: suspend (SQLiteConnectionLease) -> T): T

Calls the callback with a read-only connection temporarily leased from the pool.

Link copied to clipboard
abstract suspend fun <R> withAllConnections(action: suspend (writer: SQLiteConnectionLease, readers: List<SQLiteConnectionLease>) -> R)

Invokes the callback with all connections leased from the pool.

Link copied to clipboard
abstract suspend fun <T> write(callback: suspend (SQLiteConnectionLease) -> T): T

Calls the callback with a read-write connection temporarily leased from the pool.