replace AsyncIndexReader with SeekableCachedChunkReader
admin/datastore reads linearly only, so no need for cache (capacity of 1 basically means no cache except for the currently active chunk). mount can do random access too, so cache last 8 chunks for possibly a mild performance improvement. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
parent
10351f7075
commit
1ef6e8b6a7
|
@ -1182,7 +1182,7 @@ pub fn download_file_decoded(
|
||||||
manifest.verify_file(&file_name, &csum, size)?;
|
manifest.verify_file(&file_name, &csum, size)?;
|
||||||
|
|
||||||
let chunk_reader = LocalChunkReader::new(datastore, None, CryptMode::None);
|
let chunk_reader = LocalChunkReader::new(datastore, None, CryptMode::None);
|
||||||
let reader = AsyncIndexReader::new(index, chunk_reader);
|
let reader = CachedChunkReader::new(chunk_reader, index, 1).seekable();
|
||||||
Body::wrap_stream(AsyncReaderStream::new(reader)
|
Body::wrap_stream(AsyncReaderStream::new(reader)
|
||||||
.map_err(move |err| {
|
.map_err(move |err| {
|
||||||
eprintln!("error during streaming of '{:?}' - {}", path, err);
|
eprintln!("error during streaming of '{:?}' - {}", path, err);
|
||||||
|
@ -1197,7 +1197,7 @@ pub fn download_file_decoded(
|
||||||
manifest.verify_file(&file_name, &csum, size)?;
|
manifest.verify_file(&file_name, &csum, size)?;
|
||||||
|
|
||||||
let chunk_reader = LocalChunkReader::new(datastore, None, CryptMode::None);
|
let chunk_reader = LocalChunkReader::new(datastore, None, CryptMode::None);
|
||||||
let reader = AsyncIndexReader::new(index, chunk_reader);
|
let reader = CachedChunkReader::new(chunk_reader, index, 1).seekable();
|
||||||
Body::wrap_stream(AsyncReaderStream::with_buffer_size(reader, 4*1024*1024)
|
Body::wrap_stream(AsyncReaderStream::with_buffer_size(reader, 4*1024*1024)
|
||||||
.map_err(move |err| {
|
.map_err(move |err| {
|
||||||
eprintln!("error during streaming of '{:?}' - {}", path, err);
|
eprintln!("error during streaming of '{:?}' - {}", path, err);
|
||||||
|
|
|
@ -25,7 +25,7 @@ use proxmox_backup::backup::{
|
||||||
BackupDir,
|
BackupDir,
|
||||||
BackupGroup,
|
BackupGroup,
|
||||||
BufferedDynamicReader,
|
BufferedDynamicReader,
|
||||||
AsyncIndexReader,
|
CachedChunkReader,
|
||||||
};
|
};
|
||||||
|
|
||||||
use proxmox_backup::client::*;
|
use proxmox_backup::client::*;
|
||||||
|
@ -281,7 +281,7 @@ async fn mount_do(param: Value, pipe: Option<Fd>) -> Result<Value, Error> {
|
||||||
let index = client.download_fixed_index(&manifest, &server_archive_name).await?;
|
let index = client.download_fixed_index(&manifest, &server_archive_name).await?;
|
||||||
let size = index.index_bytes();
|
let size = index.index_bytes();
|
||||||
let chunk_reader = RemoteChunkReader::new(client.clone(), crypt_config, file_info.chunk_crypt_mode(), HashMap::new());
|
let chunk_reader = RemoteChunkReader::new(client.clone(), crypt_config, file_info.chunk_crypt_mode(), HashMap::new());
|
||||||
let reader = AsyncIndexReader::new(index, chunk_reader);
|
let reader = CachedChunkReader::new(chunk_reader, index, 8).seekable();
|
||||||
|
|
||||||
let name = &format!("{}:{}/{}", repo.to_string(), path, archive_name);
|
let name = &format!("{}:{}/{}", repo.to_string(), path, archive_name);
|
||||||
let name_escaped = tools::systemd::escape_unit(name, false);
|
let name_escaped = tools::systemd::escape_unit(name, false);
|
||||||
|
|
Loading…
Reference in New Issue