mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
StrictConcurrency: DatabaseRegionConvertible is Sendable
A ValueObservation will use such an object from database readers, writers, and the main thread: they must support all isolation domains.
This commit is contained in:
1 parent
8f486a5e41
commit
b4677dede4
2 files changed
+9
-5
No files matched your search
@@ -416,7 +416,7 @@ private struct TableRegion: Equatable {
|
|||||||
/// ### Supporting Types
|
/// ### Supporting Types
|
||||||
///
|
///
|
||||||
/// - ``AnyDatabaseRegionConvertible``
|
/// - ``AnyDatabaseRegionConvertible``
|
||||||
public protocol DatabaseRegionConvertible {
|
public protocol DatabaseRegionConvertible: Sendable {
|
||||||
/// Returns a database region.
|
/// Returns a database region.
|
||||||
///
|
///
|
||||||
/// - parameter db: A database connection.
|
/// - parameter db: A database connection.
|
||||||
@@ -437,14 +437,15 @@ extension DatabaseRegion: DatabaseRegionConvertible {
|
|||||||
|
|
||||||
/// A type-erased DatabaseRegionConvertible
|
/// A type-erased DatabaseRegionConvertible
|
||||||
public struct AnyDatabaseRegionConvertible: DatabaseRegionConvertible {
|
public struct AnyDatabaseRegionConvertible: DatabaseRegionConvertible {
|
||||||
let _region: (Database) throws -> DatabaseRegion
|
let _region: @Sendable (Database) throws -> DatabaseRegion
|
||||||
|
|
||||||
public init(_ region: @escaping (Database) throws -> DatabaseRegion) {
|
public init(_ region: @escaping @Sendable (Database) throws -> DatabaseRegion) {
|
||||||
_region = region
|
_region = region
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(_ region: some DatabaseRegionConvertible) {
|
public init(_ region: some DatabaseRegionConvertible) {
|
||||||
_region = region.databaseRegion
|
// TODO: simplify when <https://github.com/apple/swift/issues/71541> is resolved.
|
||||||
|
_region = { try region.databaseRegion($0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
public func databaseRegion(_ db: Database) throws -> DatabaseRegion {
|
public func databaseRegion(_ db: Database) throws -> DatabaseRegion {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
- [X] OnDemandFuture Sendable async closure
|
- [X] OnDemandFuture Sendable async closure
|
||||||
- [X] WALSnapshotTransaction refactor
|
- [X] WALSnapshotTransaction refactor
|
||||||
- [X] anydatabasecancellable
|
- [X] anydatabasecancellable
|
||||||
- [ ] anydatabaseregionconvertible
|
- [X] anydatabaseregionconvertible
|
||||||
- [ ] anyfetchrequest
|
- [ ] anyfetchrequest
|
||||||
- [ ] anysqljsonexpressible
|
- [ ] anysqljsonexpressible
|
||||||
- [ ] association
|
- [ ] association
|
||||||
@@ -176,6 +176,9 @@
|
|||||||
- [X] transactionclock
|
- [X] transactionclock
|
||||||
- [ ] valueobservation
|
- [ ] valueobservation
|
||||||
- [X] valueobservationscheduler
|
- [X] valueobservationscheduler
|
||||||
|
- [ ] ValueWriteOnlyObserver (needed so that it can conform to DatabaseCancellable)
|
||||||
|
- [ ] ValueObservationTrackingMode
|
||||||
|
- [X] DatabaseRegionConvertible
|
||||||
|
|
||||||
|
|
||||||
## Unsure if necessary
|
## Unsure if necessary
|
||||||
|
|||||||
Reference in new issue
Block a user