Commit Graph
11244 Commits
Author SHA1 Message Date
Gwendal Roué f794d98e49 Merge pull request #1633 from groue/dev/GRDB7-ValueObservation-async-sequence
GRDB 7: MainActor ValueObservation scheduling
2024-09-21 13:12:08 +02:00
Gwendal Roué 1649636695 TODO 2024-09-21 12:31:38 +02:00
Gwendal Roué 58a2e04736 Mark ValueObservation starting methods as @preconcurrency
I guess the compiler will learn to stop emitting warnings eventually.

https://mjtsai.com/blog/2024/09/20/unwanted-swift-concurrency-checking/
2024-09-21 12:30:38 +02:00
Gwendal Roué bdb7d84086 [BREAKING] ValueObservation MainActor scheduling
Breaking because before iOS 13, macOS 10.15, tvOS 13, there is no longer any default scheduler
2024-09-21 12:30:38 +02:00
Gwendal Roué e1a384009a [BREAKING] Async sequences built from ValueObservation schedule values and errors on the cooperative thread pool by default. 2024-09-21 12:19:39 +02:00
Gwendal Roué dd28d9734b Fix GlobalActorIsolatedTypesUsability 2024-09-21 12:15:47 +02:00
Gwendal Roué e7a95cf0f7 Enable GlobalActorIsolatedTypesUsability 2024-09-21 10:39:44 +02:00
Gwendal Roué 7707bbd1e9 Fix Swiftlint warning 2024-09-21 10:39:36 +02:00
Gwendal Roué 2845570929 Fix DocC warnings 2024-09-15 14:27:19 +02:00
Gwendal Roué 9e9bee8d3a TODO 2024-09-15 14:01:19 +02:00
Gwendal Roué e307e9c1da Improve CaseInsensitiveIdentifier documentation 2024-09-15 12:19:19 +02:00
Gwendal Roué 157dbefdc3 TODO 2024-09-15 12:18:56 +02:00
Gwendal Roué d11f5099b4 Record is not Sendable 2024-09-15 12:18:02 +02:00
Gwendal Roué 3728628e5f Association is Sendable 2024-09-15 12:10:13 +02:00
Gwendal Roué 29f8aa38fb Fix compiler warnings in ValueObservation observers 2024-09-15 12:10:10 +02:00
Gwendal Roué d489178d04 Improve ValueObservation tests debuggability 2024-09-15 11:33:25 +02:00
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