6a7be83efe
- remove chrono dependency - depend on proxmox 0.3.8 - remove epoch_now, epoch_now_u64 and epoch_now_f64 - remove tm_editor (moved to proxmox crate) - use new helpers from proxmox 0.3.8 * epoch_i64 and epoch_f64 * parse_rfc3339 * epoch_to_rfc3339_utc * strftime_local - BackupDir changes: * store epoch and rfc3339 string instead of DateTime * backup_time_to_string now return a Result * remove unnecessary TryFrom<(BackupGroup, i64)> for BackupDir - DynamicIndexHeader: change ctime to i64 - FixedIndexHeader: change ctime to i64
39 lines
942 B
Rust
39 lines
942 B
Rust
use anyhow::{Error};
|
|
|
|
use proxmox_backup::api2::types::Userid;
|
|
use proxmox_backup::client::*;
|
|
|
|
async fn upload_speed() -> Result<f64, Error> {
|
|
|
|
let host = "localhost";
|
|
let datastore = "store2";
|
|
|
|
let username = Userid::root_userid();
|
|
|
|
let options = HttpClientOptions::new()
|
|
.interactive(true)
|
|
.ticket_cache(true);
|
|
|
|
let client = HttpClient::new(host, username, options)?;
|
|
|
|
let backup_time = proxmox::tools::time::epoch_i64();
|
|
|
|
let client = BackupWriter::start(client, None, datastore, "host", "speedtest", backup_time, false, true).await?;
|
|
|
|
println!("start upload speed test");
|
|
let res = client.upload_speedtest(true).await?;
|
|
|
|
Ok(res)
|
|
}
|
|
|
|
fn main() {
|
|
match proxmox_backup::tools::runtime::main(upload_speed()) {
|
|
Ok(mbs) => {
|
|
println!("average upload speed: {} MB/s", mbs);
|
|
}
|
|
Err(err) => {
|
|
eprintln!("ERROR: {}", err);
|
|
}
|
|
}
|
|
}
|