remote_chunk_reader.rs: use Arc for cache_hint to make clone faster

This commit is contained in:
Dietmar Maurer 2020-09-22 09:51:19 +02:00
parent 796480a38b
commit 7ecfde8150

View File

@ -15,7 +15,7 @@ pub struct RemoteChunkReader {
client: Arc<BackupReader>, client: Arc<BackupReader>,
crypt_config: Option<Arc<CryptConfig>>, crypt_config: Option<Arc<CryptConfig>>,
crypt_mode: CryptMode, crypt_mode: CryptMode,
cache_hint: HashMap<[u8; 32], usize>, cache_hint: Arc<HashMap<[u8; 32], usize>>,
cache: Arc<Mutex<HashMap<[u8; 32], Vec<u8>>>>, cache: Arc<Mutex<HashMap<[u8; 32], Vec<u8>>>>,
} }
@ -33,7 +33,7 @@ impl RemoteChunkReader {
client, client,
crypt_config, crypt_config,
crypt_mode, crypt_mode,
cache_hint, cache_hint: Arc::new(cache_hint),
cache: Arc::new(Mutex::new(HashMap::new())), cache: Arc::new(Mutex::new(HashMap::new())),
} }
} }