Skip to content

Commit feebc07

Browse files
committed
Documentation
1 parent 80c15c6 commit feebc07

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

GRDB/ValueObservation/ValueConcurrentObserver.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ extension ValueConcurrentObserver {
192192
(self.notificationCallbacks, self.databaseAccess)
193193
}
194194
guard let notificationCallbacks = notificationCallbacksOpt, let databaseAccess = databaseAccessOpt else {
195-
// Likely a GRDB bug
195+
// Likely a GRDB bug: during a synchronous start, user is not
196+
// able to cancel observation.
196197
fatalError("can't start a cancelled or failed observation")
197198
}
198199

GRDB/ValueObservation/ValueWriteOnlyObserver.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ extension ValueWriteOnlyObserver {
155155
(self.notificationCallbacks, self.databaseAccess)
156156
}
157157
guard let notificationCallbacks = notificationCallbacksOpt, let writer = databaseAccessOpt?.writer else {
158-
// Likely a GRDB bug
158+
// Likely a GRDB bug: during a synchronous start, user is not
159+
// able to cancel observation.
159160
fatalError("can't start a cancelled or failed observation")
160161
}
161162

@@ -199,7 +200,8 @@ extension ValueWriteOnlyObserver {
199200
try writer.unsafeReentrantWrite { db in
200201
// Fetch & Start observing the database
201202
guard let fetchedValue = try fetchAndStartObservation(db) else {
202-
// Likely a GRDB bug
203+
// Likely a GRDB bug: during a synchronous start, user is not
204+
// able to cancel observation.
203205
fatalError("can't start a cancelled or failed observation")
204206
}
205207

@@ -259,6 +261,9 @@ extension ValueWriteOnlyObserver {
259261

260262
/// Fetches the initial value, and start observing the database.
261263
///
264+
/// Returns nil if the observation was cancelled before database observation
265+
/// could start.
266+
///
262267
/// By grouping the initial fetch and the beginning of observation in a
263268
/// single database access, we are sure that no concurrent write can happen
264269
/// during the initial fetch, and that we won't miss any future change.

0 commit comments

Comments
 (0)