database: Make 'register-items' transactional.
authorCaleb Ristvedt <caleb.ristvedt@cune.org>
Wed, 30 Jan 2019 23:03:38 +0000 (17:03 -0600)
committerLudovic Courtès <ludo@gnu.org>
Wed, 6 Mar 2019 23:00:18 +0000 (00:00 +0100)
commita4678c6ba18d8dbd79d931f80426eebf61be7ebe
tree166c4efbfaf969347d350d3a2938e4ec366fa61d
parent274fa491001c365cf704beb6ec9e7697df663252
database: Make 'register-items' transactional.

* guix/store/database.scm (SQLITE_BUSY, register-output-sql): New variables.
(add-references): Don't try finalizing after each use, only after all the
uses (otherwise a finalized statement would be used if #:cache? was #f).
(call-with-transaction): New procedure.
(register-items): Use call-with-transaction to prevent broken intermediate
states from being visible.

* .dir-locals.el (call-with-transaction): indent it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
.dir-locals.el
guix/store/database.scm