Commit Graph
172 Commits
Author SHA1 Message Date
Gwendal Roué 33a039717c Refer to UIApplication notifications by their names
It looks like FB9801372 was fixed
2022-08-21 21:22:34 +02:00
Gwendal Roué a9fcf1b9c1 SE-0335, SE-0341, SE-0346, SE-0352, SE-0358: some, any, primary associated types 2022-08-21 21:22:34 +02:00
Gwendal Roué 458e1e2675 BREAKING: throwing DatabaseQueue() initializer
As a consequence, FTS3.tokenize(_:) is a throwing method as well.
2022-08-21 21:22:33 +02:00
Gwendal Roué 6f0d45eedb BREAKING: throwing DatabaseWriter.barrierWriteWithoutTransaction
It used to be rethrowing, but it was then unable to deal with closed databases.

The async version is modified accordingly: it accepts a Result<Database, Error>, instead of a raw Database.

DatabaseMigrator.asyncMigrate is impacted as well: it accepts a Result<Database, Error>, instead of a (Database, Error?) tuple.
2022-08-21 19:21:57 +02:00
Gwendal Roué 0bfb4de02d Enhance DatabaseQueue automatic memory management
We have async methods, now: no need to use a global dispatch queue.
2022-07-09 13:39:11 +02:00
George Nachman bbe94a9607 Make memory management optional.
Memory management may not be desirable for all
users of GRDB. `DatabasePool.releaseMemory`
creates a barrier which may cause normally fast
readers to block for a long time. If this is not a
desirable tradeoff, the new
`automaticMemoryManagement` flag in
`Configuration` allows you to disable this feature
of GRDB.
2022-07-05 15:27:55 -07:00
Gwendal Roué 6ab3fea8fb Refactor ValueObservation 2022-03-17 18:44:30 +01:00
Gwendal Roué 287ceb8b07 Documentation & cleanup 2022-03-17 18:44:30 +01:00
Gwendal Roué 01f4c04c4d DatabaseReader is Sendable 2021-12-08 18:12:28 +01:00
Gwendal Roué 33d9ca0e97 UIApplication notification names are isolated to @MainActor
I believe this is incorrect: FB9801372 (UIApplication.didReceiveMemoryWarningNotification should not be declared @MainActor)

Meanwhile, just use the string version.

A workaround based on a MainActor-isolated task can't work due to conflict between compiler version and minimum iOS target:

    #if compiler(>=5.5) && canImport(_Concurrency)
    if #available(...) { // Check for availability of concurrency runtime
        Task { @MainActor [weak self] in
            NotificationCenter.default.addObserver(..., name: UIApplication.didReceiveMemoryWarningNotification, object: nil)
        }
    } else {
        // IMPOSSIBLE CASE: No access to Task, no access to notification names
    }
    #else
    NotificationCenter.default.addObserver(..., name: UIApplication.didReceiveMemoryWarningNotification, object: nil)
    #endif
