pub fn in_snapshot<T>(
conn: &Connection,
f: impl FnOnce() -> Result<T, String>,
) -> Result<T, String>Expand description
As load_ents, optionally leaving out each entry’s version_history, which
is up to 50 revisions of secret material per entry and is not wanted by a
selective read.
Runs f against one consistent snapshot of the database.
A load is several statements (rows, then history; token, rows, accumulator for the
integrity check). Run as separate autocommit statements, a save landing between them
gave a document whose history belonged to a different version than its rows (and a
writer that then saved that copy lost a rotation record), or an integrity check that
reported tampering on a healthy vault. Inside a caller’s own transaction this just
runs f: that transaction is already one snapshot.