From 913acb41fdb23208d010e024649447f5eb259ad6 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 12 Oct 2019 13:26:47 +0200 Subject: [PATCH] src/client/backup_reader.rs: add documentation --- src/client/backup_reader.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/client/backup_reader.rs b/src/client/backup_reader.rs index a0e504ae..226340fe 100644 --- a/src/client/backup_reader.rs +++ b/src/client/backup_reader.rs @@ -11,7 +11,7 @@ use crate::tools::futures::Canceller; use super::{HttpClient, H2Client}; -/// Backup +/// Backup Reader pub struct BackupReader { h2: H2Client, canceller: Canceller, @@ -30,6 +30,7 @@ impl BackupReader { Arc::new(Self { h2, canceller }) } + /// Create a new instance by upgrading the connection at '/api2/json/reader' pub async fn start( client: HttpClient, datastore: &str, @@ -53,6 +54,7 @@ impl BackupReader { Ok(BackupReader::new(h2, canceller)) } + /// Execute a GET request pub async fn get( &self, path: &str, @@ -61,6 +63,7 @@ impl BackupReader { self.h2.get(path, param).await } + /// Execute a PUT request pub async fn put( &self, path: &str, @@ -69,6 +72,7 @@ impl BackupReader { self.h2.put(path, param).await } + /// Execute a POST request pub async fn post( &self, path: &str, @@ -77,6 +81,7 @@ impl BackupReader { self.h2.post(path, param).await } + /// Execute a GET request and send output to a writer pub async fn download( &self, file_name: &str, @@ -87,6 +92,9 @@ impl BackupReader { self.h2.download(path, Some(param), output).await } + /// Execute a special GET request and send output to a writer + /// + /// This writes random data, and is only useful to test download speed. pub async fn speedtest( &self, output: W, @@ -94,6 +102,7 @@ impl BackupReader { self.h2.download("speedtest", None, output).await } + /// Download a specific chunk pub async fn download_chunk( &self, digest: &[u8; 32],