diff --git a/shared/comm-lib/src/blob/client.rs b/shared/comm-lib/src/blob/client.rs --- a/shared/comm-lib/src/blob/client.rs +++ b/shared/comm-lib/src/blob/client.rs @@ -21,7 +21,7 @@ }, }; -use super::types::{http::RemoveHoldersResponse, BlobInfo}; +use super::types::http::RemoveHoldersResponse; #[derive(From, Error, Debug, Display)] pub enum BlobServiceError { @@ -242,25 +242,29 @@ /// successfully removed. /// - If one or more removal failed server-side, these will be returned /// in the `failed_requests` response field. It has the same format - /// as this function input and can be directly used to retry removal. + /// as this function input and can be directly used to retry removal, + /// by calling `remove_multiple_holders(failed_requests.into()).await` /// /// For single holder removal, see [`BlobServiceClient::revoke_holder`]. pub async fn remove_multiple_holders( &self, - blob_infos: Vec, + request: RemoveHoldersRequest, ) -> BlobResult { - let num_holders = blob_infos.len(); - debug!(num_holders, "Revoke multiple holders request."); + match &request { + RemoveHoldersRequest::Items { requests, .. } => { + let num_holders = requests.len(); + debug!(num_holders, "Remove multiple holders request."); + } + RemoveHoldersRequest::ByIndexedTags { tags } => { + debug!("Remove holders request for {} tags.", tags.len()); + } + } let url = self.get_holders_url()?; - let payload = RemoveHoldersRequest::Items { - requests: blob_infos, - instant_delete: false, - }; - trace!("Request payload: {:?}", payload); + trace!("Request payload: {:?}", request); let response = self .request(Method::DELETE, url)? - .json(&payload) + .json(&request) .send() .await?; diff --git a/shared/comm-lib/src/blob/types.rs b/shared/comm-lib/src/blob/types.rs --- a/shared/comm-lib/src/blob/types.rs +++ b/shared/comm-lib/src/blob/types.rs @@ -83,6 +83,16 @@ #[serde(default)] pub instant_delete: bool, } + + // impls + impl From> for RemoveHoldersRequest { + fn from(requests: Vec) -> Self { + Self::Items { + requests, + instant_delete: false, + } + } + } } /// Blob owning information - stores both blob_hash and holder