src/backup/data_blob.rs: new load_from_reader(), which verifies the CRC

And make verify_crc private for now. We always call load_from_reader() to
verify the CRC.

Also add load_chunk() to datastore.rs (from chunk_store::read_chunk())
This commit is contained in:
Dietmar Maurer
2020-07-28 10:23:16 +02:00
parent 69d970a658
commit 39f18b30b6
12 changed files with 58 additions and 62 deletions

View File

@ -479,8 +479,7 @@ impl BackupWriter {
let param = json!({ "archive-name": MANIFEST_BLOB_NAME });
self.h2.download("previous", Some(param), &mut raw_data).await?;
let blob = DataBlob::from_raw(raw_data)?;
blob.verify_crc()?;
let blob = DataBlob::load_from_reader(&mut &raw_data[..])?;
let data = blob.decode(self.crypt_config.as_ref().map(Arc::as_ref))?;
let manifest = BackupManifest::from_data(&data[..], self.crypt_config.as_ref().map(Arc::as_ref))?;