chetanmeh commented on issue #3356: Add method to delete attachment to 
ArtifactStore
URL: 
https://github.com/apache/incubator-openwhisk/issues/3356#issuecomment-368923722
 
 
   Currently when any entity is deleted we do not have entity instance. So this 
would make it tricky to implement `deleteAttachment(docInfo, name)`. Instead we 
can have a method like
   
   ```
   protected[core] def deleteAttachments[T](doc: DocInfo)(
       implicit transid: TransactionId): Future[Boolean]
   ```
   Here the `ArtifactStore` implementation can remove all attachments related 
to the given docId. This requires that
   1. custom `AttachmentStore` (probably a new SPI for later) stores attachment 
with blob id set to "${doc.id.id}/$name"
   2. Delete operation can be implemented by removing all blobs with id 
starting with document id
   
   This may involve multiple calls depending on `AttachmentStore`  
implementation. 
   
   ### S3
   
   S3 does not provide a direct call to [delete by prefix][1]. Instead we need 
to 
   
   1. first [list blobid][2] matching given prefix 
   2. Delete then via [multiple delete support][3]
   
   ### Azure Blob Storage
   
   It does not support performing multiple deletes in single call. Instead we 
would need to 
   
   1. [List Blobs][4] matching given prefix
   2. Delete then [one by one][5]
   
   [1]: 
https://stackoverflow.com/questions/3178685/how-to-delete-lot-of-objects-named-with-common-prefix-from-s3-bucket
   [2]: https://docs.aws.amazon.com/AmazonS3/latest/API/v2-RESTBucketGET.html
   [3]: 
https://docs.aws.amazon.com/AmazonS3/latest/API/multiobjectdeleteapi.html
   [4]: https://docs.microsoft.com/en-us/rest/api/storageservices/list-blobs
   [5]: https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to