Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRDB 7: Sendable database accesses #1618

Merged
merged 14 commits into from
Sep 14, 2024
Merged

Commits on Sep 8, 2024

  1. [SENDING REGRET] ValueObservationScheduler requires Sendable closures

    We should be able to use sending closures instead, but DispatchQueue.async does not accept sending closures yet.
    groue committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    0b6ac87 View commit details
    Browse the repository at this point in the history
  2. [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.
    groue committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    55560cc View commit details
    Browse the repository at this point in the history
  3. OnDemandFuture closure is Sendable

    It can be called at any time, when the publisher is subscribed.
    groue committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    6371dc0 View commit details
    Browse the repository at this point in the history
  4. [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.
    groue committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    c122872 View commit details
    Browse the repository at this point in the history
  5. [SENDING REGRET] DatabaseMigrator.asyncMigrate requires a Sendable cl…

    …osure
    
    We should be able to use a sending closure instead, but DispatchQueue.async does not accept sending closures yet.
    groue committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    b3ac63b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e35fb79 View commit details
    Browse the repository at this point in the history
  7. [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.
    groue committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    62d96ec View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    5585e47 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    28faa97 View commit details
    Browse the repository at this point in the history
  10. ValueObservation is Sendable

    groue committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    5f384a4 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    ec5b7d9 View commit details
    Browse the repository at this point in the history
  12. [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.
    groue committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    2f240fd View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    4b5ec4f View commit details
    Browse the repository at this point in the history
  14. Fix Sendable warnings in tests

    groue committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    945f398 View commit details
    Browse the repository at this point in the history