Skip to content

Commit

Permalink
feat(memory): Reduce memory usage of restore
Browse files Browse the repository at this point in the history
  • Loading branch information
aawsome committed Feb 19, 2024
1 parent d20eaaa commit 388715b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ rustdoc-args = ["--document-private-items", "--generate-link-to-definition"]

[dependencies]
abscissa_core = { version = "0.7.0", default-features = false, features = ["application"] }
rustic_backend = { git = "https://github.com/rustic-rs/rustic_core.git", features = ["cli"] }
rustic_core = { git = "https://github.com/rustic-rs/rustic_core.git", features = ["cli"] }
rustic_backend = { git = "https://github.com/rustic-rs/rustic_core.git", branch = "drop-index", features = ["cli"] }
rustic_core = { git = "https://github.com/rustic-rs/rustic_core.git", branch = "drop-index", features = ["cli"] }

# allocators
jemallocator-global = { version = "0.3.2", optional = true }
Expand Down
6 changes: 5 additions & 1 deletion src/commands/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl RestoreCmd {

let dest = LocalDestination::new(&self.dest, true, !node.is_dir())?;

let restore_infos = repo.prepare_restore(&self.opts, ls.clone(), &dest, dry_run)?;
let restore_infos = repo.prepare_restore(&self.opts, ls, &dest, dry_run)?;

let fs = restore_infos.stats.files;
println!(
Expand Down Expand Up @@ -94,6 +94,10 @@ impl RestoreCmd {
if dry_run {
repo.warm_up(restore_infos.to_packs().into_iter())?;
} else {
// save some memory
let repo = repo.drop_data_from_index();

let ls = repo.ls(&node, &ls_opts)?;
repo.restore(restore_infos, &self.opts, ls, &dest)?;
println!("restore done.");
}
Expand Down

0 comments on commit 388715b

Please sign in to comment.