src/client/backup_reader.rs: split BackupReader code into separate file

This commit is contained in:
Dietmar Maurer
2019-10-12 12:57:08 +02:00
parent fd04ca7a5a
commit 9e490a7479
5 changed files with 127 additions and 109 deletions

View File

@ -4,7 +4,7 @@ use failure::*;
use chrono::{DateTime, Utc};
use proxmox_backup::client::HttpClient;
use proxmox_backup::client::{HttpClient, BackupReader};
pub struct DummyWriter {
bytes: usize,
@ -33,8 +33,7 @@ async fn run() -> Result<(), Error> {
let backup_time = "2019-06-28T10:49:48Z".parse::<DateTime<Utc>>()?;
let client = client
.start_backup_reader("store2", "host", "elsa", backup_time, true)
let client = BackupReader::start(client, "store2", "host", "elsa", backup_time, true)
.await?;
let start = std::time::SystemTime::now();

View File

@ -479,11 +479,14 @@ fn dump_catalog(
let client = HttpClient::new(repo.host(), repo.user(), None)?;
async_main(async move {
let client = client.start_backup_reader(
let client = BackupReader::start(
client,
repo.store(),
&snapshot.group().backup_type(),
&snapshot.group().backup_id(),
snapshot.backup_time(), true).await?;
snapshot.backup_time(),
true,
).await?;
let backup_index_data = download_index_blob(client.clone(), crypt_config.clone()).await?;
let backup_index: Value = serde_json::from_slice(&backup_index_data[..])?;
@ -1034,9 +1037,7 @@ async fn restore_do(param: Value) -> Result<Value, Error> {
format!("{}.blob", archive_name)
};
let client = client
.start_backup_reader(repo.store(), &backup_type, &backup_id, backup_time, true)
.await?;
let client = BackupReader::start(client, repo.store(), &backup_type, &backup_id, backup_time, true).await?;
let tmpfile = std::fs::OpenOptions::new()
.write(true)
@ -1753,9 +1754,7 @@ async fn mount_do(param: Value, pipe: Option<RawFd>) -> Result<Value, Error> {
bail!("Can only mount pxar archives.");
};
let client = client
.start_backup_reader(repo.store(), &backup_type, &backup_id, backup_time, true)
.await?;
let client = BackupReader::start(client, repo.store(), &backup_type, &backup_id, backup_time, true).await?;
let tmpfile = std::fs::OpenOptions::new()
.write(true)