src/api2/backup.rs: replace upload_config with upload_blob

This commit is contained in:
Dietmar Maurer
2019-06-23 09:48:23 +02:00
parent a38c5d4d12
commit cb08ac3efe
5 changed files with 50 additions and 31 deletions

View File

@ -24,6 +24,11 @@ impl DataBlob {
&self.raw_data
}
/// Consume self and returns raw_data
pub fn into_inner(self) -> Vec<u8> {
self.raw_data
}
/// accessor to chunk type (magic number)
pub fn magic(&self) -> &[u8; 8] {
self.raw_data[0..8].try_into().unwrap()
@ -42,7 +47,7 @@ impl DataBlob {
}
/// compute the CRC32 checksum
pub fn compute_crc(&mut self) -> u32 {
pub fn compute_crc(&self) -> u32 {
let mut hasher = crc32fast::Hasher::new();
let start = std::mem::size_of::<DataBlobHeader>(); // start after HEAD
hasher.update(&self.raw_data[start..]);