diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-01-01 16:36:22 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-01-01 17:45:50 +0200 |
commit | 3eefe4180855f1dd144545fd50eb71d96d798487 (patch) | |
tree | 9e8c82dc41555bfc5aea145ad6d2aca7a74d3866 /src/cmd | |
parent | b5c4df5d31a4624d24171ba70db567327f3aae67 (diff) | |
download | obnam2-3eefe4180855f1dd144545fd50eb71d96d798487.tar.gz |
feat! use signed 64 bit integers as file numbers, file counts
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/backup.rs | 4 | ||||
-rw-r--r-- | src/cmd/restore.rs | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/cmd/backup.rs b/src/cmd/backup.rs index 2a8e086..4d13fe7 100644 --- a/src/cmd/backup.rs +++ b/src/cmd/backup.rs @@ -51,7 +51,7 @@ pub fn backup(config: &ClientConfig, buffer_size: usize) -> anyhow::Result<()> { Some(old) => { info!("incremental backup based on {}", old); let old = client.fetch_generation(&old, &oldname)?; - progress.set_length(old.file_count()?.into()); + progress.set_length(old.file_count()? as u64); new.insert_iter(iter.map(|entry| { progress.inc(1); match entry { @@ -76,7 +76,7 @@ pub fn backup(config: &ClientConfig, buffer_size: usize) -> anyhow::Result<()> { }))?; } } - progress.set_length(new.file_count()); + progress.set_length(new.file_count() as u64); progress.finish(); } diff --git a/src/cmd/restore.rs b/src/cmd/restore.rs index a3594ea..53e168a 100644 --- a/src/cmd/restore.rs +++ b/src/cmd/restore.rs @@ -34,7 +34,7 @@ pub fn restore(config: &ClientConfig, gen_ref: &str, to: &Path) -> anyhow::Resul let gen = client.fetch_generation(&gen_id, &dbname)?; info!("restore file count: {}", gen.file_count()?); - let progress = create_progress_bar(gen.file_count()?.into(), true); + let progress = create_progress_bar(gen.file_count()?, true); for (fileid, entry) in gen.files()? { restore_generation(&client, &gen, fileid, &entry, &to, &progress)?; } @@ -70,7 +70,7 @@ struct Opt { fn restore_generation( client: &BackupClient, gen: &LocalGeneration, - fileid: u64, + fileid: i64, entry: &FilesystemEntry, to: &Path, progress: &ProgressBar, @@ -120,7 +120,7 @@ fn restore_regular( client: &BackupClient, gen: &LocalGeneration, path: &Path, - fileid: u64, + fileid: i64, entry: &FilesystemEntry, ) -> anyhow::Result<()> { debug!("restoring regular {}", path.display()); @@ -191,9 +191,9 @@ fn restore_metadata(path: &Path, entry: &FilesystemEntry) -> anyhow::Result<()> Ok(()) } -fn create_progress_bar(file_count: u64, verbose: bool) -> ProgressBar { +fn create_progress_bar(file_count: i64, verbose: bool) -> ProgressBar { let progress = if verbose { - ProgressBar::new(file_count) + ProgressBar::new(file_count as u64) } else { ProgressBar::hidden() }; |