rollback method
Discard pending dirty pages without writing them. The journal is replayed in-place to restore any pages already flushed.
Implementation
Future<void> rollback() async {
_ensureOpen();
// Drop dirty cached pages so the next [read] re-faults the
// pre-transaction image from disk.
for (final p in _dirty) {
_cache.remove(p);
}
_dirty.clear();
if (_journal != null) {
// The journal hasn't been applied yet (commit deletes it); but
// an evicted-while-dirty page may have been written through
// [_evictIfNeeded] — reapply the undo records to undo that.
await _replayJournal(File('$path.journal'));
await _closeAndDeleteJournal();
}
_journaled.clear();
}