From a1e7cff3ea43ea665adcc14dbddfa1566585e056 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 27 May 2019 07:57:43 +0200 Subject: [PATCH] src/api2/admin/datastore/backup/upload_chunk.rs: rename upload_dynamic_chunk into upload_chunk --- src/api2/admin/datastore/backup.rs | 4 ++-- .../admin/datastore/backup/upload_chunk.rs | 19 +++++-------------- src/client/http_client.rs | 4 ++-- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/api2/admin/datastore/backup.rs b/src/api2/admin/datastore/backup.rs index 9f934e91..5c610245 100644 --- a/src/api2/admin/datastore/backup.rs +++ b/src/api2/admin/datastore/backup.rs @@ -146,8 +146,8 @@ fn backup_api() -> Router { let router = Router::new() .subdir( - "dynamic_chunk", Router::new() - .upload(api_method_upload_dynamic_chunk()) + "upload_chunk", Router::new() + .upload(api_method_upload_chunk()) ) .subdir( "dynamic_index", Router::new() diff --git a/src/api2/admin/datastore/backup/upload_chunk.rs b/src/api2/admin/datastore/backup/upload_chunk.rs index c20559cd..68cd5aba 100644 --- a/src/api2/admin/datastore/backup/upload_chunk.rs +++ b/src/api2/admin/datastore/backup/upload_chunk.rs @@ -54,17 +54,10 @@ impl Future for UploadChunk { } } -pub fn api_method_upload_dynamic_chunk() -> ApiAsyncMethod { +pub fn api_method_upload_chunk() -> ApiAsyncMethod { ApiAsyncMethod::new( - upload_dynamic_chunk, - ObjectSchema::new("Upload chunk for dynamic index writer (variable sized chunks).") - .required("wid", IntegerSchema::new("Dynamic writer ID.") - .minimum(1) - .maximum(256) - ) - .required("offset", IntegerSchema::new("Chunk offset (end of chunk).") - .minimum(0) - ) + upload_chunk, + ObjectSchema::new("Upload a new chunk.") .required("size", IntegerSchema::new("Chunk size.") .minimum(1) .maximum(1024*1024*16) @@ -72,7 +65,7 @@ pub fn api_method_upload_dynamic_chunk() -> ApiAsyncMethod { ) } -fn upload_dynamic_chunk( +fn upload_chunk( _parts: Parts, req_body: Body, param: Value, @@ -81,10 +74,8 @@ fn upload_dynamic_chunk( ) -> Result { let size = tools::required_integer_param(¶m, "size")? as u32; - let offset = tools::required_integer_param(¶m, "offset")? as u64; - let wid = tools::required_integer_param(¶m, "wid")? as usize; - println!("upload_dynamic_chunk: {} bytes, offset {}", size, offset); + println!("upload_chunk: {} bytes", size); let env: &BackupEnvironment = rpcenv.as_ref(); diff --git a/src/client/http_client.rs b/src/client/http_client.rs index ea66d33b..a68461a1 100644 --- a/src/client/http_client.rs +++ b/src/client/http_client.rs @@ -652,8 +652,8 @@ impl BackupClient { println!("upload new chunk {} ({} bytes, offset {})", tools::digest_to_hex(&digest), chunk_info.data.len(), offset); - let param = json!({ "wid": wid, "offset": offset, "size" : chunk_info.data.len() }); - let request = H2Client::request_builder("localhost", "POST", "dynamic_chunk", Some(param)).unwrap(); + let param = json!({ "size" : chunk_info.data.len() }); + let request = H2Client::request_builder("localhost", "POST", "upload_chunk", Some(param)).unwrap(); let upload_data = Some(chunk_info.data.freeze()); let new_info = MergedChunkInfo::Known(vec![(chunk_info.offset, chunk_info.digest)]);