Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Initial updates for bulk object delete.

  • Loading branch information...
commit 005e5732a53d4c85fa110282003b2de98bc6d403 1 parent bdf2587
Zach Beane authored

Showing 2 changed files with 20 additions and 5 deletions. Show diff stats Hide diff stats

  1. +4 0 crypto.lisp
  2. +16 5 interface.lisp
4 crypto.lisp
@@ -79,6 +79,10 @@
79 79 (defun file-md5/hex (file)
80 80 (ironclad:byte-array-to-hex-string (file-md5 file)))
81 81
  82 +(defun vector-md5/b64 (vector)
  83 + (base64:usb8-array-to-base64-string
  84 + (ironclad:digest-sequence :md5 vector)))
  85 +
82 86 (defun file-etag (file)
83 87 (format nil "\"~A\"" (file-md5/hex file)))
84 88
21 interface.lisp
@@ -459,14 +459,25 @@ constraint."
459 459 :bucket bucket
460 460 :key key)))
461 461
  462 +(defun bulk-delete-document (keys)
  463 + (cxml:with-xml-output (cxml:make-octet-vector-sink)
  464 + (cxml:with-element "Delete"
  465 + (dolist (key keys)
  466 + (cxml:with-element "Object"
  467 + (cxml:with-element "Key"
  468 + (cxml:text key)))))))
  469 +
462 470 (defun delete-objects (bucket keys &key
463 471 ((:credentials *credentials*) *credentials*))
464 472 "Delete the objects in BUCKET identified by KEYS."
465   - (map nil
466   - (lambda (key)
467   - (delete-object bucket key))
468   - keys)
469   - (length keys))
  473 + (let* ((content (bulk-delete-document keys))
  474 + (md5 (vector-md5/b64 content)))
  475 + (submit-request (make-instance 'request
  476 + :method :post
  477 + :sub-resource "delete"
  478 + :bucket bucket
  479 + :content content
  480 + :content-md5 md5))))
470 481
471 482 (defun delete-all-objects (bucket &key
472 483 ((:credentials *credentials*) *credentials*))

0 comments on commit 005e573

Please sign in to comment.
Something went wrong with that request. Please try again.