Expand description
Undo transactions and batched writes.
Every library write goes through a few functions (register_item,
forget_item, save_metadata, save_tags, save_filters). While a
transaction is open they record what they replace: the first pre-edit
copy of each item, the ids of items that did not exist before, and the
metadata, tags and saved filters as last saved. Library::revert puts
that state back and returns the inverse transaction, for redo.
In WriteMode::Batched the same functions only mark what is dirty, and
Library::flush writes each dirty file once. The bytes are the same as
WriteMode::Immediate would have left: every writer serialises the
whole in-memory value, so the last write wins either way.
Structs§
- Flush
Report - What a
Library::flushwrote. - Transaction
- A group of edits that can be reverted together.
Enums§
- Write
Mode - When library writes reach the disk.