summaryrefslogtreecommitdiffstats
path: root/src/compaction/delta.rs
diff options
context:
space:
mode:
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 533a7be..ba04799 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
}