Commit Graph
11428 Commits
Author SHA1 Message Date
Gwendal Roué 473b06eac5 Fix compiler warnings about SQLQualifiedRelation 2024-09-15 11:32:06 +02:00
Gwendal Roué e68a2075fa Fix compiler warnings when building the request for an association 2024-09-15 11:25:23 +02:00
Gwendal Roué 630daaf48a Fix compiler warnings about StatementArgumentsSink for literal arguments 2024-09-15 11:17:01 +02:00
Gwendal Roué 461db6c4ac Feed database promises with Sendable values 2024-09-15 11:12:39 +02:00
Gwendal Roué d3e62dc5c9 Fix compiler warnings about default Inflections 2024-09-14 17:24:47 +02:00
Gwendal Roué 01308c6044 Fix compiler warnings about NSCache concurrency 2024-09-14 17:24:30 +02:00
Gwendal Roué b079136cd5 Fix compiler warnings about ISO8601DateFormatter concurrency 2024-09-14 17:24:16 +02:00
Gwendal Roué 9501d1f936 Fix compiler warnings about SchedulingWatchdog concurrency 2024-09-14 17:24:00 +02:00
Gwendal Roué c2219075cf TODO 2024-09-14 13:49:30 +02:00
Gwendal Roué 4f1587a307 Merge pull request #1618 from groue/dev/GRDB7-Sendable-database-access
GRDB 7: Sendable database accesses
2024-09-14 13:47:53 +02:00
Gwendal Roué 945f398c92 Fix Sendable warnings in tests 2024-09-08 18:00:37 +02:00
Gwendal Roué 4b5ec4f6ca Enable InferSendableFromCaptures upcoming feature 2024-09-08 17:48:50 +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é ec5b7d96e2 SharedValueObservation is Sendable 2024-09-08 16:17:51 +02:00
Gwendal Roué 5f384a4b22 ValueObservation is Sendable 2024-09-08 16:17:51 +02:00
Gwendal Roué 28faa97a37 Database.afterNextTransaction callbacks are Sendable 2024-09-08 16:17:45 +02:00
Gwendal Roué 5585e47c33 Database publishers require Sendable closures 2024-09-08 16:17:17 +02:00
Gwendal Roué 62d96ec544 [SENDING REGRET] Async database accesses require Sendable closures
We should be able to use sending closures instead, but DispatchQueue.async does not accept sending closures yet.
2024-09-08 16:16:40 +02:00
Gwendal Roué e35fb79308 DatabaseRegionObservation callbacks are Sendable 2024-09-08 16:12:33 +02:00
Gwendal Roué b3ac63b0cd [SENDING REGRET] DatabaseMigrator.asyncMigrate 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:40 +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é 6371dc05d5 OnDemandFuture closure is Sendable
It can be called at any time, when the publisher is subscribed.
2024-09-08 16:09:19 +02:00
Gwendal Roué 55560ccd90 [SENDING REGRET] Pool async methods require Sendable closures
We should be able to use sending closures instead, but DispatchQueue.async does not accept sending closures yet.
2024-09-08 16:09:19 +02:00
Gwendal Roué 0b6ac870e2 [SENDING REGRET] ValueObservationScheduler requires Sendable closures
We should be able to use sending closures instead, but DispatchQueue.async does not accept sending closures yet.
2024-09-08 16:09:10 +02:00
Gwendal Roué a7a9c75185 Place @escaping before @Sendable 2024-09-08 13:41:13 +02:00
Gwendal Roué 7084c95cbd TODO 2024-09-08 13:39:38 +02:00
Gwendal Roué ea4d208037 Rename ReadWriteBox to ReadWriteLock 2024-09-08 13:33:07 +02:00
Gwendal Roué 8409768676 TODO 2024-09-08 13:15:06 +02:00
Gwendal Roué 24576c944e Merge pull request #1617 from groue/dev/GRDB7-collection-over-sequence
GRDB 7: Prefer Collection over Sequence for `filter(keys:)` and related APIs
2024-09-08 13:11:42 +02:00
Gwendal Roué 6a29d6c081 [BREAKING] Prefer Collection over Sequence for filter(keys:) and derived APIs
We were frequently turning those sequences into an Array in order to check their emptiness, and generally were not sure we'd iterate a sequence only once.

Also use `some Sequence` and `some Collection` whenever possible.
2024-09-08 12:52:27 +02:00
Gwendal Roué 110d9312db Exclude products folder from GRDBTests target
Otherwise, we eventually have an error "multiple resources named 'PrivacyInfo.xcprivacy' in target 'GRDBTests'"
2024-09-08 11:41:05 +02:00
Gwendal Roué 0e6ffeb2d5 Merge branch 'master' into GRDB7 2024-09-08 11:37:48 +02:00
Gwendal Roué 2cf6c756e1 Merge branch 'development' v6.29.3 2024-09-07 14:20:48 +02:00
Gwendal Roué d56223cba1 v6.29.3 2024-09-07 12:59:25 +02:00
Gwendal Roué bc4fd8ff58 Merge pull request #1613 from groue/dev/fix-1612
Avoid SQLite misuse when releasing memory on a closed database connection
2024-09-07 12:56:16 +02:00
Gwendal Roué 9357198e1b TODO 2024-09-05 18:42:11 +02:00
Gwendal Roué cdb181d9ca Don't invoke sqlite3_db_release_memory on closed database connections 2024-09-04 09:21:30 +02:00
Gwendal Roué a02601ceae Merge pull request #1610 from groue/dev/GRDB7-cancellable-database-access
GRDB 7: Async database accesses honor Task cancellation
2024-09-01 16:30:04 +02:00
Gwendal Roué 71f5554962 Test cancellation handling from AnyDatabaseReader and AnyDatabaseWriter 2024-09-01 15:35:37 +02:00
Gwendal Roué 5b4b8a9065 Async database accesses check for cancellation before returning 2024-09-01 15:35:37 +02:00
Gwendal Roué cb1bd83777 Document that async methods can throw CancellationError 2024-09-01 15:35:37 +02:00
Gwendal Roué d6b91eec85 [BREAKING] DatabaseReader async methods support Task cancellation 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é 5ecf9f67fb Vendor AsyncSemaphore
Semaphores allow tests to precisely schedule ordering of async jobs
2024-09-01 15:24:39 +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é b85121d456 Database support for cancellation 2024-08-31 12:24:19 +02:00
Gwendal Roué e9d0d381f6 Fix concurrency warning with DispatchQueue.mainKey 2024-08-31 10:48:51 +02:00
Gwendal Roué bdccd110a7 Merge pull request #1607 from groue/dev/GRDB7-Sendable
GRDB 7: Add missing Sendable conformances
2024-08-31 10:45:19 +02:00
Gwendal Roué b1424d16d5 [BREAKING] PersistenceContainer is Sendable 2024-08-31 10:08:44 +02:00
Gwendal Roué c08b1fa7d5 ValueObservationScheduler is Sendable 2024-08-31 09:58:15 +02:00