diff options
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | src/client.rs | 3 | ||||
-rw-r--r-- | src/cmd/backup.rs | 3 |
3 files changed, 5 insertions, 2 deletions
@@ -12,6 +12,7 @@ repository = "https://gitlab.com/larswirzenius/obnam" [dependencies] anyhow = "1" bytes = "0.5" +bytesize = "1" chrono = "0.4" dirs = "3" indicatif = "0.15" diff --git a/src/client.rs b/src/client.rs index e4d9be8..a475ce9 100644 --- a/src/client.rs +++ b/src/client.rs @@ -8,6 +8,7 @@ use crate::fsentry::{FilesystemEntry, FilesystemKind}; use crate::generation::{FinishedGeneration, LocalGeneration, LocalGenerationError}; use crate::genlist::GenerationList; +use bytesize::MIB; use chrono::{DateTime, Local}; use log::{debug, error, info, trace}; use reqwest::blocking::Client; @@ -17,7 +18,7 @@ use std::fs::File; use std::io::prelude::*; use std::path::{Path, PathBuf}; -const DEFAULT_CHUNK_SIZE: usize = 1024 * 1024; +const DEFAULT_CHUNK_SIZE: usize = MIB as usize; const DEVNULL: &str = "/dev/null"; #[derive(Debug, Serialize, Deserialize, Clone)] diff --git a/src/cmd/backup.rs b/src/cmd/backup.rs index 16d3f69..3f2d7d4 100644 --- a/src/cmd/backup.rs +++ b/src/cmd/backup.rs @@ -4,12 +4,13 @@ use crate::client::{BackupClient, ClientConfig}; use crate::error::ObnamError; use crate::fsiter::FsIterator; use crate::generation::NascentGeneration; +use bytesize::MIB; use log::info; use std::path::{Path, PathBuf}; use std::time::SystemTime; use tempfile::NamedTempFile; -const SQLITE_CHUNK_SIZE: usize = 1024 * 1024; +const SQLITE_CHUNK_SIZE: usize = MIB as usize; pub fn backup(config: &ClientConfig) -> Result<(), ObnamError> { let runtime = SystemTime::now(); |