src/client/backup_writer.rs: move BackupClient code into extra file

And rename it to BackupWriter.
This commit is contained in:
Dietmar Maurer
2019-10-12 13:53:11 +02:00
parent 913acb41fd
commit cf9271e27c
5 changed files with 583 additions and 562 deletions

View File

@ -180,7 +180,7 @@ fn compute_file_csum(file: &mut std::fs::File) -> Result<([u8; 32], u64), Error>
async fn backup_directory<P: AsRef<Path>>(
client: &BackupClient,
client: &BackupWriter,
dir_path: P,
archive_name: &str,
chunk_size: Option<usize>,
@ -212,7 +212,7 @@ async fn backup_directory<P: AsRef<Path>>(
}
async fn backup_image<P: AsRef<Path>>(
client: &BackupClient,
client: &BackupWriter,
image_path: P,
archive_name: &str,
image_size: u64,
@ -723,9 +723,14 @@ fn create_backup(
};
async_main(async move {
let client = client
.start_backup(repo.store(), backup_type, &backup_id, backup_time, verbose)
.await?;
let client = BackupWriter::start(
client,
repo.store(),
backup_type,
&backup_id,
backup_time,
verbose,
).await?;
let mut file_list = vec![];

View File

@ -13,7 +13,7 @@ async fn upload_speed() -> Result<usize, Error> {
let backup_time = chrono::Utc::now();
let client = client.start_backup(datastore, "host", "speedtest", backup_time, false).await?;
let client = BackupWriter::start(client, datastore, "host", "speedtest", backup_time, false).await?;
println!("start upload speed test");
let res = client.upload_speedtest().await?;