]>
Commit | Line | Data |
---|---|---|
f7d4e4b5 | 1 | use anyhow::{Error}; |
adec8ea2 | 2 | |
2b7f8dd5 WB |
3 | use pbs_client::{HttpClient, HttpClientOptions, BackupWriter}; |
4 | use pbs_api_types::Authid; | |
adec8ea2 | 5 | |
eb13d915 | 6 | async fn upload_speed() -> Result<f64, Error> { |
adec8ea2 DM |
7 | |
8 | let host = "localhost"; | |
9 | let datastore = "store2"; | |
10 | ||
34aa8e13 | 11 | let auth_id = Authid::root_auth_id(); |
adec8ea2 | 12 | |
93e3581c | 13 | let options = HttpClientOptions::default() |
d59dbeca DM |
14 | .interactive(true) |
15 | .ticket_cache(true); | |
16 | ||
34aa8e13 | 17 | let client = HttpClient::new(host, 8007, auth_id, options)?; |
adec8ea2 | 18 | |
6ef1b649 | 19 | let backup_time = proxmox_time::epoch_i64(); |
ca5d0b61 | 20 | |
1a9948a4 | 21 | let client = BackupWriter::start(client, None, datastore, "host", "speedtest", backup_time, false, true).await?; |
adec8ea2 | 22 | |
32e1bf42 | 23 | println!("start upload speed test"); |
eb13d915 | 24 | let res = client.upload_speedtest(true).await?; |
adec8ea2 DM |
25 | |
26 | Ok(res) | |
27 | } | |
28 | ||
d973aa82 | 29 | fn main() { |
9a1b24b6 | 30 | match proxmox_async::runtime::main(upload_speed()) { |
86305579 WB |
31 | Ok(mbs) => { |
32 | println!("average upload speed: {} MB/s", mbs); | |
33 | } | |
34 | Err(err) => { | |
35 | eprintln!("ERROR: {}", err); | |
adec8ea2 | 36 | } |
86305579 | 37 | } |
adec8ea2 | 38 | } |