src/backup/archive_index.rs: use close() instead of flush()

Also pass a reference to the encoder.
This commit is contained in:
Dietmar Maurer
2019-01-02 11:02:56 +01:00
parent 94a882e900
commit 5e7a09be0d
5 changed files with 69 additions and 61 deletions

View File

@ -36,18 +36,13 @@ fn backup_dir(
target.set_extension("aidx");
}
// fixme: implement chunked writer
// let writer = std::fs::OpenOptions::new()
// .create(true)
// .write(true)
// .truncate(true)
// .open("mytest.catar")?;
let index = datastore.create_archive_writer(&target, chunk_size)?;
let mut index = datastore.create_archive_writer(&target, chunk_size)?;
let path = std::path::PathBuf::from(path);
CaTarEncoder::encode(path, dir, index)?;
CaTarEncoder::encode(path, dir, &mut index)?;
index.close()?; // commit changes
Ok(())
}