AiiB

technology / storage

Storage

Data is stored in SQLite on your device. Slide edits are also appended to a log of what changed, so the latest state can be restored if the app or device stops suddenly.

database

Database

engine
SQLite (bundled in the app)
journal_mode
WAL
synchronous
NORMAL
foreign_keys
ON
busy_timeout
5000 ms

edit log

Edit log

Slide edits are stored as an append-only log per version. On open, state is rebuilt from the log and compared with the saved document.

unit
Yjs updates appended per version
flush interval
1000 ms
merge
Pending updates combined with Y.mergeUpdates
compaction
Compacted after a certain amount
  • Crash recovery

    If the log is newer, edits from a crashed tab are restored.

  • Detecting outside changes

    If the saved document is newer and differs, the log is rebuilt.

shutdown

Shutdown

Even when the app ends some way other than closing the window, unsaved content is written before exit.

macOS
Answers applicationShouldTerminate: with NSTerminateLater and exits after saving
Windows
Requests a save on WM_QUERYENDSESSION and registers a reason with ShutdownBlockReasonCreate
timeout
4000 ms (exit takes priority after that)

integrity

Integrity and backups

backup
A consistent copy made with VACUUM INTO when the app updates
retention
Latest 3 generations
check
PRAGMA quick_check (on update and every 7 days)
on failure
Preserve a copy of the damaged file and notify in the interface