Gwendal Roué
215128390d
Fix race condition: prevent cancellation from cancelling other database accesses after database accesses has completed
...
Before this change, cancelling a database access could cancel *another* database access 😱
2025-07-23 12:01:58 +02:00
Gwendal Roué
7a1e65b142
Remove late cancellation checks
...
I'm slowly changing my mind about this.
2025-07-19 15:27:08 +02:00
Gwendal Roué
fb4578a7d6
Delete unused code
2025-07-19 15:26:46 +02:00
Gwendal Roué
e6847886db
Extract DispatchQueueActor
...
We'll probably need it in order to access pool elements with support for task locals
2025-07-19 14:25:50 +02:00
Gwendal Roué
c064515247
DatabaseQueue and DatabaseSnapshot reads can access task locals
2025-07-19 14:25:50 +02:00
Gwendal Roué
46e15616a7
[BREAKING] macOS 10.15+
2024-09-21 14:28:24 +02:00
Gwendal Roué
e4a4735494
[BREAKING] tvOS 13+
2024-09-21 13:57:35 +02:00
Gwendal Roué
8c40592955
[BREAKING] iOS 13+
2024-09-21 13:57:23 +02:00
Gwendal Roué
9501d1f936
Fix compiler warnings about SchedulingWatchdog concurrency
2024-09-14 17:24:00 +02:00
Gwendal Roué
2f240fd764
[SENDING REGRET] Async database access methods return Sendable results
...
We can not tell the compiler that we can safely return `sending` results, because fetched values are in the same region as the `db` argument, according to SE-0414 (https://github.com/swiftlang/swift-evolution/blob/main/proposals/0414-region-based-isolation.md#rules-for-merging-isolation-regions ).
```
class NotSendable { init() { } }
func fetchNotSendable(_ db: Database) -> NotSendable { fatalError() }
func notOK<T>(_ make: (Database) -> sending T) { }
func ok<T>(_ make: () -> sending T) { }
func usage() {
ok { NotSendable() }
// Returning a task-isolated 'NotSendable' value as a 'sending' result
// risks causing data races.
notOK { db in fetchNotSendable(db) }
}
```
Various attempts at modifying all fetching methods so that they have a `sending` return value have failed.
2024-09-08 16:55:25 +02:00
Gwendal Roué
c122872734
[SENDING REGRET] SerializedDatabase.async requires a Sendable closure
...
We should be able to use a sending closure instead, but DispatchQueue.async does not accept sending closures yet.
2024-09-08 16:09:31 +02:00
Gwendal Roué
a7a9c75185
Place @escaping before @Sendable
2024-09-08 13:41:13 +02:00
Gwendal Roué
5b4b8a9065
Async database accesses check for cancellation before returning
2024-09-01 15:35:37 +02:00
Gwendal Roué
fa54b74eba
[BREAKING] DatabaseWriter async methods support Task cancellation
2024-09-01 15:35:37 +02:00
Gwendal Roué
40140afb8c
SerializedDatabase support for async db access with support for Task cancellation
2024-09-01 15:24:39 +02:00
Gwendal Roué and Rogerio de Paula Assis
600d1b84b6
Update GRDB/Core/SerializedDatabase.swift
...
Co-authored-by: Rogerio de Paula Assis <rog@anz.com >
2023-03-20 07:02:00 +01:00
Gwendal Roué
5629cfe6ff
Fix documentation
2023-03-19 13:56:56 +01:00
Gwendal Roué
5d9b9edfe1
Fix asyncWALSnapshotTransaction usage.
...
We must use its result asynchronously.
2023-03-19 12:39:48 +01:00
Gwendal Roué
0a544dc0d2
Cleanup relationships between SerializedDatabase, WALSnapshotTransaction, and DatabasePool
...
SerializedDatabase hides its allowsUnsafeTransactions property, and makes it thread-safe by protecting it inside its serialized dispatch queue.
WALSnapshotTransaction always notifies when the reader connection is no longer used, and reuses the "isInsideTransaction" wording.
2023-03-17 13:52:29 +01:00
Gwendal Roué
e66dfacab8
WALSnapshotTransaction
2023-03-17 13:52:29 +01:00
Gwendal Roué
0d4c6e592e
SerializedDatabase.allowsUnsafeTransactions
2023-03-17 13:52:29 +01:00
Gwendal Roué
cbac0e7286
Enhance Configuration.threadingMode documentation
2022-11-13 10:54:40 +01:00
Gwendal Roué
6da7d47394
Swift 5.7 required: Remove compiler checks
2022-08-21 19:21:57 +02:00
Gwendal Roué
209192d3a5
Require Swift 5.6 Compiler for Concurrency Support
2022-04-13 23:07:33 +02:00
Gwendal Roué
6ab3fea8fb
Refactor ValueObservation
2022-03-17 18:44:30 +01:00
Gwendal Roué
ed4471c5b9
Configuration.writeTargetQueue
2022-01-29 17:45:21 +01:00
Gwendal Roué
1b62e06c4a
Expose Sendable conformance to Swift 5.5
...
But async apis are still only exposed to Swift 5.5.2.
Sendable conformances are helpful for users of Xcode < 13.2.
2021-12-10 08:08:47 +01:00
Gwendal Roué
01f4c04c4d
DatabaseReader is Sendable
2021-12-08 18:12:28 +01:00
Gwendal Roué
20cb50f52d
Public close() method
2021-10-31 18:12:13 +01:00
Gwendal Roué
b13922b76e
Database schema cache distinguishes the main from the temp schema
...
Addresses https://github.com/groue/GRDB.swift/pull/946#issuecomment-805756799
2021-03-27 14:50:25 +01:00
Gwendal Roué
836efb120f
Xcode 12.3 formatting
2020-12-23 12:13:05 +01:00
Gwendal Roué
2a7f41c494
Database.close() is idempotent
...
This change addresses https://bugs.swift.org/browse/SR-13746
2020-10-25 10:12:42 +01:00
Gwendal Roué
886f75bbea
Configuration.prepareDatabase in now a method
2020-09-06 13:15:51 +02:00
Gwendal Roué
780ba744f1
Database.description
2020-06-03 19:37:24 +02:00
Gwendal Roué
5d196c449d
Value Observation does no longer retain DatabaseWriter
2020-03-28 17:11:57 +01:00
Gwendal Roué
9aa67f9db9
SE-0255: Implicit returns from single-expression functions
2020-03-08 23:12:46 +01:00
Gwendal Roué
4bf5724543
Can't issue ROLLBACK on suspension
...
This is because this would allow a database modification to run in an aborted transaction
2019-12-13 08:14:49 +01:00
Gwendal Roué
6656f72782
Rename "lock prevention" to "suspension"
2019-12-12 08:47:49 +01:00
Gwendal Roué
16025356bf
Adapt lock prevention to the journal mode
2019-12-02 20:27:39 +01:00
Gwendal Roué
b54a8f7fe8
DatabaseWriter.startPreventingExclusiveLock()
2019-12-01 17:59:49 +01:00
Gwendal Roué
0a83848cfc
DatabaseReader.interrupt()
2019-11-30 15:35:11 +01:00
Gwendal Roué
df6bb8761c
Swiftlint + whitespace
2019-07-01 08:57:53 +02:00
Michael Kirk
99065a4faf
prepareDB block
2019-04-02 10:47:31 -06:00
Gwendal Roué
3029949731
Add () to forward @autoclosure parameters
2019-02-08 05:30:57 +01:00
Gwendal Roué
f07eee3ca7
DispatchQueue creation cleanup
2018-12-01 16:22:05 +01:00
Gwendal Roué
736db6a546
Confiiguration.qos and targetQueue
2018-11-24 20:48:17 +01:00
Gwendal Roué
2e80db8aed
Database dispatch queues now have labels
2018-06-14 13:36:42 +02:00
Gwendal Roué
8b44b0af7b
Fix SerializedDatabase.reentrantSync check for unsafe transactions
2018-06-04 11:59:43 +02:00
Gwendal Roué
7dc008db8b
Expose Database.beginTransaction(), commit(), rollback(). New Configuration.allowsUnsafeTransactions flag. New fatal error when a database access block ends with a transaction left opened.
2018-02-23 14:14:05 +01:00
Gwendal Roué
a1e508b1df
TransactionObserver.ignoreDatabaseChangesUntilNextTransaction()
2018-01-14 16:45:36 +01:00