> On Oct 31, 2016, at 2:31 AM, Brendan Duddridge <
bren...@gmail.com> wrote:
>
> Is the [CBLManager close] method synchronous or asynchronous?
Synchronous. Everything that’s async should either have ‘async’ in the method name, or else have start/stop methods like replications.
> And I know that when the CBLManager closes its database, it checkpoints the WAL file and deletes the db.sqlite-shm and db.sqlite-wal files. But if the app terminates prematurely before that completes, that could cause a partial write into the db.sqlite file as the checkpoint process is being run.
What you’re describing is SQLite’s housekeeping when it closes a database, not anything CBL is doing explicitly. And like everything else SQLite does, it should be crash-proof. If it’s interrupted in the middle of an operation like flushing the WAL, the data is still intact.
—Jens