summaryrefslogtreecommitdiff
path: root/src/cmd/backup.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-02-06 18:03:49 +0200
committerLars Wirzenius <liw@liw.fi>2021-02-06 18:15:44 +0200
commitad98db921aa3d710ad7c448c6a1b818f4359d73a (patch)
tree19a0ed284970b895245a1133af51b8ec0b4b5015 /src/cmd/backup.rs
parentf1d1636beeddd56635f248bd0eb2b5841c65f562 (diff)
downloadobnam2-ad98db921aa3d710ad7c448c6a1b818f4359d73a.tar.gz
feat: use the chunk size setting from the client configuration
Use the chunk_size setting for file data. For the SQLite file, use a hard-coded size instead.
Diffstat (limited to 'src/cmd/backup.rs')
-rw-r--r--src/cmd/backup.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cmd/backup.rs b/src/cmd/backup.rs
index a43a622..fd1d876 100644
--- a/src/cmd/backup.rs
+++ b/src/cmd/backup.rs
@@ -7,10 +7,12 @@ use log::info;
use std::time::SystemTime;
use tempfile::NamedTempFile;
-pub fn backup(config: &ClientConfig, buffer_size: usize) -> Result<(), ObnamError> {
+const SQLITE_CHUNK_SIZE: usize = 1024 * 1024;
+
+pub fn backup(config: &ClientConfig) -> Result<(), ObnamError> {
let runtime = SystemTime::now();
- let run = BackupRun::new(config, buffer_size)?;
+ let run = BackupRun::new(config)?;
// Create a named temporary file. We don't meed the open file
// handle, so we discard that.
@@ -52,7 +54,9 @@ pub fn backup(config: &ClientConfig, buffer_size: usize) -> Result<(), ObnamErro
// Upload the SQLite file, i.e., the named temporary file, which
// still exists, since we persisted it above.
- let gen_id = run.client().upload_generation(&newname, buffer_size)?;
+ let gen_id = run
+ .client()
+ .upload_generation(&newname, SQLITE_CHUNK_SIZE)?;
println!("status: OK");
println!("duration: {}", runtime.elapsed()?.as_secs());
println!("file-count: {}", file_count);