backup-client: use 1M chunks, make chunk_size configurable

This commit is contained in:
Dietmar Maurer
2018-12-21 08:36:57 +01:00
parent c34eb16651
commit d62e6e2264
3 changed files with 7 additions and 7 deletions

View File

@ -43,9 +43,11 @@ fn backup_file(param: Value, _info: &ApiMethod) -> Result<Value, Error> {
if stat.st_size <= 0 { bail!("got strange file size '{}'", stat.st_size); }
let size = stat.st_size as usize;
let mut index = datastore.create_image_writer(&target, size)?;
let chunk_size = 1024*1024;
tools::file_chunker(file, 64*1024, |pos, chunk| {
let mut index = datastore.create_image_writer(&target, size, chunk_size)?;
tools::file_chunker(file, chunk_size, |pos, chunk| {
index.add_chunk(pos, chunk)?;
Ok(true)
})?;