mirror of
https://github.com/groue/GRDB.swift
synced 2026-12-05 05:18:44 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae76b6faa6 | ||
|
|
0bba534cc6 | ||
|
|
d5b4ed72fa | ||
|
|
dbe50caec5 | ||
|
|
f780b796a1 |
No files matched your search
@@ -115,6 +115,8 @@
|
||||
56419C7824A51A38004967E1 /* Recorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56419A5E24A51601004967E1 /* Recorder.swift */; };
|
||||
56419C7924A51A38004967E1 /* RecordingError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56419A5F24A51601004967E1 /* RecordingError.swift */; };
|
||||
564448831EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */; };
|
||||
564CD11B28C37C7A001DB866 /* SnapshotFetch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CD11A28C37C7A001DB866 /* SnapshotFetch.swift */; };
|
||||
564CD12028C49CE2001DB866 /* ValueSnapshotObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CD11F28C49CE2001DB866 /* ValueSnapshotObserver.swift */; };
|
||||
564CE43121AA901800652B19 /* ValueConcurrentObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CE43021AA901800652B19 /* ValueConcurrentObserver.swift */; };
|
||||
564CE4E921B2E06F00652B19 /* ValueObservationMapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CE4E821B2E06F00652B19 /* ValueObservationMapTests.swift */; };
|
||||
564CE59D21B7A8B500652B19 /* RemoveDuplicates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CE59621B7A8B500652B19 /* RemoveDuplicates.swift */; };
|
||||
@@ -510,6 +512,8 @@
|
||||
5643676D272EDF2400C718C7 /* Scripts */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Scripts; sourceTree = "<group>"; };
|
||||
564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseAfterNextTransactionCommitTests.swift; sourceTree = "<group>"; };
|
||||
564A50C61BFF4B7F00B3A3A2 /* DatabaseCollationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseCollationTests.swift; sourceTree = "<group>"; };
|
||||
564CD11A28C37C7A001DB866 /* SnapshotFetch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SnapshotFetch.swift; sourceTree = "<group>"; };
|
||||
564CD11F28C49CE2001DB866 /* ValueSnapshotObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueSnapshotObserver.swift; sourceTree = "<group>"; };
|
||||
564CE43021AA901800652B19 /* ValueConcurrentObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ValueConcurrentObserver.swift; sourceTree = "<group>"; };
|
||||
564CE4E821B2E06F00652B19 /* ValueObservationMapTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueObservationMapTests.swift; sourceTree = "<group>"; };
|
||||
564CE59621B7A8B500652B19 /* RemoveDuplicates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemoveDuplicates.swift; sourceTree = "<group>"; };
|
||||
@@ -906,11 +910,10 @@
|
||||
children = (
|
||||
563082E32430B6BE00C14A05 /* DatabaseCancellable.swift */,
|
||||
560233C32724234F00529DF3 /* SharedValueObservation.swift */,
|
||||
564CE43021AA901800652B19 /* ValueConcurrentObserver.swift */,
|
||||
563B06AA217EF0CC00B38F35 /* ValueObservation.swift */,
|
||||
56848972242DE36F002F9702 /* ValueObservationScheduler.swift */,
|
||||
5679533227E0A2FB004D18BD /* ValueWriteOnlyObserver.swift */,
|
||||
56AACAA022ACEC9700A40F2A /* ValueReducer */,
|
||||
564CD11E28C49C7A001DB866 /* Observers */,
|
||||
56AACAA022ACEC9700A40F2A /* Reducers */,
|
||||
);
|
||||
path = ValueObservation;
|
||||
sourceTree = "<group>";
|
||||
@@ -1111,6 +1114,16 @@
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
564CD11E28C49C7A001DB866 /* Observers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
564CD11F28C49CE2001DB866 /* ValueSnapshotObserver.swift */,
|
||||
564CE43021AA901800652B19 /* ValueConcurrentObserver.swift */,
|
||||
5679533227E0A2FB004D18BD /* ValueWriteOnlyObserver.swift */,
|
||||
);
|
||||
path = Observers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5653EABF20944B1300F46237 /* Association */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1494,16 +1507,17 @@
|
||||
path = Record;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56AACAA022ACEC9700A40F2A /* ValueReducer */ = {
|
||||
56AACAA022ACEC9700A40F2A /* Reducers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
564CD11A28C37C7A001DB866 /* SnapshotFetch.swift */,
|
||||
56AACAA722ACED7100A40F2A /* Fetch.swift */,
|
||||
5613ED3421A95A5C00DC7A68 /* Map.swift */,
|
||||
564CE59621B7A8B500652B19 /* RemoveDuplicates.swift */,
|
||||
563B8F91249E6171007A48C9 /* Trace.swift */,
|
||||
5613ED4321A95B2C00DC7A68 /* ValueReducer.swift */,
|
||||
);
|
||||
path = ValueReducer;
|
||||
path = Reducers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56DAA2C41DE99D8D006E10C8 /* Cursor */ = {
|
||||
@@ -2008,6 +2022,7 @@
|
||||
5636E9BC1D22574100B9B05F /* FetchRequest.swift in Sources */,
|
||||
566DDE0D288D763C0000DCFB /* Fixits.swift in Sources */,
|
||||
56BB6EA91D3009B100A1CA52 /* SchedulingWatchdog.swift in Sources */,
|
||||
564CD12028C49CE2001DB866 /* ValueSnapshotObserver.swift in Sources */,
|
||||
563EF44A2161F179007DAACD /* Inflections.swift in Sources */,
|
||||
566B91091FA4C3970012D5B0 /* Database+Statements.swift in Sources */,
|
||||
566B91231FA4CF810012D5B0 /* Database+Schema.swift in Sources */,
|
||||
@@ -2040,6 +2055,7 @@
|
||||
56A2387B1B9C75030082EB20 /* Configuration.swift in Sources */,
|
||||
56FA0C3928B20ABE00B2DFF7 /* PersistableRecord+Upsert.swift in Sources */,
|
||||
566475CC1D981D5E00FF74B8 /* SQLFunctions.swift in Sources */,
|
||||
564CD11B28C37C7A001DB866 /* SnapshotFetch.swift in Sources */,
|
||||
5698AC371D9E5A590056AF8C /* FTS3Pattern.swift in Sources */,
|
||||
563EF415215F87EB007DAACD /* OrderedDictionary.swift in Sources */,
|
||||
563B8FB524A1D029007A48C9 /* ReceiveValuesOn.swift in Sources */,
|
||||
|
||||
@@ -248,11 +248,16 @@ public struct Configuration {
|
||||
/// Default: .userInitiated
|
||||
public var qos: DispatchQoS = .userInitiated
|
||||
|
||||
/// The quality of service of read accesses
|
||||
var readQoS: DispatchQoS {
|
||||
/// The quality of service of read database accesses.
|
||||
public var readQoS: DispatchQoS {
|
||||
targetQueue?.qos ?? self.qos
|
||||
}
|
||||
|
||||
/// The quality of service of write database accesses.
|
||||
public var writeQoS: DispatchQoS {
|
||||
writeTargetQueue?.qos ?? targetQueue?.qos ?? self.qos
|
||||
}
|
||||
|
||||
/// A target queue for database accesses.
|
||||
///
|
||||
/// Database connections which are not read-only will prefer
|
||||
|
||||
@@ -399,9 +399,7 @@ extension Database {
|
||||
try checkForSuspensionViolation(from: statement)
|
||||
|
||||
// Record the database region selected by the statement execution.
|
||||
if isRecordingSelectedRegion {
|
||||
selectedRegion.formUnion(statement.databaseRegion)
|
||||
}
|
||||
try track(statement.databaseRegion)
|
||||
|
||||
// Database observation: prepare transaction observers.
|
||||
observationBroker?.statementWillExecute(statement)
|
||||
|
||||
@@ -170,9 +170,9 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
}
|
||||
|
||||
/// Whether the database region selected by statement execution is
|
||||
/// recorded into `selectedRegion`.
|
||||
/// recorded into `selectedRegion` by `track(_:)`.
|
||||
///
|
||||
/// To record the selected region, use `recordingSelection(_:_:)`.
|
||||
/// To start recording the selected region, use `recordingSelection(_:_:)`.
|
||||
private(set) var isRecordingSelectedRegion = false
|
||||
|
||||
/// The database region selected by statement execution, when
|
||||
@@ -583,10 +583,38 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
readOnlyDepth > 0 || configuration.readonly
|
||||
}
|
||||
|
||||
// MARK: - Recording of the selected region
|
||||
// MARK: - Database Observation
|
||||
|
||||
/// Reports the region to ``ValueObservation``.
|
||||
///
|
||||
/// For example:
|
||||
///
|
||||
/// let observation = ValueObservation.tracking { db in
|
||||
/// // All changes to the 'player' and 'team' tables
|
||||
/// // will trigger the observation.
|
||||
/// try db.track(Table("player"))
|
||||
/// try db.track(Table("team"))
|
||||
/// }
|
||||
///
|
||||
/// This method has an effect if and only if the `ValueObservation` is
|
||||
/// inferring the observed region from the database access. In the example
|
||||
/// below, the observation explicitly tracks the `player` table only, and
|
||||
/// ignore all calls to the `track` method:
|
||||
///
|
||||
/// // Observes the 'player' table only
|
||||
/// let observation = ValueObservation.tracking(region: Table("player")) { db in
|
||||
/// // Ignored
|
||||
/// try db.track(Table("team"))
|
||||
/// }
|
||||
public func track(_ region: @autoclosure () -> some DatabaseRegionConvertible) throws {
|
||||
if isRecordingSelectedRegion {
|
||||
try selectedRegion.formUnion(region().databaseRegion(self))
|
||||
}
|
||||
}
|
||||
|
||||
/// Extends the `region` argument with the database region selected by all
|
||||
/// statements executed by the closure.
|
||||
/// statements executed by the closure, and all regions explicitly tracked
|
||||
/// with the `track(_:)` method.
|
||||
///
|
||||
/// For example:
|
||||
///
|
||||
@@ -594,8 +622,9 @@ public final class Database: CustomStringConvertible, CustomDebugStringConvertib
|
||||
/// try db.recordingSelection(®ion) {
|
||||
/// let players = try Player.fetchAll(db)
|
||||
/// let team = try Team.fetchOne(db, id: 42)
|
||||
/// try db.track(Table("awards"))
|
||||
/// }
|
||||
/// print(region) // player(*),team(*)[42]
|
||||
/// print(region) // awards,player(*),team(*)[42]
|
||||
///
|
||||
/// This method is used by ``ValueObservation``:
|
||||
///
|
||||
|
||||
@@ -718,7 +718,7 @@ extension DatabasePool: DatabaseReader {
|
||||
writer.async(updates)
|
||||
}
|
||||
|
||||
// MARK: - Database Observation
|
||||
// MARK: - ValueObservation Support
|
||||
|
||||
/// :nodoc:
|
||||
public func _add<Reducer: ValueReducer>(
|
||||
@@ -769,6 +769,96 @@ extension DatabasePool: DatabaseReader {
|
||||
onChange: onChange)
|
||||
return observer.start()
|
||||
}
|
||||
|
||||
// MARK: - ValueObservation (Snapshot) Support
|
||||
|
||||
func _add<Reducer: SnapshotReducer>(
|
||||
observation: ValueObservation<Reducer>,
|
||||
scheduling scheduler: ValueObservationScheduler,
|
||||
onChange: @escaping (Reducer.Value) -> Void)
|
||||
-> AnyDatabaseCancellable
|
||||
{
|
||||
if configuration.readonly {
|
||||
// The easy case: the database does not change
|
||||
return _addReadOnly(
|
||||
observation: observation,
|
||||
scheduling: scheduler,
|
||||
onChange: onChange)
|
||||
|
||||
} else {
|
||||
// DatabasePool can perform concurrent observation
|
||||
return _addConcurrent(
|
||||
observation: observation,
|
||||
scheduling: scheduler,
|
||||
onChange: onChange)
|
||||
}
|
||||
}
|
||||
|
||||
/// Adding an observation in a read-only database emits only the
|
||||
/// initial value.
|
||||
private func _addReadOnly<Reducer: SnapshotReducer>(
|
||||
observation: ValueObservation<Reducer>,
|
||||
scheduling scheduler: ValueObservationScheduler,
|
||||
onChange: @escaping (Reducer.Value) -> Void)
|
||||
-> AnyDatabaseCancellable
|
||||
{
|
||||
if scheduler.immediateInitialValue() {
|
||||
do {
|
||||
// TODO: create a snapshot from a reader, without creating a database connection
|
||||
let snapshot = try makeSnapshot()
|
||||
let value = try snapshot.read { db in
|
||||
try observation.fetchInitialValue(db, snapshot: snapshot)
|
||||
}
|
||||
onChange(value)
|
||||
} catch {
|
||||
observation.events.didFail?(error)
|
||||
}
|
||||
return AnyDatabaseCancellable(cancel: { /* nothing to cancel */ })
|
||||
} else {
|
||||
var isCancelled = false
|
||||
// TODO: perform an async read, and create a snapshot from this reader connection
|
||||
DispatchQueue(label: "GRDB.Pool.wait", qos: configuration.readQoS).async {
|
||||
guard !isCancelled else { return }
|
||||
|
||||
let result = Result {
|
||||
let snapshot = try self.makeSnapshot()
|
||||
return try snapshot.read { db in
|
||||
try observation.fetchInitialValue(db, snapshot: snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
scheduler.schedule {
|
||||
guard !isCancelled else { return }
|
||||
do {
|
||||
try onChange(result.get())
|
||||
} catch {
|
||||
observation.events.didFail?(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
return AnyDatabaseCancellable(cancel: { isCancelled = true })
|
||||
}
|
||||
}
|
||||
|
||||
/// A concurrent observation fetches the initial value without waiting for
|
||||
/// the writer.
|
||||
private func _addConcurrent<Reducer: SnapshotReducer>(
|
||||
observation: ValueObservation<Reducer>,
|
||||
scheduling scheduler: ValueObservationScheduler,
|
||||
onChange: @escaping (Reducer.Value) -> Void)
|
||||
-> AnyDatabaseCancellable
|
||||
{
|
||||
assert(!configuration.readonly, "Use _addReadOnly(observation:) instead")
|
||||
assert(!observation.requiresWriteAccess, "Use _addWriteOnly(observation:) instead")
|
||||
let observer = ValueSnapshotObserver(
|
||||
dbPool: self,
|
||||
scheduler: scheduler,
|
||||
trackingMode: observation.trackingMode,
|
||||
reducer: observation.makeReducer(),
|
||||
events: observation.events,
|
||||
onChange: onChange)
|
||||
return observer.start()
|
||||
}
|
||||
}
|
||||
|
||||
extension DatabasePool {
|
||||
|
||||
@@ -82,6 +82,24 @@ extension DatabaseSnapshot {
|
||||
try serializedDatabase.reentrantSync(value)
|
||||
}
|
||||
|
||||
func readFuture<T>(_ value: @escaping (Database) throws -> T) -> DatabaseFuture<T> {
|
||||
// The semaphore that blocks until futureResult is defined:
|
||||
let futureSemaphore = DispatchSemaphore(value: 0)
|
||||
var futureResult: Result<T, Error>? = nil
|
||||
|
||||
asyncRead { dbResult in
|
||||
// Fetch and release the future
|
||||
futureResult = dbResult.flatMap { db in Result { try value(db) } }
|
||||
futureSemaphore.signal()
|
||||
}
|
||||
|
||||
return DatabaseFuture {
|
||||
// Block the future until results are fetched
|
||||
_ = futureSemaphore.wait(timeout: .distantFuture)
|
||||
return try futureResult!.get()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Database Observation
|
||||
|
||||
/// :nodoc:
|
||||
|
||||
@@ -480,8 +480,39 @@ class DatabaseObservationBroker {
|
||||
savepointStack.clear()
|
||||
|
||||
if !database.isReadOnly {
|
||||
for observation in transactionObservations {
|
||||
observation.databaseDidCommit(database)
|
||||
var remainingObservations = transactionObservations[...]
|
||||
while let commitHandling = remainingObservations.first?.commitHandling {
|
||||
remainingObservations.removeAll { $0.commitHandling == commitHandling }
|
||||
switch commitHandling {
|
||||
case .none:
|
||||
break
|
||||
case .detached:
|
||||
let observations = transactionObservations.filter { $0.commitHandling == commitHandling }
|
||||
for observation in observations {
|
||||
observation.databaseDidCommit(database)
|
||||
}
|
||||
case .coalescedInReadOnlyTransaction:
|
||||
do {
|
||||
try database.isolated(readOnly: true) {
|
||||
let observations = transactionObservations.filter { $0.commitHandling == commitHandling }
|
||||
for observation in observations {
|
||||
observation.databaseDidCommit(database)
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
#warning("TODO: how do we notify this error?")
|
||||
}
|
||||
case let .coalescedInSnapshot(dbPool):
|
||||
do {
|
||||
let snapshot = try dbPool.makeSnapshot()
|
||||
let observations = transactionObservations.filter { $0.commitHandling == commitHandling }
|
||||
for observation in observations {
|
||||
observation.databaseDidCommit(coalescedInSnapshot: snapshot)
|
||||
}
|
||||
} catch {
|
||||
#warning("TODO: how do we notify this error?")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,6 +750,7 @@ class DatabaseObservationBroker {
|
||||
///
|
||||
/// Adopting types must be a class.
|
||||
public protocol TransactionObserver: AnyObject {
|
||||
var commitHandling: CommitHandling { get }
|
||||
|
||||
/// Filters database changes that should be notified the the
|
||||
/// databaseDidChange(with:) method.
|
||||
@@ -762,6 +794,8 @@ public protocol TransactionObserver: AnyObject {
|
||||
/// This method is called on the database queue. It can change the database.
|
||||
func databaseDidRollback(_ db: Database)
|
||||
|
||||
func databaseDidCommit(coalescedInSnapshot snapshot: DatabaseSnapshot)
|
||||
|
||||
#if SQLITE_ENABLE_PREUPDATE_HOOK
|
||||
/// Notifies before a database change (insert, update, or delete)
|
||||
/// with change information (initial / final values for the row's
|
||||
@@ -797,10 +831,41 @@ public protocol TransactionObserver: AnyObject {
|
||||
#endif
|
||||
}
|
||||
|
||||
extension TransactionObserver {
|
||||
/// Default implementation does nothing
|
||||
public func databaseWillCommit() throws {
|
||||
public enum CommitHandling: Equatable {
|
||||
/// `databaseDidCommit` is not called.
|
||||
case none
|
||||
|
||||
/// `databaseDidCommit` is called outside of any transaction.
|
||||
case detached
|
||||
|
||||
/// `databaseDidCommit` is called within a read-only transaction, shared
|
||||
/// with all other transaction observers.
|
||||
case coalescedInReadOnlyTransaction
|
||||
|
||||
case coalescedInSnapshot(DatabasePool)
|
||||
|
||||
public static func == (lhs: CommitHandling, rhs: CommitHandling) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case (.none, .none),
|
||||
(.detached, .detached),
|
||||
(.coalescedInReadOnlyTransaction, .coalescedInReadOnlyTransaction):
|
||||
return true
|
||||
case let (.coalescedInSnapshot(lhs), .coalescedInSnapshot(rhs)):
|
||||
return lhs === rhs
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension TransactionObserver {
|
||||
var commitHandling: CommitHandling { .detached }
|
||||
|
||||
/// Default implementation does nothing
|
||||
public func databaseWillCommit() throws { }
|
||||
|
||||
/// Default implementation does nothing
|
||||
func databaseDidCommit(coalescedInSnapshot snapshot: DatabaseSnapshot) { }
|
||||
|
||||
#if SQLITE_ENABLE_PREUPDATE_HOOK
|
||||
/// Default implementation does nothing
|
||||
@@ -853,6 +918,7 @@ final class TransactionObservation {
|
||||
private weak var weakObserver: (any TransactionObserver)?
|
||||
private var strongObserver: (any TransactionObserver)?
|
||||
private var observer: (any TransactionObserver)? { strongObserver ?? weakObserver }
|
||||
var commitHandling: CommitHandling { observer?.commitHandling ?? .none }
|
||||
|
||||
fileprivate var isObserving: Bool {
|
||||
observer != nil
|
||||
|
||||
+16
-2
@@ -499,11 +499,25 @@ extension ValueConcurrentObserver: TransactionObserver {
|
||||
}
|
||||
}
|
||||
|
||||
func databaseDidCommit(_ writerDB: Database) {
|
||||
var commitHandling: CommitHandling {
|
||||
// Ignore transaction unless database was modified
|
||||
guard observationState.isModified else { return }
|
||||
guard observationState.isModified else {
|
||||
return .none
|
||||
}
|
||||
|
||||
switch trackingMode {
|
||||
case .constantRegion, .constantRegionRecordedFromSelection:
|
||||
// No need to share a transaction with other observers
|
||||
return .detached
|
||||
case .nonConstantRegionRecordedFromSelection:
|
||||
// Let's share a common transaction with all observers
|
||||
return .coalescedInReadOnlyTransaction
|
||||
}
|
||||
}
|
||||
|
||||
func databaseDidCommit(_ writerDB: Database) {
|
||||
// Reset the isModified flag until next transaction
|
||||
assert(observationState.isModified)
|
||||
observationState.isModified = false
|
||||
|
||||
// Ignore transaction unless we are still notifying database events, and
|
||||
@@ -0,0 +1,646 @@
|
||||
import Foundation
|
||||
|
||||
/// `ValueSnapshotObserver` observes the database for
|
||||
/// `SnapshotObservation`, in a `DatabasePool`.
|
||||
///
|
||||
/// It performs the following database observation cycle:
|
||||
///
|
||||
/// 1. Start observation or detect a database change
|
||||
/// 2. Fetch (from a snapshot)
|
||||
/// 3. Reduce
|
||||
/// 4. Notify
|
||||
///
|
||||
/// **Fetch** is performed concurrently (hence the name of this observer).
|
||||
///
|
||||
/// **Reduce** is the operation that turns the fetched database values into the
|
||||
/// observed values. Those are not the same. Consider, for example, the `map()`
|
||||
/// and `removeDuplicates()` operators: they perform their job during the
|
||||
/// reducing stage.
|
||||
///
|
||||
/// **Notify** is calling user callbacks, in case of database change or error.
|
||||
final class ValueSnapshotObserver<Reducer: SnapshotReducer> {
|
||||
// MARK: - Configuration
|
||||
//
|
||||
// Configuration is not mutable.
|
||||
|
||||
/// How to schedule observed values and errors.
|
||||
private let scheduler: ValueObservationScheduler
|
||||
|
||||
/// Configures the tracked database region.
|
||||
private let trackingMode: ValueObservationTrackingMode
|
||||
|
||||
// MARK: - Mutable State
|
||||
//
|
||||
// The observer has four distinct mutable states that evolve independently,
|
||||
// and are made thread-safe with various mechanisms:
|
||||
//
|
||||
// - A `DatabaseAccess`: ability to access the database. It is constant but
|
||||
// turns nil after the observation fails or is cancelled, in order to
|
||||
// release memory and resources when the observation completes. It is
|
||||
// guarded by `lock`, because observation can fail or be cancelled from
|
||||
// multiple threads.
|
||||
//
|
||||
// - A `NotificationCallbacks`: ability to notify observation events. It is
|
||||
// constant but turns nil when failure or cancellation is notified, in
|
||||
// order to release memory and resources when the observation completes.
|
||||
// It is guarded by `lock`, because observation can fail or be cancelled
|
||||
// from multiple threads.
|
||||
//
|
||||
// - An `ObservationState`: relationship with the `TransactionObserver`
|
||||
// protocol. It is only accessed from the serialized writer
|
||||
// dispatch queue.
|
||||
//
|
||||
// - A `Reducer`: the observation reducer, only accessed from the
|
||||
// serialized dispatch queue `reduceQueue`.
|
||||
//
|
||||
// The `reduceQueue` guarantees that fresh value notifications have the same
|
||||
// order as transactions. It is different from the serialized writer
|
||||
// dispatch queue because we do not want to lock the database as
|
||||
// computations (`map`, `removeDuplicates()`, etc.) are performed.
|
||||
//
|
||||
// Despite being protected by the same lock, `DatabaseAccess` and
|
||||
// `NotificationCallbacks` are not merged together. This is because the
|
||||
// observer does not lose `DatabaseAccess` at the same time it
|
||||
// looses `NotificationCallbacks`:
|
||||
//
|
||||
// - In case of cancellation, `NotificationCallbacks` is lost first, and
|
||||
// `DatabaseAccess` is lost asynchronously, after the observer could
|
||||
// resign as a transaction observer. See `cancel()`.
|
||||
//
|
||||
// - In case of error, `DatabaseAccess` may be lost synchronously, and
|
||||
// `NotificationCallbacks` is lost asynchronously, after the error could
|
||||
// be notified. See error catching clauses.
|
||||
|
||||
/// Ability to access the database
|
||||
private struct DatabaseAccess {
|
||||
/// The observed DatabasePool.
|
||||
let dbPool: DatabasePool
|
||||
|
||||
/// A reducer that fetches database values.
|
||||
private let reducer: Reducer
|
||||
|
||||
init(dbPool: DatabasePool, reducer: Reducer) {
|
||||
self.dbPool = dbPool
|
||||
self.reducer = reducer
|
||||
}
|
||||
|
||||
func fetch(_ db: Database, snapshot: DatabaseSnapshot)
|
||||
throws -> Reducer.Fetched
|
||||
{
|
||||
try reducer._fetch(db, snapshot: snapshot)
|
||||
}
|
||||
|
||||
func fetchRecordingObservedRegion(_ db: Database, snapshot: DatabaseSnapshot)
|
||||
throws -> (Reducer.Fetched, DatabaseRegion)
|
||||
{
|
||||
var region = DatabaseRegion()
|
||||
let value = try db.recordingSelection(®ion) {
|
||||
try reducer._fetch(db, snapshot: snapshot)
|
||||
}
|
||||
return try (value, region.observableRegion(db))
|
||||
}
|
||||
}
|
||||
|
||||
/// Ability to notify observation events
|
||||
private struct NotificationCallbacks {
|
||||
let events: ValueObservationEvents
|
||||
let onChange: (Reducer.Value) -> Void
|
||||
}
|
||||
|
||||
/// Relationship with the `TransactionObserver` protocol
|
||||
private struct ObservationState {
|
||||
var region: DatabaseRegion?
|
||||
var isModified = false
|
||||
|
||||
static var notObserving: Self { .init(region: nil, isModified: false) }
|
||||
}
|
||||
|
||||
/// Protects `databaseAccess` and `notificationCallbacks`.
|
||||
///
|
||||
/// Check out this compiler bug:
|
||||
/// - <https://github.com/groue/GRDB.swift/issues/1026>
|
||||
/// - <https://github.com/groue/GRDB.swift/pull/1025>
|
||||
private let lock = NSLock()
|
||||
|
||||
/// The dispatch queue where database values are reduced into observed
|
||||
/// values before being notified. Protects `reducer`.
|
||||
private let reduceQueue: DispatchQueue
|
||||
|
||||
/// Access to the database, protected by `lock`.
|
||||
private var databaseAccess: DatabaseAccess?
|
||||
|
||||
/// Ability to notify observation events, protected by `lock`.
|
||||
private var notificationCallbacks: NotificationCallbacks?
|
||||
|
||||
/// Support for `TransactionObserver`, protected by the serialized writer
|
||||
/// dispatch queue.
|
||||
private var observationState = ObservationState.notObserving
|
||||
|
||||
/// Protected by `reduceQueue`.
|
||||
private var reducer: Reducer
|
||||
|
||||
init(
|
||||
dbPool: DatabasePool,
|
||||
scheduler: ValueObservationScheduler,
|
||||
trackingMode: ValueObservationTrackingMode,
|
||||
reducer: Reducer,
|
||||
events: ValueObservationEvents,
|
||||
onChange: @escaping (Reducer.Value) -> Void)
|
||||
{
|
||||
// Configuration
|
||||
self.scheduler = scheduler
|
||||
self.trackingMode = trackingMode
|
||||
|
||||
// State
|
||||
self.databaseAccess = DatabaseAccess(
|
||||
dbPool: dbPool,
|
||||
// ValueReducer semantics guarantees that reducer._fetch
|
||||
// is independent from the reducer state
|
||||
reducer: reducer)
|
||||
self.notificationCallbacks = NotificationCallbacks(events: events, onChange: onChange)
|
||||
self.reducer = reducer
|
||||
self.reduceQueue = DispatchQueue(
|
||||
label: dbPool.configuration.identifier(
|
||||
defaultLabel: "GRDB",
|
||||
purpose: "ValueObservation"),
|
||||
qos: dbPool.configuration.readQoS)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Starting the Observation
|
||||
//
|
||||
// When we start an observation from a `DatabasePool`, we do not wait for an
|
||||
// access to the writer connection before fetching the initial value. That is
|
||||
// because the user of a `DatabasePool` expects to be notified with the initial
|
||||
// value as fast as possible, even if a long write transaction is running in the
|
||||
// background.
|
||||
//
|
||||
// We will thus perform the initial fetch from a reader connection, and only
|
||||
// then access the writer connection, and start database observation.
|
||||
//
|
||||
// Between this initial fetch, and the beginning of database observation, any
|
||||
// number of unobserved writes may occur. We must notify the changes that happen
|
||||
// during this unobserved window. But how do we spot them, since we were not
|
||||
// observing the database yet?
|
||||
//
|
||||
// The solution depends on the presence of the `SQLITE_ENABLE_SNAPSHOT`
|
||||
// SQLite compilation flag.
|
||||
//
|
||||
// Without `SQLITE_ENABLE_SNAPSHOT`, we have NO WAY to detect if the database
|
||||
// was changed or not between the initial fetch and the beginning of database
|
||||
// observation. We will thus always perform a secondary fetch from the initial
|
||||
// access to the writer connection. Even if no change was performed. We may end
|
||||
// up notifying the same value twice. Such stuttering is a documented glitch,
|
||||
// and the user can perform deduplication with the
|
||||
// `removeDuplicates()` operator.
|
||||
//
|
||||
// With `SQLITE_ENABLE_SNAPSHOT`, we can detect if the database was not changed
|
||||
// at all between the initial fetch and the beginning of database observation.
|
||||
// If the database was changed, we perform a secondary fetch from the initial
|
||||
// access to the writer connection. It is possible that the change was not
|
||||
// related to the observed value. Actually we have NO WAY to know. So we may end
|
||||
// up notifying the same value twice. Such stuttering is a documented glitch,
|
||||
// and the user can perform deduplication with the
|
||||
// `removeDuplicates()` operator.
|
||||
//
|
||||
// This is how we can both:
|
||||
// 1. Start the observation without waiting for a write access (the expected
|
||||
// benefit of `DatabasePool`).
|
||||
// 2. Make sure we do not miss a change (a documented guarantee)
|
||||
//
|
||||
// Support for `SQLITE_ENABLE_SNAPSHOT` is implemented by our
|
||||
// `WALSnapshot` class.
|
||||
extension ValueSnapshotObserver {
|
||||
// Starts the observation
|
||||
func start() -> AnyDatabaseCancellable {
|
||||
let (notificationCallbacks, databaseAccess) = lock.synchronized {
|
||||
(self.notificationCallbacks, self.databaseAccess)
|
||||
}
|
||||
guard let notificationCallbacks, let databaseAccess else {
|
||||
// Likely a GRDB bug: during a synchronous start, user is not
|
||||
// able to cancel observation.
|
||||
fatalError("can't start a cancelled or failed observation")
|
||||
}
|
||||
|
||||
if scheduler.immediateInitialValue() {
|
||||
do {
|
||||
// Start the observation in an synchronous way
|
||||
let initialValue = try syncStart(from: databaseAccess)
|
||||
|
||||
// Notify the initial value from the dispatch queue the
|
||||
// observation was started from
|
||||
notificationCallbacks.onChange(initialValue)
|
||||
} catch {
|
||||
// Notify error from the dispatch queue the observation
|
||||
// was started from.
|
||||
notificationCallbacks.events.didFail?(error)
|
||||
|
||||
// Early return!
|
||||
return AnyDatabaseCancellable { /* nothing to cancel */ }
|
||||
}
|
||||
} else {
|
||||
// Start the observation in an asynchronous way
|
||||
asyncStart(from: databaseAccess)
|
||||
}
|
||||
|
||||
// Make sure the returned cancellable cancels the observation
|
||||
// when deallocated. We can't relying on the deallocation of
|
||||
// self to trigger early cancellation, because self may be retained by
|
||||
// some closure waiting to run in some DispatchQueue.
|
||||
return AnyDatabaseCancellable(self)
|
||||
}
|
||||
|
||||
private func startObservation(_ writerDB: Database, observedRegion: DatabaseRegion) {
|
||||
observationState.region = observedRegion
|
||||
assert(observationState.isModified == false)
|
||||
writerDB.add(transactionObserver: self, extent: .observerLifetime)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Starting the Observation (with SQLITE_ENABLE_SNAPSHOT)
|
||||
|
||||
extension ValueSnapshotObserver {
|
||||
/// Synchronously starts the observation, and returns the initial value.
|
||||
///
|
||||
/// Unlike `asyncStart()`, this method does not notify the initial value or error.
|
||||
private func syncStart(from databaseAccess: DatabaseAccess) throws -> Reducer.Value {
|
||||
let initialSnapshot = try databaseAccess.dbPool.makeSnapshot()
|
||||
let (fetchedValue, initialRegion, initialWALSnapshot) = try initialSnapshot.read {
|
||||
db -> (Reducer.Fetched, DatabaseRegion, WALSnapshot?) in
|
||||
// swiftlint:disable:previous closure_parameter_position
|
||||
|
||||
switch trackingMode {
|
||||
case let .constantRegion(regions):
|
||||
let fetchedValue = try initialSnapshot.read { db in
|
||||
try databaseAccess.fetch(db, snapshot: initialSnapshot)
|
||||
}
|
||||
let region = try DatabaseRegion.union(regions)(db)
|
||||
let initialRegion = try region.observableRegion(db)
|
||||
return (fetchedValue, initialRegion, WALSnapshot(db))
|
||||
|
||||
case .constantRegionRecordedFromSelection:
|
||||
let (fetchedValue, initialRegion) = try databaseAccess
|
||||
.fetchRecordingObservedRegion(db, snapshot: initialSnapshot)
|
||||
return (fetchedValue, initialRegion, WALSnapshot(db))
|
||||
|
||||
case .nonConstantRegionRecordedFromSelection:
|
||||
// Likely a GRDB bug
|
||||
fatalError("ValueSnapshotObserver does not support non constant observed regions.")
|
||||
}
|
||||
}
|
||||
|
||||
// Reduce
|
||||
let initialValue = try reduceQueue.sync {
|
||||
guard let initialValue = try reducer._value(fetchedValue) else {
|
||||
fatalError("Broken contract: reducer has no initial value")
|
||||
}
|
||||
return initialValue
|
||||
}
|
||||
|
||||
// Start observation
|
||||
asyncStartObservation(
|
||||
from: databaseAccess,
|
||||
initialSnapshot: initialSnapshot,
|
||||
initialWALSnapshot: initialWALSnapshot,
|
||||
initialRegion: initialRegion)
|
||||
|
||||
return initialValue
|
||||
}
|
||||
|
||||
/// Asynchronously starts the observation
|
||||
///
|
||||
/// Unlike `syncStart()`, this method does notify the initial value or error.
|
||||
private func asyncStart(from databaseAccess: DatabaseAccess) {
|
||||
do {
|
||||
let initialSnapshot = try databaseAccess.dbPool.makeSnapshot()
|
||||
initialSnapshot.asyncRead { dbResult in
|
||||
let isNotifying = self.lock.synchronized { self.notificationCallbacks != nil }
|
||||
guard isNotifying else { return /* Cancelled */ }
|
||||
|
||||
do {
|
||||
// Fetch
|
||||
let fetchedValue: Reducer.Fetched
|
||||
let initialRegion: DatabaseRegion
|
||||
let db = try dbResult.get()
|
||||
switch self.trackingMode {
|
||||
case let .constantRegion(regions):
|
||||
fetchedValue = try databaseAccess.fetch(db, snapshot: initialSnapshot)
|
||||
let region = try DatabaseRegion.union(regions)(db)
|
||||
initialRegion = try region.observableRegion(db)
|
||||
|
||||
case .constantRegionRecordedFromSelection:
|
||||
(fetchedValue, initialRegion) = try databaseAccess
|
||||
.fetchRecordingObservedRegion(db, snapshot: initialSnapshot)
|
||||
|
||||
case .nonConstantRegionRecordedFromSelection:
|
||||
// Likely a GRDB bug
|
||||
fatalError("ValueSnapshotObserver does not support non constant observed regions.")
|
||||
}
|
||||
|
||||
// Reduce
|
||||
//
|
||||
// Reducing is performed asynchronously, so that we do not lock
|
||||
// a database dispatch queue longer than necessary.
|
||||
self.reduceQueue.async {
|
||||
let isNotifying = self.lock.synchronized { self.notificationCallbacks != nil }
|
||||
guard isNotifying else { return /* Cancelled */ }
|
||||
|
||||
do {
|
||||
guard let initialValue = try self.reducer._value(fetchedValue) else {
|
||||
fatalError("Broken contract: reducer has no initial value")
|
||||
}
|
||||
|
||||
// Notify
|
||||
self.scheduler.schedule {
|
||||
let onChange = self.lock.synchronized { self.notificationCallbacks?.onChange }
|
||||
guard let onChange else { return /* Cancelled */ }
|
||||
onChange(initialValue)
|
||||
}
|
||||
} catch {
|
||||
self.notifyError(error)
|
||||
}
|
||||
}
|
||||
|
||||
// Start observation
|
||||
self.asyncStartObservation(
|
||||
from: databaseAccess,
|
||||
initialSnapshot: initialSnapshot,
|
||||
initialWALSnapshot: WALSnapshot(db),
|
||||
initialRegion: initialRegion)
|
||||
} catch {
|
||||
self.notifyError(error)
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
self.notifyError(error)
|
||||
}
|
||||
}
|
||||
|
||||
private func asyncStartObservation(
|
||||
from databaseAccess: DatabaseAccess,
|
||||
initialSnapshot: DatabaseSnapshot,
|
||||
initialWALSnapshot: WALSnapshot?,
|
||||
initialRegion: DatabaseRegion)
|
||||
{
|
||||
databaseAccess.dbPool.asyncWriteWithoutTransaction { writerDB in
|
||||
let events = self.lock.synchronized { self.notificationCallbacks?.events }
|
||||
guard let events else { return /* Cancelled */ }
|
||||
|
||||
do {
|
||||
var observedRegion = initialRegion
|
||||
|
||||
// Transaction is needed for comparing version snapshots
|
||||
try writerDB.isolated(readOnly: true) {
|
||||
// Keep DatabaseSnaphot alive until we have compared
|
||||
// database versions. It prevents database checkpointing,
|
||||
// and keeps WAL snapshots (`sqlite3_snapshot`) valid
|
||||
// and comparable.
|
||||
let isModified = withExtendedLifetime(initialSnapshot) {
|
||||
guard let initialWALSnapshot,
|
||||
let currentWALSnapshot = WALSnapshot(writerDB)
|
||||
else {
|
||||
return true
|
||||
}
|
||||
let ordering = initialWALSnapshot.compare(currentWALSnapshot)
|
||||
assert(ordering <= 0, "Unexpected snapshot ordering")
|
||||
return ordering < 0
|
||||
}
|
||||
|
||||
if isModified {
|
||||
events.databaseDidChange?()
|
||||
|
||||
// Fetch
|
||||
let fetchedValue: Reducer.Fetched
|
||||
|
||||
switch self.trackingMode {
|
||||
case .constantRegion:
|
||||
let snapshot = try databaseAccess.dbPool.makeSnapshot()
|
||||
fetchedValue = try snapshot.read { db in
|
||||
try databaseAccess.fetch(db, snapshot: snapshot)
|
||||
}
|
||||
events.willTrackRegion?(initialRegion)
|
||||
self.startObservation(writerDB, observedRegion: initialRegion)
|
||||
|
||||
case .constantRegionRecordedFromSelection:
|
||||
let snapshot = try databaseAccess.dbPool.makeSnapshot()
|
||||
(fetchedValue, observedRegion) = try snapshot.read { db in
|
||||
try databaseAccess.fetchRecordingObservedRegion(db, snapshot: snapshot)
|
||||
}
|
||||
events.willTrackRegion?(observedRegion)
|
||||
self.startObservation(writerDB, observedRegion: observedRegion)
|
||||
|
||||
case .nonConstantRegionRecordedFromSelection:
|
||||
// Likely a GRDB bug
|
||||
fatalError("ValueSnapshotObserver does not support non constant observed regions.")
|
||||
}
|
||||
|
||||
// Reduce
|
||||
//
|
||||
// Reducing is performed asynchronously, so that we do not lock
|
||||
// the writer dispatch queue longer than necessary.
|
||||
//
|
||||
// Important: reduceQueue.async guarantees the same ordering
|
||||
// between transactions and notifications!
|
||||
self.reduceQueue.async {
|
||||
let isNotifying = self.lock.synchronized { self.notificationCallbacks != nil }
|
||||
guard isNotifying else { return /* Cancelled */ }
|
||||
|
||||
do {
|
||||
let value = try self.reducer._value(fetchedValue)
|
||||
|
||||
// Notify
|
||||
if let value = value {
|
||||
self.scheduler.schedule {
|
||||
let onChange = self.lock.synchronized { self.notificationCallbacks?.onChange }
|
||||
guard let onChange else { return /* Cancelled */ }
|
||||
onChange(value)
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
let dbPool = self.lock.synchronized { self.databaseAccess?.dbPool }
|
||||
dbPool?.asyncWriteWithoutTransaction { writerDB in
|
||||
self.stopDatabaseObservation(writerDB)
|
||||
}
|
||||
self.notifyError(error)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
events.willTrackRegion?(initialRegion)
|
||||
self.startObservation(writerDB, observedRegion: initialRegion)
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
self.notifyError(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Observing Database Transactions
|
||||
|
||||
extension ValueSnapshotObserver: TransactionObserver {
|
||||
func observes(eventsOfKind eventKind: DatabaseEventKind) -> Bool {
|
||||
if let region = observationState.region {
|
||||
return region.isModified(byEventsOfKind: eventKind)
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func databaseDidChange(with event: DatabaseEvent) {
|
||||
if let region = observationState.region, region.isModified(by: event) {
|
||||
// Database was modified!
|
||||
observationState.isModified = true
|
||||
// We can stop observing the current transaction
|
||||
stopObservingDatabaseChangesUntilNextTransaction()
|
||||
}
|
||||
}
|
||||
|
||||
var commitHandling: CommitHandling {
|
||||
// Ignore transaction unless database was modified
|
||||
guard observationState.isModified else {
|
||||
return .none
|
||||
}
|
||||
|
||||
let dbPool = lock.synchronized {
|
||||
self.databaseAccess?.dbPool
|
||||
}
|
||||
guard let dbPool else {
|
||||
return .none
|
||||
}
|
||||
|
||||
return .coalescedInSnapshot(dbPool)
|
||||
// // No need to share a transaction with other observers
|
||||
// return .databaseDidCommit
|
||||
}
|
||||
|
||||
func databaseDidCommit(_ writerDB: Database) {
|
||||
// Reset the isModified flag until next transaction
|
||||
assert(observationState.isModified)
|
||||
observationState.isModified = false
|
||||
|
||||
// Ignore transaction unless we are still notifying database events, and
|
||||
// we can still access the database.
|
||||
let (events, databaseAccess) = lock.synchronized {
|
||||
(notificationCallbacks?.events, self.databaseAccess)
|
||||
}
|
||||
guard let events, let databaseAccess else { return /* Cancelled */ }
|
||||
|
||||
events.databaseDidChange?()
|
||||
|
||||
// Fetch
|
||||
let future: DatabaseFuture<Reducer.Fetched>
|
||||
|
||||
switch trackingMode {
|
||||
case .constantRegion, .constantRegionRecordedFromSelection:
|
||||
do {
|
||||
let snapshot = try databaseAccess.dbPool.makeSnapshot()
|
||||
future = snapshot.readFuture { db in
|
||||
try databaseAccess.fetch(db, snapshot: snapshot)
|
||||
}
|
||||
} catch {
|
||||
future = DatabaseFuture(.failure(error))
|
||||
}
|
||||
|
||||
case .nonConstantRegionRecordedFromSelection:
|
||||
// When the tracked region is not constant, we can't fetch the
|
||||
// observed value from a snapshot.
|
||||
//
|
||||
// This is because after the snapshot has acquired snapshot
|
||||
// isolation, and before the fetch completes, a change can be
|
||||
// performed in the *next* tracked region. When this happens, the
|
||||
// snapshot fetch has loaded an obsolete value, and we need to
|
||||
// perform a new fetch, with the latest values. But the
|
||||
// observation was not triggered by the change because we didn't
|
||||
// know that this change was about to be tracked! This means
|
||||
// that we'd miss a change, and fail notifying the latest value.
|
||||
//
|
||||
// Conclusion: non-constant regions are not supported.
|
||||
fatalError("ValueSnapshotObserver does not support non constant observed regions.")
|
||||
}
|
||||
|
||||
// Reduce
|
||||
//
|
||||
// Reducing is performed asynchronously, so that we do not lock
|
||||
// the writer dispatch queue longer than necessary.
|
||||
//
|
||||
// Important: reduceQueue.async guarantees the same ordering between
|
||||
// transactions and notifications!
|
||||
reduceQueue.async {
|
||||
do {
|
||||
// Wait until fetch has completed
|
||||
// TODO: find a way to guarantee correct ordering without waiting for a semaphore and blocking a thread.
|
||||
let fetchedValue = try future.wait()
|
||||
|
||||
let isNotifying = self.lock.synchronized { self.notificationCallbacks != nil }
|
||||
guard isNotifying else { return /* Cancelled */ }
|
||||
|
||||
let value = try self.reducer._value(fetchedValue)
|
||||
|
||||
// Notify value
|
||||
if let value = value {
|
||||
self.scheduler.schedule {
|
||||
let onChange = self.lock.synchronized { self.notificationCallbacks?.onChange }
|
||||
guard let onChange else { return /* Cancelled */ }
|
||||
onChange(value)
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
let dbPool = self.lock.synchronized { self.databaseAccess?.dbPool }
|
||||
dbPool?.asyncWriteWithoutTransaction { writerDB in
|
||||
self.stopDatabaseObservation(writerDB)
|
||||
}
|
||||
self.notifyError(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func databaseDidRollback(_ db: Database) {
|
||||
// Reset the isModified flag until next transaction
|
||||
observationState.isModified = false
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Ending the Observation
|
||||
|
||||
extension ValueSnapshotObserver: DatabaseCancellable {
|
||||
func cancel() {
|
||||
// Notify cancellation
|
||||
let (events, dbPool): (ValueObservationEvents?, DatabasePool?) = lock.synchronized {
|
||||
let events = notificationCallbacks?.events
|
||||
notificationCallbacks = nil
|
||||
return (events, databaseAccess?.dbPool)
|
||||
}
|
||||
|
||||
guard let events else { return /* Cancelled or failed */ }
|
||||
events.didCancel?()
|
||||
|
||||
// Stop observing the database
|
||||
// Do it asynchronously, so that we do not block the current thread:
|
||||
// cancellation may be triggered while a long write access is executing.
|
||||
guard let dbPool else { return /* Failed */ }
|
||||
dbPool.asyncWriteWithoutTransaction { db in
|
||||
self.stopDatabaseObservation(db)
|
||||
}
|
||||
}
|
||||
|
||||
func notifyError(_ error: Error) {
|
||||
scheduler.schedule {
|
||||
let events = self.lock.synchronized {
|
||||
let events = self.notificationCallbacks?.events
|
||||
self.notificationCallbacks = nil
|
||||
return events
|
||||
}
|
||||
guard let events else { return /* Cancelled */ }
|
||||
events.didFail?(error)
|
||||
}
|
||||
}
|
||||
|
||||
private func stopDatabaseObservation(_ writerDB: Database) {
|
||||
writerDB.remove(transactionObserver: self)
|
||||
observationState = .notObserving
|
||||
lock.synchronized {
|
||||
databaseAccess = nil
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
-15
@@ -29,6 +29,9 @@ final class ValueWriteOnlyObserver<Writer: DatabaseWriter, Reducer: ValueReducer
|
||||
/// Configures the tracked database region.
|
||||
private let trackingMode: ValueObservationTrackingMode
|
||||
|
||||
/// If true, database values are fetched from a read-only access.
|
||||
private let readOnly: Bool
|
||||
|
||||
// MARK: - Mutable State
|
||||
//
|
||||
// The observer has four distinct mutable states that evolve independently,
|
||||
@@ -76,25 +79,21 @@ final class ValueWriteOnlyObserver<Writer: DatabaseWriter, Reducer: ValueReducer
|
||||
/// The observed DatabaseWriter.
|
||||
let writer: Writer
|
||||
|
||||
/// If true, database values are fetched from a read-only access.
|
||||
private let readOnly: Bool
|
||||
|
||||
/// A reducer that fetches database values.
|
||||
private let reducer: Reducer
|
||||
|
||||
init(writer: Writer, readOnly: Bool, reducer: Reducer) {
|
||||
init(writer: Writer, reducer: Reducer) {
|
||||
self.writer = writer
|
||||
self.readOnly = readOnly
|
||||
self.reducer = reducer
|
||||
}
|
||||
|
||||
func fetch(_ db: Database) throws -> Reducer.Fetched {
|
||||
func fetch(_ db: Database, readOnly: Bool) throws -> Reducer.Fetched {
|
||||
try db.isolated(readOnly: readOnly) {
|
||||
try reducer._fetch(db)
|
||||
}
|
||||
}
|
||||
|
||||
func fetchRecordingObservedRegion(_ db: Database) throws -> (Reducer.Fetched, DatabaseRegion) {
|
||||
func fetchRecordingObservedRegion(_ db: Database, readOnly: Bool) throws -> (Reducer.Fetched, DatabaseRegion) {
|
||||
var region = DatabaseRegion()
|
||||
let fetchedValue = try db.isolated(readOnly: readOnly) {
|
||||
try db.recordingSelection(®ion) {
|
||||
@@ -151,11 +150,11 @@ final class ValueWriteOnlyObserver<Writer: DatabaseWriter, Reducer: ValueReducer
|
||||
// Configuration
|
||||
self.scheduler = scheduler
|
||||
self.trackingMode = trackingMode
|
||||
self.readOnly = readOnly
|
||||
|
||||
// State
|
||||
self.databaseAccess = DatabaseAccess(
|
||||
writer: writer,
|
||||
readOnly: readOnly,
|
||||
// ValueReducer semantics guarantees that reducer._fetch
|
||||
// is independent from the reducer state
|
||||
reducer: reducer)
|
||||
@@ -307,7 +306,7 @@ extension ValueWriteOnlyObserver {
|
||||
|
||||
switch trackingMode {
|
||||
case let .constantRegion(regions):
|
||||
let fetchedValue = try databaseAccess.fetch(db)
|
||||
let fetchedValue = try databaseAccess.fetch(db, readOnly: readOnly)
|
||||
let region = try DatabaseRegion.union(regions)(db)
|
||||
let observedRegion = try region.observableRegion(db)
|
||||
events.willTrackRegion?(observedRegion)
|
||||
@@ -316,7 +315,7 @@ extension ValueWriteOnlyObserver {
|
||||
|
||||
case .constantRegionRecordedFromSelection,
|
||||
.nonConstantRegionRecordedFromSelection:
|
||||
let (fetchedValue, observedRegion) = try databaseAccess.fetchRecordingObservedRegion(db)
|
||||
let (fetchedValue, observedRegion) = try databaseAccess.fetchRecordingObservedRegion(db, readOnly: readOnly)
|
||||
events.willTrackRegion?(observedRegion)
|
||||
startObservation(db, observedRegion: observedRegion)
|
||||
return fetchedValue
|
||||
@@ -350,11 +349,22 @@ extension ValueWriteOnlyObserver: TransactionObserver {
|
||||
}
|
||||
}
|
||||
|
||||
func databaseDidCommit(_ db: Database) {
|
||||
var commitHandling: CommitHandling {
|
||||
// Ignore transaction unless database was modified
|
||||
guard observationState.isModified else { return }
|
||||
|
||||
guard observationState.isModified else {
|
||||
return .none
|
||||
}
|
||||
if readOnly {
|
||||
// Let's share a common transaction with all observers
|
||||
return .coalescedInReadOnlyTransaction
|
||||
} else {
|
||||
return .detached
|
||||
}
|
||||
}
|
||||
|
||||
func databaseDidCommit(_ db: Database) {
|
||||
// Reset the isModified flag until next transaction
|
||||
assert(observationState.isModified)
|
||||
observationState.isModified = false
|
||||
|
||||
// Ignore transaction unless we are still notifying database events, and
|
||||
@@ -374,10 +384,10 @@ extension ValueWriteOnlyObserver: TransactionObserver {
|
||||
switch trackingMode {
|
||||
case .constantRegion, .constantRegionRecordedFromSelection:
|
||||
// Tracked region is already known. Fetch only.
|
||||
fetchedValue = try databaseAccess.fetch(db)
|
||||
fetchedValue = try databaseAccess.fetch(db, readOnly: readOnly)
|
||||
case .nonConstantRegionRecordedFromSelection:
|
||||
// Fetch and update the tracked region.
|
||||
let (value, observedRegion) = try databaseAccess.fetchRecordingObservedRegion(db)
|
||||
let (value, observedRegion) = try databaseAccess.fetchRecordingObservedRegion(db, readOnly: readOnly)
|
||||
fetchedValue = value
|
||||
|
||||
// Don't spam the user with region tracking events: wait for an actual change
|
||||
File renamed without changes.
+7
@@ -37,3 +37,10 @@ extension ValueReducers.Map: _DatabaseValueReducer where Base: _DatabaseValueRed
|
||||
try base._fetch(db)
|
||||
}
|
||||
}
|
||||
|
||||
extension ValueReducers.Map: _SnapshotValueReducer where Base: _SnapshotValueReducer {
|
||||
/// :nodoc:
|
||||
public func _fetch(_ db: Database, snapshot: DatabaseSnapshot) throws -> Base.Fetched {
|
||||
try base._fetch(db, snapshot: snapshot)
|
||||
}
|
||||
}
|
||||
+7
@@ -50,3 +50,10 @@ extension ValueReducers.RemoveDuplicates: _DatabaseValueReducer where Base: _Dat
|
||||
try base._fetch(db)
|
||||
}
|
||||
}
|
||||
|
||||
extension ValueReducers.RemoveDuplicates: _SnapshotValueReducer where Base: _SnapshotValueReducer {
|
||||
/// :nodoc:
|
||||
public func _fetch(_ db: Database, snapshot: DatabaseSnapshot) throws -> Base.Fetched {
|
||||
try base._fetch(db, snapshot: snapshot)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
extension ValueReducers {
|
||||
/// A reducer which passes raw fetched values through.
|
||||
public struct SnapshotFetch<Value>: SnapshotReducer {
|
||||
private let __fetch: (Database, DatabaseSnapshot) throws -> Value
|
||||
|
||||
/// Creates a reducer which passes raw fetched values through.
|
||||
init(fetch: @escaping (Database, DatabaseSnapshot) throws -> Value) {
|
||||
self.__fetch = fetch
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func _fetch(_ db: Database, snapshot: DatabaseSnapshot) throws -> Value {
|
||||
return try __fetch(db, snapshot)
|
||||
}
|
||||
|
||||
/// :nodoc:
|
||||
public func _value(_ fetched: Value) -> Value? {
|
||||
fetched
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -23,3 +23,11 @@ extension ValueReducers.Trace: _DatabaseValueReducer where Base: _DatabaseValueR
|
||||
return try base._fetch(db)
|
||||
}
|
||||
}
|
||||
|
||||
extension ValueReducers.Trace: _SnapshotValueReducer where Base: _SnapshotValueReducer {
|
||||
/// :nodoc:
|
||||
public func _fetch(_ db: Database, snapshot: DatabaseSnapshot) throws -> Base.Fetched {
|
||||
willFetch()
|
||||
return try base._fetch(db, snapshot: snapshot)
|
||||
}
|
||||
}
|
||||
+16
@@ -34,10 +34,26 @@ public protocol _DatabaseValueReducer: _ValueReducer {
|
||||
func _fetch(_ db: Database) throws -> Fetched
|
||||
}
|
||||
|
||||
/// Implementation details of `ValueReducer`, able to observe from
|
||||
/// ``DatabaseSnapshot`` only.
|
||||
///
|
||||
/// :nodoc:
|
||||
public protocol _SnapshotValueReducer: _ValueReducer {
|
||||
#warning("TODO: consider providing a database connection from the snapshot as well")
|
||||
/// Fetches database values upon changes in an observed database region.
|
||||
///
|
||||
/// This method must does not depend on the state of the reducer.
|
||||
func _fetch(_ db: Database, snapshot: DatabaseSnapshot) throws -> Fetched
|
||||
}
|
||||
|
||||
/// `ValueReducer` supports ``ValueObservation`` that can observe from any
|
||||
/// database reader (``DatabaseQueue``, ``DatabasePool``).
|
||||
public typealias ValueReducer = _ValueReducer & _DatabaseValueReducer
|
||||
|
||||
/// `SnapshotReducer` supports ``ValueObservation`` that can observer from
|
||||
/// ``DatabaseSnapshot`` only
|
||||
public typealias SnapshotReducer = _ValueReducer & _SnapshotValueReducer
|
||||
|
||||
/// A namespace for types related to the `ValueReducer` protocol.
|
||||
public enum ValueReducers {
|
||||
// ValueReducers.Auto allows us to define ValueObservation factory methods.
|
||||
@@ -156,6 +156,67 @@ extension ValueObservation: Refinable {
|
||||
onChange: onChange)
|
||||
}
|
||||
|
||||
/// Starts the value observation in the provided database pool.
|
||||
///
|
||||
/// The observation lasts until the returned cancellable is cancelled
|
||||
/// or deallocated.
|
||||
///
|
||||
/// For example:
|
||||
///
|
||||
/// let observation = ValueObservation.trackingSnapshots { db, snapshot in
|
||||
/// ...
|
||||
/// }
|
||||
///
|
||||
/// let cancellable = try observation.start(
|
||||
/// in: dbPool,
|
||||
/// onError: { error in ... },
|
||||
/// onChange: { trackedValue in
|
||||
/// print("Value has changed")
|
||||
/// })
|
||||
///
|
||||
/// By default, fresh values are dispatched asynchronously on the
|
||||
/// main queue. You can change this behavior by providing a scheduler.
|
||||
/// For example, `.immediate` notifies all values on the main queue as well,
|
||||
/// and the first one is immediately notified when the start() method
|
||||
/// is called:
|
||||
///
|
||||
/// let cancellable = try observation.start(
|
||||
/// in: dbPool,
|
||||
/// scheduling: .immediate, // <-
|
||||
/// onError: { error in ... },
|
||||
/// onChange: { trackedValue in
|
||||
/// print("Value has changed")
|
||||
/// })
|
||||
/// // <- here "Value has changed" is already printed.
|
||||
///
|
||||
/// Note that the `.immediate` scheduler requires that the observation is
|
||||
/// subscribed from the main thread. It raises a fatal error otherwise.
|
||||
///
|
||||
/// - parameter pool: A DatabasePool.
|
||||
/// - parameter scheduler: A Scheduler. By default, fresh values are
|
||||
/// dispatched asynchronously on the main queue.
|
||||
/// - parameter onError: A closure that is provided eventual errors that
|
||||
/// happen during observation
|
||||
/// - parameter onChange: A closure that is provided fresh values
|
||||
/// - returns: a cancellable.
|
||||
public func start(
|
||||
in pool: DatabasePool,
|
||||
scheduling scheduler: ValueObservationScheduler = .async(onQueue: .main),
|
||||
onError: @escaping (Error) -> Void,
|
||||
onChange: @escaping (Reducer.Value) -> Void)
|
||||
-> AnyDatabaseCancellable
|
||||
where Reducer: SnapshotReducer
|
||||
{
|
||||
let observation = self.with {
|
||||
$0.events.didFail = concat($0.events.didFail, onError)
|
||||
}
|
||||
observation.events.willStart?()
|
||||
return pool._add(
|
||||
observation: observation,
|
||||
scheduling: scheduler,
|
||||
onChange: onChange)
|
||||
}
|
||||
|
||||
// MARK: - Debugging
|
||||
|
||||
/// Performs the specified closures when ValueObservation events occur.
|
||||
@@ -254,6 +315,17 @@ extension ValueObservation: Refinable {
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
/// Fetches the initial value.
|
||||
func fetchInitialValue(_ db: Database, snapshot: DatabaseSnapshot) throws -> Reducer.Value
|
||||
where Reducer: SnapshotReducer
|
||||
{
|
||||
var reducer = makeReducer()
|
||||
guard let value = try reducer._value(reducer._fetch(db, snapshot: snapshot)) else {
|
||||
fatalError("Broken contract: reducer has no initial value")
|
||||
}
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
extension ValueObservation {
|
||||
@@ -556,7 +628,7 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
|
||||
// MARK: - Creating ValueObservation
|
||||
|
||||
/// Creates an optimized `ValueObservation` that notifies the values
|
||||
/// Creates an optimized `ValueObservation` that notifies the value
|
||||
/// returned by the `fetch` function whenever a database transaction
|
||||
/// changes them.
|
||||
///
|
||||
@@ -624,8 +696,8 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
/// }
|
||||
/// }
|
||||
///
|
||||
/// - parameter fetch: A function that fetches the observed value from
|
||||
/// the database.
|
||||
/// - parameter fetch: A function that fetches and returns the observed
|
||||
/// value from the database.
|
||||
public static func trackingConstantRegion<Value>(
|
||||
_ fetch: @escaping (Database) throws -> Value)
|
||||
-> ValueObservation<ValueReducers.Fetch<Value>>
|
||||
@@ -635,9 +707,9 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
makeReducer: { ValueReducers.Fetch(fetch: fetch) })
|
||||
}
|
||||
|
||||
/// Creates a `ValueObservation` that notifies the values returned by the
|
||||
/// Creates a `ValueObservation` that notifies the value returned by the
|
||||
/// `fetch` function whenever a database transaction has an impact on the
|
||||
/// given regions.
|
||||
/// observed regions.
|
||||
///
|
||||
/// The tracked region *is not* automatically inferred from the requests
|
||||
/// performed in the `fetch` function.
|
||||
@@ -670,8 +742,8 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
/// fetch: { db in ... })
|
||||
///
|
||||
/// - parameter region: A list of observed regions.
|
||||
/// - parameter fetch: A function that fetches the observed value from
|
||||
/// the database.
|
||||
/// - parameter fetch: A function that fetches and returns the observed
|
||||
/// value from the database.
|
||||
public static func tracking<Value>(
|
||||
region: any DatabaseRegionConvertible...,
|
||||
fetch: @escaping (Database) throws -> Value)
|
||||
@@ -680,9 +752,9 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
tracking(regions: region, fetch: fetch)
|
||||
}
|
||||
|
||||
/// Creates a `ValueObservation` that notifies the values returned by the
|
||||
/// Creates a `ValueObservation` that notifies the value returned by the
|
||||
/// `fetch` function whenever a database transaction has an impact on the
|
||||
/// given regions.
|
||||
/// observed regions.
|
||||
///
|
||||
/// The tracked region *is not* automatically inferred from the requests
|
||||
/// performed in the `fetch` function.
|
||||
@@ -715,8 +787,8 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
/// fetch: { db in ... })
|
||||
///
|
||||
/// - parameter regions: A list of observed regions.
|
||||
/// - parameter fetch: A function that fetches the observed value from
|
||||
/// the database.
|
||||
/// - parameter fetch: A function that fetches and returns the observed
|
||||
/// value from the database.
|
||||
public static func tracking<Value>(
|
||||
regions: [any DatabaseRegionConvertible],
|
||||
fetch: @escaping (Database) throws -> Value)
|
||||
@@ -727,7 +799,7 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
makeReducer: { ValueReducers.Fetch(fetch: fetch) })
|
||||
}
|
||||
|
||||
/// Creates a `ValueObservation` that notifies the values returned by the
|
||||
/// Creates a `ValueObservation` that notifies the value returned by the
|
||||
/// `fetch` function whenever a database transaction changes them.
|
||||
///
|
||||
/// For example:
|
||||
@@ -743,8 +815,8 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
/// print("Players have changed")
|
||||
/// })
|
||||
///
|
||||
/// - parameter fetch: A function that fetches the observed value from
|
||||
/// the database.
|
||||
/// - parameter fetch: A function that fetches and returns the observed
|
||||
/// value from the database.
|
||||
public static func tracking<Value>(
|
||||
_ fetch: @escaping (Database) throws -> Value)
|
||||
-> ValueObservation<ValueReducers.Fetch<Value>>
|
||||
@@ -753,4 +825,70 @@ extension ValueObservation where Reducer == ValueReducers.Auto {
|
||||
trackingMode: .nonConstantRegionRecordedFromSelection,
|
||||
makeReducer: { ValueReducers.Fetch(fetch: fetch) })
|
||||
}
|
||||
|
||||
/// Creates a `ValueObservation` that notifies the value returned by the
|
||||
/// `fetch` function whenever a database transaction changes them.
|
||||
///
|
||||
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
||||
///
|
||||
/// For example:
|
||||
///
|
||||
/// let observation = ValueObservation.trackingSnapshots { db, snapshot in
|
||||
/// ...
|
||||
/// }
|
||||
///
|
||||
/// let cancellable = try observation.start(
|
||||
/// in: dbQueue,
|
||||
/// onError: { error in ... },
|
||||
/// onChange: { trackedValue in
|
||||
/// print("Value has changed")
|
||||
/// })
|
||||
///
|
||||
/// Such an observation requires a ``DatabasePool``.
|
||||
///
|
||||
/// - precondition: The observed region must be constant
|
||||
/// - parameter fetch: A function that fetches and returns the observed
|
||||
/// value from the database. The function arguments are a database
|
||||
/// connection, and a ``DatabaseSnapshot``.
|
||||
public static func trackingSnapshots<Value>(
|
||||
_ fetch: @escaping (Database, DatabaseSnapshot) throws -> Value)
|
||||
-> ValueObservation<ValueReducers.SnapshotFetch<Value>>
|
||||
{
|
||||
.init(
|
||||
trackingMode: .constantRegionRecordedFromSelection,
|
||||
makeReducer: {
|
||||
ValueReducers.SnapshotFetch { db, snapshot in
|
||||
try fetch(db, snapshot)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Creates a `ValueObservation` that notifies the value returned by the
|
||||
/// `fetch` function whenever a database transaction has an impact on the
|
||||
/// observed regions.
|
||||
///
|
||||
/// [**Experimental**](http://github.com/groue/GRDB.swift#what-are-experimental-features)
|
||||
///
|
||||
/// The tracked region *is not* automatically inferred from the requests
|
||||
/// performed in the `fetch` function.
|
||||
///
|
||||
/// Such an observation requires a ``DatabasePool``.
|
||||
///
|
||||
/// - parameter regions: A list of observed regions.
|
||||
/// - parameter fetch: A function that fetches and returns the observed
|
||||
/// value from the database. The function arguments are a database
|
||||
/// connection, and a ``DatabaseSnapshot``.
|
||||
public static func trackingSnapshots<Value>(
|
||||
observedRegions: [any DatabaseRegionConvertible],
|
||||
fetch: @escaping (Database, DatabaseSnapshot) throws -> Value)
|
||||
-> ValueObservation<ValueReducers.SnapshotFetch<Value>>
|
||||
{
|
||||
.init(
|
||||
trackingMode: .constantRegion(observedRegions),
|
||||
makeReducer: {
|
||||
ValueReducers.SnapshotFetch { db, snapshot in
|
||||
try fetch(db, snapshot)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,6 @@
|
||||
563B071221862C3E00B38F35 /* ValueObservationRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 563B071121862C3E00B38F35 /* ValueObservationRecordTests.swift */; };
|
||||
563B071B21862F5600B38F35 /* ValueObservationDatabaseValueConvertibleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 563B071A21862F5600B38F35 /* ValueObservationDatabaseValueConvertibleTests.swift */; };
|
||||
563B533B267E2FA4009549B5 /* TableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 563B5339267E2FA4009549B5 /* TableTests.swift */; };
|
||||
563B8F9B249E74E5007A48C9 /* Trace.swift in Sources */ = {isa = PBXBuildFile; fileRef = 563B8F99249E74E5007A48C9 /* Trace.swift */; };
|
||||
563B8F9E249E8AB0007A48C9 /* ValueObservationPrintTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 563B8F9D249E8AB0007A48C9 /* ValueObservationPrintTests.swift */; };
|
||||
563B8FB224A1CE9E007A48C9 /* DatabasePublishers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 563B8FB024A1CE9E007A48C9 /* DatabasePublishers.swift */; };
|
||||
563B8FBB24A1D036007A48C9 /* ReceiveValuesOn.swift in Sources */ = {isa = PBXBuildFile; fileRef = 563B8FB924A1D036007A48C9 /* ReceiveValuesOn.swift */; };
|
||||
@@ -92,7 +91,15 @@
|
||||
564448861EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564448821EF56B1B00DD2861 /* DatabaseAfterNextTransactionCommitTests.swift */; };
|
||||
5644DE7F20F8D1D1001FFDDE /* DatabaseValueConversionErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5644DE7E20F8D1D1001FFDDE /* DatabaseValueConversionErrorTests.swift */; };
|
||||
564B3D72239BDBD6007BF308 /* DatabaseSuspensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564B3D70239BDBD6007BF308 /* DatabaseSuspensionTests.swift */; };
|
||||
564CE43C21AA955B00652B19 /* ValueConcurrentObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CE43B21AA955B00652B19 /* ValueConcurrentObserver.swift */; };
|
||||
564CD13128C49D13001DB866 /* Fetch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CD12728C49D13001DB866 /* Fetch.swift */; };
|
||||
564CD13228C49D13001DB866 /* Trace.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CD12828C49D13001DB866 /* Trace.swift */; };
|
||||
564CD13328C49D13001DB866 /* ValueReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CD12928C49D13001DB866 /* ValueReducer.swift */; };
|
||||
564CD13428C49D13001DB866 /* Map.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CD12A28C49D13001DB866 /* Map.swift */; };
|
||||
564CD13528C49D13001DB866 /* SnapshotFetch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CD12B28C49D13001DB866 /* SnapshotFetch.swift */; };
|
||||
564CD13628C49D13001DB866 /* RemoveDuplicates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CD12C28C49D13001DB866 /* RemoveDuplicates.swift */; };
|
||||
564CD13728C49D13001DB866 /* ValueSnapshotObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CD12E28C49D13001DB866 /* ValueSnapshotObserver.swift */; };
|
||||
564CD13828C49D13001DB866 /* ValueConcurrentObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CD12F28C49D13001DB866 /* ValueConcurrentObserver.swift */; };
|
||||
564CD13928C49D13001DB866 /* ValueWriteOnlyObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CD13028C49D13001DB866 /* ValueWriteOnlyObserver.swift */; };
|
||||
564CE4E321B2E05400652B19 /* ValueObservationMapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CE4E221B2E05400652B19 /* ValueObservationMapTests.swift */; };
|
||||
564CE5B721B8FBEB00652B19 /* DatabaseRegionObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CE5B521B8FBEA00652B19 /* DatabaseRegionObservation.swift */; };
|
||||
564CE5C621B8FFE600652B19 /* DatabaseRegionObservationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 564CE5C521B8FFE500652B19 /* DatabaseRegionObservationTests.swift */; };
|
||||
@@ -190,7 +197,6 @@
|
||||
5674A7271F30A9090095F066 /* FetchableRecordDecodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5674A7261F30A9090095F066 /* FetchableRecordDecodableTests.swift */; };
|
||||
5676FBAA22F5CEB9004717D9 /* ValueObservationRegionRecordingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5676FBA822F5CEB8004717D9 /* ValueObservationRegionRecordingTests.swift */; };
|
||||
56781B08243F7B5300650A83 /* GRDB-Bridging.h in Headers */ = {isa = PBXBuildFile; fileRef = 56781B06243F7B4B00650A83 /* GRDB-Bridging.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
5679533927E0A305004D18BD /* ValueWriteOnlyObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5679533727E0A305004D18BD /* ValueWriteOnlyObserver.swift */; };
|
||||
567A80561D41350C00C7DCEC /* IndexInfoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567A80521D41350C00C7DCEC /* IndexInfoTests.swift */; };
|
||||
567DAF381EAB789800FC0928 /* DatabaseLogErrorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567DAF341EAB789800FC0928 /* DatabaseLogErrorTests.swift */; };
|
||||
567E420A242AB3CB00CAAD2C /* FailureTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 567E4207242AB3CB00CAAD2C /* FailureTestCase.swift */; };
|
||||
@@ -250,10 +256,6 @@
|
||||
56B964DB1DA5216B0002DA19 /* FTS5RecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B964C11DA521450002DA19 /* FTS5RecordTests.swift */; };
|
||||
56BB6EAB1D3009B100A1CA52 /* SchedulingWatchdog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BB6EA81D3009B100A1CA52 /* SchedulingWatchdog.swift */; };
|
||||
56BF22882417821F003D86EB /* UtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BF22862417821F003D86EB /* UtilsTests.swift */; };
|
||||
56C0539322ACEECD0029D27D /* Fetch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56C0538A22ACEECD0029D27D /* Fetch.swift */; };
|
||||
56C0539722ACEECD0029D27D /* ValueReducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56C0538C22ACEECD0029D27D /* ValueReducer.swift */; };
|
||||
56C0539B22ACEECD0029D27D /* Map.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56C0538E22ACEECD0029D27D /* Map.swift */; };
|
||||
56C0539D22ACEECD0029D27D /* RemoveDuplicates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56C0538F22ACEECD0029D27D /* RemoveDuplicates.swift */; };
|
||||
56C7A6AE1D2DFF6100EFB0C2 /* FoundationNSDateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56F0B98E1B6001C600A2F135 /* FoundationNSDateTests.swift */; };
|
||||
56C9EB9B2495324700FE5D55 /* grdb_config.h in Headers */ = {isa = PBXBuildFile; fileRef = 56C9EB9A2495324700FE5D55 /* grdb_config.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
56CC9234201E009000CB597E /* DropWhileCursorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56CC9231201DFFF600CB597E /* DropWhileCursorTests.swift */; };
|
||||
@@ -490,7 +492,6 @@
|
||||
563B071121862C3E00B38F35 /* ValueObservationRecordTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueObservationRecordTests.swift; sourceTree = "<group>"; };
|
||||
563B071A21862F5600B38F35 /* ValueObservationDatabaseValueConvertibleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueObservationDatabaseValueConvertibleTests.swift; sourceTree = "<group>"; };
|
||||
563B5339267E2FA4009549B5 /* TableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableTests.swift; sourceTree = "<group>"; };
|
||||
563B8F99249E74E5007A48C9 /* Trace.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Trace.swift; sourceTree = "<group>"; };
|
||||
563B8F9D249E8AB0007A48C9 /* ValueObservationPrintTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueObservationPrintTests.swift; sourceTree = "<group>"; };
|
||||
563B8FB024A1CE9E007A48C9 /* DatabasePublishers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabasePublishers.swift; sourceTree = "<group>"; };
|
||||
563B8FB924A1D036007A48C9 /* ReceiveValuesOn.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReceiveValuesOn.swift; sourceTree = "<group>"; };
|
||||
@@ -522,7 +523,15 @@
|
||||
5644DE7E20F8D1D1001FFDDE /* DatabaseValueConversionErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseValueConversionErrorTests.swift; sourceTree = "<group>"; };
|
||||
564A50C61BFF4B7F00B3A3A2 /* DatabaseCollationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseCollationTests.swift; sourceTree = "<group>"; };
|
||||
564B3D70239BDBD6007BF308 /* DatabaseSuspensionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseSuspensionTests.swift; sourceTree = "<group>"; };
|
||||
564CE43B21AA955B00652B19 /* ValueConcurrentObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueConcurrentObserver.swift; sourceTree = "<group>"; };
|
||||
564CD12728C49D13001DB866 /* Fetch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Fetch.swift; sourceTree = "<group>"; };
|
||||
564CD12828C49D13001DB866 /* Trace.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Trace.swift; sourceTree = "<group>"; };
|
||||
564CD12928C49D13001DB866 /* ValueReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueReducer.swift; sourceTree = "<group>"; };
|
||||
564CD12A28C49D13001DB866 /* Map.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Map.swift; sourceTree = "<group>"; };
|
||||
564CD12B28C49D13001DB866 /* SnapshotFetch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SnapshotFetch.swift; sourceTree = "<group>"; };
|
||||
564CD12C28C49D13001DB866 /* RemoveDuplicates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemoveDuplicates.swift; sourceTree = "<group>"; };
|
||||
564CD12E28C49D13001DB866 /* ValueSnapshotObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueSnapshotObserver.swift; sourceTree = "<group>"; };
|
||||
564CD12F28C49D13001DB866 /* ValueConcurrentObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueConcurrentObserver.swift; sourceTree = "<group>"; };
|
||||
564CD13028C49D13001DB866 /* ValueWriteOnlyObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueWriteOnlyObserver.swift; sourceTree = "<group>"; };
|
||||
564CE4E221B2E05400652B19 /* ValueObservationMapTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueObservationMapTests.swift; sourceTree = "<group>"; };
|
||||
564CE5B521B8FBEA00652B19 /* DatabaseRegionObservation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseRegionObservation.swift; sourceTree = "<group>"; };
|
||||
564CE5C521B8FFE500652B19 /* DatabaseRegionObservationTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseRegionObservationTests.swift; sourceTree = "<group>"; };
|
||||
@@ -629,7 +638,6 @@
|
||||
5674A7261F30A9090095F066 /* FetchableRecordDecodableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchableRecordDecodableTests.swift; sourceTree = "<group>"; };
|
||||
5676FBA822F5CEB8004717D9 /* ValueObservationRegionRecordingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueObservationRegionRecordingTests.swift; sourceTree = "<group>"; };
|
||||
56781B06243F7B4B00650A83 /* GRDB-Bridging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "GRDB-Bridging.h"; path = "SQLiteCustom/GRDB-Bridging.h"; sourceTree = "<group>"; };
|
||||
5679533727E0A305004D18BD /* ValueWriteOnlyObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueWriteOnlyObserver.swift; sourceTree = "<group>"; };
|
||||
567A80521D41350C00C7DCEC /* IndexInfoTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IndexInfoTests.swift; sourceTree = "<group>"; };
|
||||
567DAF341EAB789800FC0928 /* DatabaseLogErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseLogErrorTests.swift; sourceTree = "<group>"; };
|
||||
567E4207242AB3CB00CAAD2C /* FailureTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FailureTestCase.swift; sourceTree = "<group>"; };
|
||||
@@ -732,10 +740,6 @@
|
||||
56B964C21DA521450002DA19 /* FTS5TableBuilderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS5TableBuilderTests.swift; sourceTree = "<group>"; };
|
||||
56BB6EA81D3009B100A1CA52 /* SchedulingWatchdog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SchedulingWatchdog.swift; sourceTree = "<group>"; };
|
||||
56BF22862417821F003D86EB /* UtilsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilsTests.swift; sourceTree = "<group>"; };
|
||||
56C0538A22ACEECD0029D27D /* Fetch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Fetch.swift; sourceTree = "<group>"; };
|
||||
56C0538C22ACEECD0029D27D /* ValueReducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValueReducer.swift; sourceTree = "<group>"; };
|
||||
56C0538E22ACEECD0029D27D /* Map.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Map.swift; sourceTree = "<group>"; };
|
||||
56C0538F22ACEECD0029D27D /* RemoveDuplicates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemoveDuplicates.swift; sourceTree = "<group>"; };
|
||||
56C3F7521CF9F12400F6A361 /* DatabaseSavepointTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseSavepointTests.swift; sourceTree = "<group>"; };
|
||||
56C494421ED726C500CC72AF /* GRDBDeploymentTarget.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = GRDBDeploymentTarget.xcconfig; path = SQLiteCustom/GRDBDeploymentTarget.xcconfig; sourceTree = "<group>"; };
|
||||
56C9EB9A2495324700FE5D55 /* grdb_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = grdb_config.h; path = SQLiteCustom/grdb_config.h; sourceTree = "<group>"; };
|
||||
@@ -918,11 +922,10 @@
|
||||
children = (
|
||||
563082E82430B6CD00C14A05 /* DatabaseCancellable.swift */,
|
||||
560233D027243A9100529DF3 /* SharedValueObservation.swift */,
|
||||
564CE43B21AA955B00652B19 /* ValueConcurrentObserver.swift */,
|
||||
5613ED5921A95E6100DC7A68 /* ValueObservation.swift */,
|
||||
563A4B6F242E7CE50075D8CF /* ValueObservationScheduler.swift */,
|
||||
5679533727E0A305004D18BD /* ValueWriteOnlyObserver.swift */,
|
||||
56C0538822ACEECD0029D27D /* ValueReducer */,
|
||||
564CD12D28C49D13001DB866 /* Observers */,
|
||||
564CD12628C49D13001DB866 /* Reducers */,
|
||||
);
|
||||
path = ValueObservation;
|
||||
sourceTree = "<group>";
|
||||
@@ -1105,6 +1108,29 @@
|
||||
path = PublisherExpectations;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
564CD12628C49D13001DB866 /* Reducers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
564CD12728C49D13001DB866 /* Fetch.swift */,
|
||||
564CD12828C49D13001DB866 /* Trace.swift */,
|
||||
564CD12928C49D13001DB866 /* ValueReducer.swift */,
|
||||
564CD12A28C49D13001DB866 /* Map.swift */,
|
||||
564CD12B28C49D13001DB866 /* SnapshotFetch.swift */,
|
||||
564CD12C28C49D13001DB866 /* RemoveDuplicates.swift */,
|
||||
);
|
||||
path = Reducers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
564CD12D28C49D13001DB866 /* Observers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
564CD12E28C49D13001DB866 /* ValueSnapshotObserver.swift */,
|
||||
564CD12F28C49D13001DB866 /* ValueConcurrentObserver.swift */,
|
||||
564CD13028C49D13001DB866 /* ValueWriteOnlyObserver.swift */,
|
||||
);
|
||||
path = Observers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5653EB5620961F8900F46237 /* Association */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1490,18 +1516,6 @@
|
||||
path = Record;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56C0538822ACEECD0029D27D /* ValueReducer */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
56C0538A22ACEECD0029D27D /* Fetch.swift */,
|
||||
56C0538E22ACEECD0029D27D /* Map.swift */,
|
||||
56C0538F22ACEECD0029D27D /* RemoveDuplicates.swift */,
|
||||
563B8F99249E74E5007A48C9 /* Trace.swift */,
|
||||
56C0538C22ACEECD0029D27D /* ValueReducer.swift */,
|
||||
);
|
||||
path = ValueReducer;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
56DAA2C41DE99D8D006E10C8 /* Cursor */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -1826,9 +1840,10 @@
|
||||
5656A8712295BD56001FF3FF /* HasOneThroughAssociation.swift in Sources */,
|
||||
56713FE32691F487006153C3 /* JSONRequiredEncoder.swift in Sources */,
|
||||
56158786288D878500A67323 /* Optional.swift in Sources */,
|
||||
5679533927E0A305004D18BD /* ValueWriteOnlyObserver.swift in Sources */,
|
||||
5636E9BE1D22574100B9B05F /* FetchRequest.swift in Sources */,
|
||||
F3BA80771CFB2E5C003DC1BA /* CGFloat.swift in Sources */,
|
||||
564CD13728C49D13001DB866 /* ValueSnapshotObserver.swift in Sources */,
|
||||
564CD13628C49D13001DB866 /* RemoveDuplicates.swift in Sources */,
|
||||
563B8FBD24A1D388007A48C9 /* OnDemandFuture.swift in Sources */,
|
||||
5656A85D2295BD56001FF3FF /* VirtualTableModule.swift in Sources */,
|
||||
5656A8872295BD56001FF3FF /* SQLOperators.swift in Sources */,
|
||||
@@ -1839,6 +1854,7 @@
|
||||
566B91251FA4CF810012D5B0 /* Database+Schema.swift in Sources */,
|
||||
5656A85F2295BD56001FF3FF /* FTS3+QueryInterface.swift in Sources */,
|
||||
56012B82257404A400B4925B /* CommonTableExpression.swift in Sources */,
|
||||
564CD13128C49D13001DB866 /* Fetch.swift in Sources */,
|
||||
5656A8972295BD56001FF3FF /* SQLRelation.swift in Sources */,
|
||||
56D110FF28AFC9C600E64463 /* MutablePersistableRecord+DAO.swift in Sources */,
|
||||
5659F4921EA8D964004A4992 /* ReadWriteBox.swift in Sources */,
|
||||
@@ -1849,6 +1865,7 @@
|
||||
56894F332604FC1E00268F4D /* Table.swift in Sources */,
|
||||
F3BA80761CFB2E55003DC1BA /* StatementColumnConvertible.swift in Sources */,
|
||||
566B91351FA4D3810012D5B0 /* TransactionObserver.swift in Sources */,
|
||||
564CD13928C49D13001DB866 /* ValueWriteOnlyObserver.swift in Sources */,
|
||||
56CEB4FC1EAA2F4D00BFAF62 /* FTS3.swift in Sources */,
|
||||
5698AD371DABAF4A0056AF8C /* FTS5CustomTokenizer.swift in Sources */,
|
||||
5656A8732295BD56001FF3FF /* QueryInterfaceRequest.swift in Sources */,
|
||||
@@ -1859,7 +1876,6 @@
|
||||
F3BA80691CFB2E55003DC1BA /* DatabasePool.swift in Sources */,
|
||||
F3BA80671CFB2E55003DC1BA /* Database.swift in Sources */,
|
||||
F3BA80901CFB2E7A003DC1BA /* Record.swift in Sources */,
|
||||
56C0539322ACEECD0029D27D /* Fetch.swift in Sources */,
|
||||
56E9FAC42210468500C703A8 /* SQLInterpolation.swift in Sources */,
|
||||
563EF420215F8A76007DAACD /* OrderedDictionary.swift in Sources */,
|
||||
F3BA80721CFB2E55003DC1BA /* Row.swift in Sources */,
|
||||
@@ -1872,8 +1888,10 @@
|
||||
5656A8932295BD56001FF3FF /* SQLFunctions.swift in Sources */,
|
||||
5659F49A1EA8D989004A4992 /* Pool.swift in Sources */,
|
||||
563A4B71242E7CE60075D8CF /* ValueObservationScheduler.swift in Sources */,
|
||||
564CD13828C49D13001DB866 /* ValueConcurrentObserver.swift in Sources */,
|
||||
5674A6F51F307F600095F066 /* EncodableRecord+Encodable.swift in Sources */,
|
||||
5698AC391D9E5A590056AF8C /* FTS3Pattern.swift in Sources */,
|
||||
564CD13328C49D13001DB866 /* ValueReducer.swift in Sources */,
|
||||
56D110E928AFC90800E64463 /* MutablePersistableRecord+Delete.swift in Sources */,
|
||||
5698AD161DAAD16F0056AF8C /* FTS5Tokenizer.swift in Sources */,
|
||||
569BBA4D229170B300478429 /* Inflections+English.swift in Sources */,
|
||||
@@ -1886,7 +1904,6 @@
|
||||
561729562235340E0006E219 /* EncodableRecord.swift in Sources */,
|
||||
5656A87D2295BD56001FF3FF /* SQLAssociation.swift in Sources */,
|
||||
F3BA806F1CFB2E55003DC1BA /* DatabaseValue.swift in Sources */,
|
||||
56C0539722ACEECD0029D27D /* ValueReducer.swift in Sources */,
|
||||
4E13D2F82769BC230037588C /* DatabaseBackupProgress.swift in Sources */,
|
||||
56A2FA3924424F4200E97D23 /* Export.swift in Sources */,
|
||||
56FA0C3728B1F2EB00B2DFF7 /* MutablePersistableRecord+Upsert.swift in Sources */,
|
||||
@@ -1894,7 +1911,6 @@
|
||||
F3BA80731CFB2E55003DC1BA /* RowAdapter.swift in Sources */,
|
||||
56CEB5031EAA2F4D00BFAF62 /* FTS4.swift in Sources */,
|
||||
563B8FB224A1CE9E007A48C9 /* DatabasePublishers.swift in Sources */,
|
||||
56C0539D22ACEECD0029D27D /* RemoveDuplicates.swift in Sources */,
|
||||
F3BA807C1CFB2E61003DC1BA /* Date.swift in Sources */,
|
||||
56A8C2321D1914540096E9D4 /* UUID.swift in Sources */,
|
||||
5656A8812295BD56001FF3FF /* SQLCollection.swift in Sources */,
|
||||
@@ -1903,6 +1919,7 @@
|
||||
F3BA80711CFB2E55003DC1BA /* DatabaseWriter.swift in Sources */,
|
||||
56256EDE25D1BC07008C2BDD /* ForeignKey.swift in Sources */,
|
||||
F3BA80661CFB2E55003DC1BA /* Configuration.swift in Sources */,
|
||||
564CD13528C49D13001DB866 /* SnapshotFetch.swift in Sources */,
|
||||
5656A86B2295BD56001FF3FF /* HasManyAssociation.swift in Sources */,
|
||||
5671FC221DA3CAC9003BF4FF /* FTS3TokenizerDescriptor.swift in Sources */,
|
||||
5656A8852295BD56001FF3FF /* SQLOrdering.swift in Sources */,
|
||||
@@ -1913,10 +1930,10 @@
|
||||
5657AB111D10899D006283EF /* URL.swift in Sources */,
|
||||
56DAA2DD1DE9C827006E10C8 /* Cursor.swift in Sources */,
|
||||
F3BA80681CFB2E55003DC1BA /* DatabaseError.swift in Sources */,
|
||||
564CD13428C49D13001DB866 /* Map.swift in Sources */,
|
||||
5656A8772295BD56001FF3FF /* TableRecord+QueryInterfaceRequest.swift in Sources */,
|
||||
566B912D1FA4D0CC0012D5B0 /* StatementAuthorizer.swift in Sources */,
|
||||
5656A8692295BD56001FF3FF /* AssociationAggregate.swift in Sources */,
|
||||
56C0539B22ACEECD0029D27D /* Map.swift in Sources */,
|
||||
F3BA807E1CFB2E61003DC1BA /* NSNumber.swift in Sources */,
|
||||
5656A8572295BD56001FF3FF /* SQLQueryGenerator.swift in Sources */,
|
||||
5656A8832295BD56001FF3FF /* SQLExpression.swift in Sources */,
|
||||
@@ -1936,14 +1953,13 @@
|
||||
56B964BB1DA51D0A0002DA19 /* FTS5Pattern.swift in Sources */,
|
||||
F3BA807D1CFB2E61003DC1BA /* NSNull.swift in Sources */,
|
||||
56FBFED62210731100945324 /* SQLRequest.swift in Sources */,
|
||||
564CE43C21AA955B00652B19 /* ValueConcurrentObserver.swift in Sources */,
|
||||
564CD13228C49D13001DB866 /* Trace.swift in Sources */,
|
||||
5674A6FC1F307F600095F066 /* FetchableRecord+Decodable.swift in Sources */,
|
||||
F3BA80701CFB2E55003DC1BA /* DatabaseValueConvertible.swift in Sources */,
|
||||
56D110EB28AFC90800E64463 /* MutablePersistableRecord+Insert.swift in Sources */,
|
||||
5656A86F2295BD56001FF3FF /* Association.swift in Sources */,
|
||||
56D110F728AFC90800E64463 /* MutablePersistableRecord+Update.swift in Sources */,
|
||||
56D110ED28AFC90800E64463 /* PersistableRecord+Insert.swift in Sources */,
|
||||
563B8F9B249E74E5007A48C9 /* Trace.swift in Sources */,
|
||||
564D4F93261E1D3300F55856 /* CaseInsensitiveIdentifier.swift in Sources */,
|
||||
56D110F128AFC90800E64463 /* PersistableRecord.swift in Sources */,
|
||||
5698AD231DABAEFA0056AF8C /* FTS5WrapperTokenizer.swift in Sources */,
|
||||
|
||||
Reference in new issue
Block a user