summaryrefslogtreecommitdiffstats
path: root/src/compaction/delta.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-20 03:09:21 +0200
committertv <tv@krebsco.de>2026-10-20 03:09:21 +0200
commite411c9e993f6936ad2787f53ac00fae9f0a6b0f9 (patch)
treebee97b809a854c99006673a5a0bf0b5c34340184 /src/compaction/delta.rs
parentc8d04d733b8d01e23ccd959ea4a839d22b70229b (diff)
replace snapshots by quarantine & replay
Diffstat (limited to 'src/compaction/delta.rs')
-rw-r--r--src/compaction/delta.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/compaction/delta.rs b/src/compaction/delta.rs
index 0026796..609b330 100644
--- a/src/compaction/delta.rs
+++ b/src/compaction/delta.rs
@@ -39,15 +39,25 @@ pub(crate) fn replay(
after: &[ChangeHash],
dst: &mut AutoCommit,
) -> ReplayStats {
- let mut stats = ReplayStats::default();
if before == after {
- return stats;
+ return ReplayStats::default();
}
- for path in changed_paths(src, before, after) {
- replay_path(src, dst, &path, &mut stats);
- }
+ let paths = changed_paths(src, before, after);
+ replay_paths(src, dst, &paths)
+}
+/// Replays the state of `paths` (from [`changed_paths`]) from `src` into `dst`, as one
+/// commit. Lets callers find the paths outside a lock and copy them inside it.
+pub(crate) fn replay_paths(
+ src: &AutoCommit,
+ dst: &mut AutoCommit,
+ paths: &[Vec<String>],
+) -> ReplayStats {
+ let mut stats = ReplayStats::default();
+ for path in paths {
+ replay_path(src, dst, path, &mut stats);
+ }
let _ = dst.commit();
stats
}