Commit Graph
202 Commits
Author SHA1 Message Date
Gwendal Roué 43ced9b2f0 Trivial Sendable conformances
Either added, either made explicitly unavailable.
2024-03-17 18:25:04 +01:00
Gwendal Roué f5d55cb1a1 TODO 2024-01-17 10:51:42 +01:00
Gwendal Roué dff7971cd7 Fix failing test for ValueObservation and Database.notifyChanges(in:) 2023-11-25 15:32:35 +01:00
Gwendal Roué 3a1c211746 Address #1389 by forcing the user to specify a tracked region
This is technically a breaking change, but nobody will notice it.
2023-06-08 12:17:27 +02:00
Gwendal Roué 725d4a3fba When a wal snapshot can't be created, ValueConcurrentObserver fallbacks to plain reads
This commit fixes #1383
2023-06-01 20:00:04 +02:00
Gwendal Roué 65c803a110 Fix #1362 2023-04-29 13:24:46 +02:00
Gwendal Roué d07e8bd3a0 The scenario that leads to the #1362 deadlock 2023-04-18 18:22:47 +02:00
Matt Gallagher c159638498 A test demonstrating deadlock when observer count exceeds size of DatabasePool. 2023-04-18 12:48:06 +10:00
Gwendal Roué d5f38a6a24 Fix Swiftlint warning 2023-04-17 19:17:50 +02:00
Gwendal Roué fcfd6e9028 ValueConcurrentObserver releases its initial WAL transaction earlier 2023-04-15 11:59:19 +02:00
Gwendal Roué 5d9b9edfe1 Fix asyncWALSnapshotTransaction usage.
We must use its result asynchronously.
2023-03-19 12:39:48 +01:00
Gwendal Roué d64274474b ValueObservation: stop creating a new connection on start
Since #1248, ValueObservation on DatabasePool creates a new database connection when it starts. #1256 has revealed that opening a connection can take too much time, which unfortunate consequences: the first value is notified too late, and we block the main thread when the observation is started in the `.immediate` scheduling :-/

In this commit, ValueObservation on DatabasePool just uses one of the available readers, thus avoiding creating a new connection.

When WAL snapshots are available, a long-running read-only transaction is kept opened on this reader, until we can start observing the write transactions, compare database versions, and perform a fetch+notification if and only if the database was modified.

When WAL snapshots are not available (Xcode 14.0 and macOS, or specific SQLCipher or SQLite builds), a double notification of the initial value is always performed, since we can't prove that the database was not changed between the initial fetch and the write access.
2023-03-17 13:52:29 +01:00
Gwendal Roué a0ed1bfd33 Move ValueObservation documentation in an extension file 2023-03-15 16:51:46 +01:00
Gwendal Roué aff924a72b Upgrade Swiftlint and fix warnings 2023-02-04 11:23:14 +01:00
Gwendal Roué ac214e6760 SE-0345: if let shorthand for shadowing an existing optional variable 2023-01-30 08:00:47 +01:00
Gwendal Roué d3c289a320 Availability checks cleanup 2023-01-22 12:37:40 +01:00
baegteun a9feac1339 ♻️ :: OSX -> macOS in Availability Check 2023-01-17 13:58:37 +09:00
Gwendal Roué 0dd17a9a16 Turn ValueObservationScheduler into a protocol 2022-12-29 12:38:06 +01:00
Gwendal Roué e3cc15707a Move ValueObservation documentation to DocC 2022-11-27 18:27:26 +01:00
Gwendal Roué 4ff8928dc4 Simplify declaration of ValueObservation factory methods (SE-0267) 2022-11-23 19:46:00 +01:00
Gwendal Roué 2dce8d533e Project organization 2022-11-18 13:33:28 +01:00
Gwendal Roué dc43607921 Cleanup 2022-11-18 13:33:28 +01:00
Gwendal Roué dffe56f8a9 Simplify ValueReducer definition 2022-11-13 18:09:06 +01:00
Gwendal Roué 4871304c60 Enable WALSnapshot on macOS (Xcode 14.1+) 2022-11-13 15:29:44 +01:00
Gwendal Roué 638e586dbc Expose Database.registerAccess(to:)
This helps tools that intend to declare an observed region without directly accessing it. This will be necessary for (future) snapshot-based observations that postpone actual database access.
2022-11-13 10:54:40 +01:00
Gwendal Roué 4307f6a680 Fix Swiftlint warnings 2022-11-06 18:43:00 +01:00
Gwendal Roué 13c804d1cc DocC 2022-11-06 16:02:36 +01:00
Gwendal Roué 1818534513 DocC 2022-11-06 16:02:36 +01:00
Gwendal Roué 6add38e3e5 BREAKING: Allow ValueObservation to perform different kinds of fetch
We're interested in allowing observations to build values based on snapshots
2022-09-04 12:06:17 +02:00
Gwendal Roué 202b3e5620 Encapsulate ValueObservation database accesses
Also, enhance Database.isolated(readOnly:) by not creating a savepoint if the database is already inside a transaction.
2022-09-04 10:11:22 +02:00
Gwendal Roué 1bfba945d3 Fix invalid Swift syntax in documentation 2022-08-21 21:22:34 +02:00
Gwendal Roué 927fc21f00 NEW: ValueObservation.map accepts a throwing closure
This will allow us to call a throwing FetchableRecord.init(row:) from this operator
2022-08-21 21:22:34 +02:00
Gwendal Roué 11a6d53d8a SE-0326: closure result type inference
https://github.com/apple/swift-evolution/blob/main/proposals/0326-extending-multi-statement-closure-inference.md
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é dd55175978 SE-0345: if let x { }
https://github.com/apple/swift-evolution/blob/main/proposals/0345-if-let-shorthand.md
2022-08-21 21:22:34 +02:00
Gwendal Roué fe225fe452 BREAKING: Remove deprecated methods 2022-08-21 19:21:57 +02:00
Gwendal Roué 6da7d47394 Swift 5.7 required: Remove compiler checks 2022-08-21 19:21:57 +02:00
Gwendal Roué 44ec3535c2 Documentation 2022-06-24 16:48:38 +02:00
Gwendal Roué 38c0d68db7 WALSnapshot
SQLITE_ENABLE_SNAPSHOT is available from Xcode 14 :-)
2022-06-24 16:48:38 +02:00
Gwendal Roué de4266499c Configuration.readQoS 2022-05-25 17:19:41 +02:00
Gwendal Roué 209192d3a5 Require Swift 5.6 Compiler for Concurrency Support 2022-04-13 23:07:33 +02:00
Gwendal Roué feebc07101 Documentation 2022-04-02 13:21:26 +02:00
Renaud Lienhart 80c15c6ef6 Fix a crash when an observation is quickly cancelled 2022-03-31 10:55:00 +11:00
Gwendal Roué a3a26bf88f Fix #1194 2022-03-26 11:43:44 +01:00
Gwendal Roué 43e1871005 Fix for Xcode 12.4 2022-03-22 13:46:09 +01:00
Gwendal Roué 8a6e784428 Fix for Xcode 12.5.1
Without this change, the compiler would crash with Abort trap: 6
2022-03-22 09:26:12 +01:00
Gwendal Roué 6916a8feca #1183 cleanup 2022-03-18 03:36:20 +01: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é 09922c34ff Code formatting 2022-01-23 12:24:34 +01:00