Page MenuHomePhabricator

D8396.id28304.diff
No OneTemporary

D8396.id28304.diff

diff --git a/services/blob/src/http/handlers/blob.rs b/services/blob/src/http/handlers/blob.rs
--- a/services/blob/src/http/handlers/blob.rs
+++ b/services/blob/src/http/handlers/blob.rs
@@ -85,6 +85,12 @@
blob_hash: String,
}
+#[derive(Deserialize, Debug)]
+pub struct RemoveHolderPayload {
+ holder: String,
+ blob_hash: String,
+}
+
#[derive(Serialize)]
struct AssignHolderResponnse {
data_exists: bool,
@@ -246,18 +252,15 @@
Ok(HttpResponse::NoContent().finish())
}
-#[instrument(
- name = "delete_blob",
- skip_all,
- fields(holder = %params.as_ref().as_str()))
-]
-pub async fn delete_blob_handler(
+#[instrument(name = "remove_holder", skip(ctx))]
+pub async fn remove_holder_handler(
ctx: web::Data<AppContext>,
- params: web::Path<String>,
+ payload: web::Json<RemoveHolderPayload>,
) -> actix_web::Result<HttpResponse> {
- info!("Delete blob request");
- let holder = params.into_inner();
+ info!("Remove holder request");
+ let RemoveHolderPayload { holder, blob_hash } = payload.into_inner();
validate_identifier!(holder);
+ validate_identifier!(blob_hash);
let reverse_index_item = ctx
.db
diff --git a/services/blob/src/http/mod.rs b/services/blob/src/http/mod.rs
--- a/services/blob/src/http/mod.rs
+++ b/services/blob/src/http/mod.rs
@@ -54,13 +54,13 @@
.app_data(web::Data::new(ctx))
.service(
web::resource("/blob/{holder}")
- .route(web::get().to(handlers::blob::get_blob_handler))
- .route(web::delete().to(handlers::blob::delete_blob_handler)),
+ .route(web::get().to(handlers::blob::get_blob_handler)),
)
.service(
web::resource("/blob")
.route(web::put().to(handlers::blob::upload_blob_handler))
- .route(web::post().to(handlers::blob::assign_holder_handler)),
+ .route(web::post().to(handlers::blob::assign_holder_handler))
+ .route(web::delete().to(handlers::blob::remove_holder_handler)),
)
})
.bind(("0.0.0.0", CONFIG.http_port))?

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 4, 3:49 PM (10 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2614468
Default Alt Text
D8396.id28304.diff (1 KB)

Event Timeline