Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
684ea03
Move backup to a non-associated function
sourcefrog Oct 11, 2020
d7ec219
Combine subtree and exclusions to ReadTree:iter_filtered
sourcefrog Oct 11, 2020
fa734dc
Apply exclusions during iterator not in the tree
sourcefrog Oct 11, 2020
80b1858
Support size --exclude and size --bytes
sourcefrog Oct 11, 2020
ae744a1
Clean up declaration of exclusions
sourcefrog Oct 11, 2020
30c4d88
Use Option<GlobSet> for excludes
sourcefrog Oct 11, 2020
0aca76d
Don't need exclusions at the index level
sourcefrog Oct 11, 2020
b0ee766
Simplify backup code
sourcefrog Oct 11, 2020
787395c
Remove old comment
sourcefrog Oct 11, 2020
e075bc0
Add todo
sourcefrog Oct 12, 2020
2650793
Refactor backup towards processing group-at-a-time
sourcefrog Oct 17, 2020
b2af71e
Move StoreFiles to backup.rs
sourcefrog Oct 18, 2020
08036fd
Remove StoreFiles
sourcefrog Oct 18, 2020
31cf015
Add a test for splitting backups across hunks
sourcefrog Oct 18, 2020
cd0ca30
Check names in many-file tree
sourcefrog Oct 18, 2020
e53a69d
Move responsibility for breaking index hunks to backup
sourcefrog Oct 18, 2020
aea784a
Tidy up
sourcefrog Oct 18, 2020
6a8367e
Add FileCombiner
sourcefrog Oct 18, 2020
63840e9
More progress towards combining small files
sourcefrog Oct 25, 2020
21a493c
Further refactor towards combining files
sourcefrog Oct 25, 2020
ba4a33b
Sort entries just before writing index hunks
sourcefrog Oct 29, 2020
2656da0
Clippy cleanups
sourcefrog Oct 29, 2020
dcd8c8c
Update TODOs
sourcefrog Oct 30, 2020
d664709
Simplify
sourcefrog Oct 30, 2020
39facb6
Actually combine small files
sourcefrog Oct 30, 2020
86a534a
Simplify backup stats formatting
sourcefrog Oct 30, 2020
3563cf5
Cope with short reads during backups
sourcefrog Nov 1, 2020
9627d37
Directly store empty files
sourcefrog Nov 1, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ crossterm = "0.17.5"
derive_more = "0.99.7"
globset = "0.4.5"
hex = "0.4.2"
itertools = "0.9.0"
lazy_static = "1.4.0"
rayon = "1.3.0"
regex = "1.3.9"
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Conserve release history

## v0.6.9 NOT RELEASED YET

### Features

- New option `conserve size --bytes` gives output in bytes, rather than
megabytes.

### Performance

- Reading a subtree of a local source is faster, because it no longer reads and
discards the whole tree.

## v0.6.8 2020-10-16

### Features
Expand Down
22 changes: 2 additions & 20 deletions src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use std::sync::Mutex;
use rayon::prelude::*;
use serde::{Deserialize, Serialize};

use crate::backup::BackupOptions;
use crate::blockhash::BlockHash;
use crate::copy_tree::CopyOptions;
use crate::errors::Error;
Expand Down Expand Up @@ -115,27 +114,9 @@ impl Archive {
})
}

/// Backup a source directory into a new band in the archive.
///
/// Returns statistics about what was copied.
pub fn backup(&self, source_path: &Path, options: &BackupOptions) -> Result<CopyStats> {
let live_tree = LiveTree::open(source_path)?.with_excludes(options.excludes.clone());
let writer = BackupWriter::begin(self)?;
copy_tree(
&live_tree,
writer,
&CopyOptions {
print_filenames: options.print_filenames,
measure_first: false,
..CopyOptions::default()
},
)
}

/// Restore a selected version, or by default the latest, to a destination directory.
pub fn restore(&self, destination_path: &Path, options: &RestoreOptions) -> Result<CopyStats> {
let st = self.open_stored_tree(options.band_selection.clone())?;
let st = st.with_excludes(options.excludes.clone());
let rt = if options.overwrite {
RestoreTree::create_overwrite(destination_path)
} else {
Expand All @@ -144,6 +125,7 @@ impl Archive {
let opts = CopyOptions {
print_filenames: options.print_filenames,
only_subtree: options.only_subtree.clone(),
excludes: options.excludes.clone(),
..CopyOptions::default()
};
copy_tree(&st, rt, &opts)
Expand Down Expand Up @@ -385,7 +367,7 @@ impl Archive {
}
stats
})
.reduce(|| ValidateStats::default(), |a, b| a + b);
.reduce(ValidateStats::default, |a, b| a + b);

Ok(stats)
}
Expand Down
Loading