move channel/stream helpers to pbs-tools

pbs_tools
  ::blocking: std/async wrapping with block_in_place
  ::stream: stream <-> AsyncRead/AsyncWrite wrapping

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2021-07-20 11:26:29 +02:00
parent 3c8c2827cb
commit fc5870be53
9 changed files with 239 additions and 161 deletions

View File

@ -79,7 +79,6 @@ use pbs_tools::json;
use proxmox_backup::backup::{
BufferedDynamicReader,
};
use proxmox_backup::tools;
mod proxmox_backup_client;
use proxmox_backup_client::*;
@ -487,7 +486,7 @@ fn spawn_catalog_upload(
encrypt: bool,
) -> Result<CatalogUploadResult, Error> {
let (catalog_tx, catalog_rx) = std::sync::mpsc::sync_channel(10); // allow to buffer 10 writes
let catalog_stream = tools::StdChannelStream(catalog_rx);
let catalog_stream = pbs_tools::blocking::StdChannelStream(catalog_rx);
let catalog_chunk_size = 512*1024;
let catalog_chunk_stream = ChunkStream::new(catalog_stream, Some(catalog_chunk_size));