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:
Dietmar Maurer
2021-12-04 14:11:55 +01:00
parent 7549114c9f
commit d4877712f8
8 changed files with 56 additions and 56 deletions

View File

@ -587,7 +587,7 @@ impl HttpClient {
}
pub async fn delete(
&mut self,
&self,
path: &str,
data: Option<Value>,
) -> Result<Value, Error> {
@ -596,7 +596,7 @@ impl HttpClient {
}
pub async fn post(
&mut self,
&self,
path: &str,
data: Option<Value>,
) -> Result<Value, Error> {
@ -605,7 +605,7 @@ impl HttpClient {
}
pub async fn put(
&mut self,
&self,
path: &str,
data: Option<Value>,
) -> Result<Value, Error> {
@ -614,7 +614,7 @@ impl HttpClient {
}
pub async fn download(
&mut self,
&self,
path: &str,
output: &mut (dyn Write + Send),
) -> Result<(), Error> {
@ -651,7 +651,7 @@ impl HttpClient {
}
pub async fn upload(
&mut self,
&self,
content_type: &str,
body: Body,
path: &str,

View File

@ -18,7 +18,7 @@ use super::HttpClient;
/// the user presses CTRL-C. Two interrupts cause an immediate end of
/// the loop. The task may still run in that case.
pub async fn display_task_log(
client: &mut HttpClient,
client: &HttpClient,
upid_str: &str,
strip_date: bool,
) -> Result<(), Error> {
@ -100,7 +100,7 @@ pub async fn display_task_log(
/// Display task result (upid), or view task log - depending on output format
pub async fn view_task_result(
client: &mut HttpClient,
client: &HttpClient,
result: Value,
output_format: &str,
) -> Result<(), Error> {