javauploadopenstack-swiftjclouds

OpenStack Swift Multi Part Upload jclouds


I'm using jclouds Java SDK to interact with the OpenStack resources, I want to upload as multipart yet I didn't find in the SDK how to do that, in the examples I only saw a way to upload multipart but just for the blobs, which is not what I'm using, but nothing for the OpenStack Swift is there anyway to upload multipart to the Swift? keep in mind that I'm using the class PutOptions so I can generate metadata for the file Thanks


Solution

  • jclouds offers two layers to work with: the portable BlobStore layer and the lower-level provider API. You should use the portable layer when possible and can upload multipart via:

    blobStore.putBlob(container, blob, new PutOptions().multipart(true));
    

    If you need to use the lower-level provider API to access some other functionality, you can upload individual parts via SwiftApi.getObjectApi.put then create a SLO manifest via SwiftApi.getStaticLargeObjectApi.replaceManifest. The jclouds provider guide has an example of how to get SwiftApi from ContextBuilder.buildApi.