From 1498659b4e337d3e95e0cd4ce76299863a09f7ca Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 12 Jun 2020 10:59:34 +0200 Subject: [PATCH] cleanup Signed-off-by: Wolfgang Bumiller --- src/backup/read_chunk.rs | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/backup/read_chunk.rs b/src/backup/read_chunk.rs index 42b281c7..0a0477ed 100644 --- a/src/backup/read_chunk.rs +++ b/src/backup/read_chunk.rs @@ -1,17 +1,18 @@ -use anyhow::{Error}; use std::sync::Arc; -use super::datastore::*; -use super::crypt_config::*; -use super::data_blob::*; +use anyhow::Error; + +use super::crypt_config::CryptConfig; +use super::data_blob::DataBlob; +use super::datastore::DataStore; /// The ReadChunk trait allows reading backup data chunks (local or remote) pub trait ReadChunk { /// Returns the encoded chunk data - fn read_raw_chunk(&mut self, digest:&[u8; 32]) -> Result; + fn read_raw_chunk(&mut self, digest: &[u8; 32]) -> Result; /// Returns the decoded chunk data - fn read_chunk(&mut self, digest:&[u8; 32]) -> Result, Error>; + fn read_chunk(&mut self, digest: &[u8; 32]) -> Result, Error>; } pub struct LocalChunkReader { @@ -20,16 +21,16 @@ pub struct LocalChunkReader { } impl LocalChunkReader { - pub fn new(store: Arc, crypt_config: Option>) -> Self { - Self { store, crypt_config } + Self { + store, + crypt_config, + } } } impl ReadChunk for LocalChunkReader { - - fn read_raw_chunk(&mut self, digest:&[u8; 32]) -> Result { - + fn read_raw_chunk(&mut self, digest: &[u8; 32]) -> Result { let digest_str = proxmox::tools::digest_to_hex(digest); println!("READ CHUNK {}", digest_str); @@ -41,10 +42,10 @@ impl ReadChunk for LocalChunkReader { Ok(chunk) } - fn read_chunk(&mut self, digest:&[u8; 32]) -> Result, Error> { + fn read_chunk(&mut self, digest: &[u8; 32]) -> Result, Error> { let chunk = self.read_raw_chunk(digest)?; - let raw_data = chunk.decode(self.crypt_config.as_ref().map(Arc::as_ref))?; + let raw_data = chunk.decode(self.crypt_config.as_ref().map(Arc::as_ref))?; // fixme: verify digest?