pbs-client: avoid mut self in http_client methods.
It is not necessary, so avoid it. The client can now be used with multiple threads (without using a Mutex). Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
@ -329,7 +329,7 @@ async fn change_backup_owner(group: String, mut param: Value) -> Result<(), Erro
|
||||
|
||||
let repo = extract_repository_from_value(¶m)?;
|
||||
|
||||
let mut client = connect(&repo)?;
|
||||
let client = connect(&repo)?;
|
||||
|
||||
param.as_object_mut().unwrap().remove("repository");
|
||||
|
||||
@ -464,7 +464,7 @@ async fn start_garbage_collection(param: Value) -> Result<Value, Error> {
|
||||
|
||||
let output_format = get_output_format(¶m);
|
||||
|
||||
let mut client = connect(&repo)?;
|
||||
let client = connect(&repo)?;
|
||||
|
||||
let path = format!("api2/json/admin/datastore/{}/gc", repo.store());
|
||||
|
||||
@ -472,7 +472,7 @@ async fn start_garbage_collection(param: Value) -> Result<Value, Error> {
|
||||
|
||||
record_repository(&repo);
|
||||
|
||||
view_task_result(&mut client, result, &output_format).await?;
|
||||
view_task_result(&client, result, &output_format).await?;
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -1310,7 +1310,7 @@ async fn prune(
|
||||
) -> Result<Value, Error> {
|
||||
let repo = extract_repository_from_value(¶m)?;
|
||||
|
||||
let mut client = connect(&repo)?;
|
||||
let client = connect(&repo)?;
|
||||
|
||||
let path = format!("api2/json/admin/datastore/{}/prune", repo.store());
|
||||
|
||||
|
@ -171,7 +171,7 @@ async fn forget_snapshots(param: Value) -> Result<Value, Error> {
|
||||
let path = required_string_param(¶m, "snapshot")?;
|
||||
let snapshot: BackupDir = path.parse()?;
|
||||
|
||||
let mut client = connect(&repo)?;
|
||||
let client = connect(&repo)?;
|
||||
|
||||
let path = format!("api2/json/admin/datastore/{}/snapshots", repo.store());
|
||||
|
||||
@ -225,7 +225,7 @@ async fn upload_log(param: Value) -> Result<Value, Error> {
|
||||
let snapshot = required_string_param(¶m, "snapshot")?;
|
||||
let snapshot: BackupDir = snapshot.parse()?;
|
||||
|
||||
let mut client = connect(&repo)?;
|
||||
let client = connect(&repo)?;
|
||||
|
||||
let crypto = crypto_parameters(¶m)?;
|
||||
|
||||
@ -342,7 +342,7 @@ async fn update_notes(param: Value) -> Result<Value, Error> {
|
||||
let notes = required_string_param(¶m, "notes")?;
|
||||
|
||||
let snapshot: BackupDir = path.parse()?;
|
||||
let mut client = connect(&repo)?;
|
||||
let client = connect(&repo)?;
|
||||
|
||||
let path = format!("api2/json/admin/datastore/{}/notes", repo.store());
|
||||
|
||||
@ -438,7 +438,7 @@ async fn update_protection(protected: bool, param: Value) -> Result<(), Error> {
|
||||
let path = required_string_param(¶m, "snapshot")?;
|
||||
|
||||
let snapshot: BackupDir = path.parse()?;
|
||||
let mut client = connect(&repo)?;
|
||||
let client = connect(&repo)?;
|
||||
|
||||
let path = format!("api2/json/admin/datastore/{}/protected", repo.store());
|
||||
|
||||
|
@ -99,9 +99,9 @@ async fn task_log(param: Value) -> Result<Value, Error> {
|
||||
let repo = extract_repository_from_value(¶m)?;
|
||||
let upid = required_string_param(¶m, "upid")?;
|
||||
|
||||
let mut client = connect(&repo)?;
|
||||
let client = connect(&repo)?;
|
||||
|
||||
display_task_log(&mut client, upid, true).await?;
|
||||
display_task_log(&client, upid, true).await?;
|
||||
|
||||
Ok(Value::Null)
|
||||
}
|
||||
@ -125,7 +125,7 @@ async fn task_stop(param: Value) -> Result<Value, Error> {
|
||||
let repo = extract_repository_from_value(¶m)?;
|
||||
let upid_str = required_string_param(¶m, "upid")?;
|
||||
|
||||
let mut client = connect(&repo)?;
|
||||
let client = connect(&repo)?;
|
||||
|
||||
let path = format!("api2/json/nodes/localhost/tasks/{}", percent_encode_component(upid_str));
|
||||
let _ = client.delete(&path, None).await?;
|
||||
|
Reference in New Issue
Block a user