Skip to content

Commit f914fe7

Browse files
committed
DocC Concurrency Resources
1 parent 57b0751 commit f914fe7

19 files changed

+4
-3
lines changed

GRDB/Documentation.docc/Concurrency.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ Despite the common guarantees and rules shared by database queues and pools, tho
222222

223223
``DatabaseQueue`` opens a single database connection, and serializes all database accesses, reads, and writes. There is never more than one thread that uses the database. In the image below, we see how three threads can see the database as time passes:
224224

225-
![DatabaseQueueScheduling](https://cdn.rawgit.com/groue/GRDB.swift/master/Documentation/Images/DatabaseQueueScheduling.svg)
225+
![DatabaseQueue Scheduling](DatabaseQueueScheduling.png)
226226

227227
``DatabasePool`` manages a pool of several database connections, and allows concurrent reads and writes thanks to the [WAL mode](https://www.sqlite.org/wal.html). A database pool serializes all writes (the <doc:Concurrency#Serialized-Writes> guarantee). Reads are isolated so that they don't see changes performed by other threads (the <doc:Concurrency#Isolated-Reads> guarantee). This gives a very different picture:
228228

229-
![DatabasePoolScheduling](https://cdn.rawgit.com/groue/GRDB.swift/master/Documentation/Images/DatabasePoolScheduling.svg)
229+
![DatabasePool Scheduling](DatabasePoolScheduling.png)
230230

231231
See how, with database pools, two reads can see different database states at the same time. This may look scary! Please see the next chapter below for a relief.
232232

@@ -330,7 +330,8 @@ Both ``DatabaseWriter/concurrentRead(_:)`` and ``DatabasePool/asyncConcurrentRea
330330

331331
In the illustration below, the striped band shows the delay needed for the reading thread to acquire isolation. Until then, no other thread can write:
332332

333-
![DatabasePoolConcurrentRead](https://cdn.rawgit.com/groue/GRDB.swift/master/Documentation/Images/DatabasePoolConcurrentRead.svg)
333+
334+
![DatabasePool Concurrent Read](DatabasePoolConcurrentRead.png)
334335

335336
Types that conform to ``TransactionObserver`` can also use those methods in their ``TransactionObserver/databaseDidCommit(_:)`` method, in order to process database changes without blocking other threads that want to write into the database.
336337

27.3 KB
Loading
70.8 KB
Loading
120 KB
Loading
27.5 KB
Loading
71.2 KB
Loading
120 KB
Loading
32.6 KB
Loading
87.4 KB
Loading
147 KB
Loading

0 commit comments

Comments
 (0)