Repository: jclouds Updated Branches: refs/heads/master 721a0dbd3 -> 3c1588527
Delete parts when removing Swift multipart objects Swift implements multi-part upload with user-visible parts and an explicit manifest. When deleting an MPU blob it can delete only the manifest or both the manifest and parts. For consistency with other providers, we now do the latter in the portable abstraction. Swift ignores the multipart-manifest=delete parameter for single-part objects. Fixes andrewgaul/s3proxy#92. Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/3c158852 Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/3c158852 Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/3c158852 Branch: refs/heads/master Commit: 3c1588527dfc0682faf696186ebc18d29f7ee0da Parents: 721a0db Author: Andrew Gaul <[email protected]> Authored: Fri Nov 13 13:50:30 2015 -0800 Committer: Andrew Gaul <[email protected]> Committed: Tue Nov 17 23:06:33 2015 -0800 ---------------------------------------------------------------------- .../openstack/swift/v1/blobstore/RegionScopedSwiftBlobStore.java | 3 ++- .../blobstore/integration/internal/BaseBlobIntegrationTest.java | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jclouds/blob/3c158852/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStore.java ---------------------------------------------------------------------- diff --git a/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStore.java b/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStore.java index 692401c..ac326ff 100644 --- a/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStore.java +++ b/apis/openstack-swift/src/main/java/org/jclouds/openstack/swift/v1/blobstore/RegionScopedSwiftBlobStore.java @@ -344,7 +344,8 @@ public class RegionScopedSwiftBlobStore implements BlobStore { @Override public void removeBlob(String container, String name) { - api.getObjectApi(regionId, container).delete(name); + // use SLO API to delete blob regardless of whether its a single- or multi-part object + api.getStaticLargeObjectApi(regionId, container).delete(name); } @Override http://git-wip-us.apache.org/repos/asf/jclouds/blob/3c158852/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java ---------------------------------------------------------------------- diff --git a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java index cdcdec6..75eb17a 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/integration/internal/BaseBlobIntegrationTest.java @@ -943,6 +943,10 @@ public class BaseBlobIntegrationTest extends BaseBlobStoreIntegrationTest { assertThat(ByteStreams2.toByteArrayAndClose(newBlob.getPayload().openStream())).isEqualTo(byteSource.read()); checkContentMetadata(newBlob); checkUserMetadata(newBlob.getMetadata().getUserMetadata(), blob.getMetadata().getUserMetadata()); + + // ensure that deleting multi-part manifest deletes any user-visible parts + blobStore.removeBlob(container, name); + assertThat(blobStore.list(container)).isEmpty(); } finally { returnContainer(container); }