2021-12-08 12:48:19 +01:00
Gwendal Roué 6ec3ebc398 Merge branch 'development' into dev/async 2021-12-06 18:04:35 +01:00
Gwendal Roué bb2ce74125 Add helper method Database.isolated(readOnly:) 2021-12-02 09:45:28 +01:00
Gwendal Roué 1a87faacfa Merge branch 'development' into dev/async 2021-10-31 18:32:03 +01:00
Gwendal Roué 20cb50f52d Public close() method 2021-10-31 18:12:13 +01:00
Gwendal Roué 1f73c20ae2 DatabaseWriter async methods
write, writeWithoutTransaction, barrierWriteWithoutTransaction, erase, vacuum, vacuum(into:)
2021-10-17 13:24:10 +02:00
Gwendal Roué a827188881 async DatabaseReader.unsafeRead 2021-10-17 13:23:34 +02:00
Gwendal Roué ba88a150c0 Improve inline doc of database access methods 2021-10-11 15:50:06 +02:00
Zev Eisenberg 8b060e6b09 Add angle brackets to URLs to make them clickable in Xcode's rendered documentation. 2021-07-20 20:53:58 -04: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é c9c652dddc DatabaseMigrator async migrations 2021-03-20 13:25:43 +01:00
Gwendal Roué aceaaf24d2 Paranoid: Wrap DatabaseQueue.read in a transaction
This guarantees snapshot isolation even in case of external connections
2021-02-20 12:59:27 +01:00
Gwendal Roué a681ccf2b9 Fix: DatabaseQueue.read is throws, not rethrows 2021-02-20 11:55:19 +01:00
Gwendal Roué 836efb120f Xcode 12.3 formatting 2020-12-23 12:13:05 +01:00
Gwendal Roué 3c38aa1996 Functions, Collations, and tokenizers are no longer available on DatabaseQueue, Pool, and Snapshot 2020-09-06 13:18:58 +02:00
Gwendal Roué 07092169bf Documentation 2020-07-12 14:17:58 +02:00
Gwendal Roué 5c4b282e27 Refactor ValueObservation events handling 2020-06-21 09:17:12 +02:00
Gwendal Roué dd76cdffec ValueObservation.handleEvents 2020-06-20 19:57:51 +02:00
Alexandre Colucci f97e0cc540 Fix inline documentation for the setupMemoryManagement() function. In GRDB 5.0.0 and later, the parameter 'application' has been removed. 2020-06-20 12:09:59 +02:00
Gwendal Roué 9ee3fd38b5 Remove mentions of unsupported iOS versions 2020-05-31 13:54:02 +02:00
Gwendal Roué d72000c6a3 Use scheduling paramater name for consistency with GRDBCombine and RxGRDB 2020-03-31 20:25:36 +02:00
Gwendal Roué 1bffc4f628 ValueObservation is cancellable 2020-03-29 16:06:24 +02:00
Gwendal Roué 5d196c449d Value Observation does no longer retain DatabaseWriter 2020-03-28 17:11:57 +01:00
Gwendal Roué 23d428290b Assume that error ends the observation, and have database pool always perform a concurrent initial fetch 2020-03-28 10:30:36 +01:00
Gwendal Roué 4309eaba64 Scheduling of fresh values is no longer an attribute of ValueObservation 2020-03-27 19:49:11 +01:00
Gwendal Roué 1c59278115 Prefer dbResult argument name for async read closures 2020-03-21 14:36:48 +01:00
Gwendal Roué 2824636650 Prepare for initiial concurrent fetch of ValueObservation in a DatabasePool 2020-03-21 14:36:48 +01:00
Gwendal Roué 9aa67f9db9 SE-0255: Implicit returns from single-expression functions 2020-03-08 23:12:46 +01:00
Gwendal Roué 00b0dc2a04 Remove availability checks for macOS 10.10 (forgotten in #719) 2020-03-08 19:08:15 +01:00
Gwendal Roué bfdd0696da Remove deprecated setupMemoryManagement methods 2020-03-08 16:08:12 +01:00
Gwendal Roué 130e510f8c Remove deprecated passphrase methods 2020-03-08 16:00:19 +01:00
Gwendal Roué 9578f984ec Remove useless #if compiler/swift checks 2020-03-08 13:42:44 +01:00
Gwendal Roué 7c684d06c1 Simplify schema cache management
We don't need EmptyDatabaseSchemaCache. It does not help unsafe reads to work better if concurrent writes modify the schema anyway.
2020-03-01 15:51:37 +01:00
Gwendal Roué 11f8807545 Make barrierWriteWithoutTransaction a requirement of DatabaseWriter 2020-02-29 16:01:45 +01:00
Gwendal Roué 9ed8cb3eff Fix Swiftlint warnings 2020-02-29 14:30:05 +01:00
Pakkito eb98f50891 Avoid breaking changes
- Deprecate setupMemoryManagement(application:)
- UIApplication is not available on watchOS, so instead of checking against `#if canImport(UIKit)` we use `#if os(iOS)`

Signed-off-by: Pakkito <pe@pierlis.com>
2020-02-28 18:00:16 +01:00
Pakkito 32675b38f1 Automatically setup memory management when UIKit is available
Signed-off-by: Pakkito <pe@pierlis.com>
2020-02-28 17:21:27 +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