javaopenstack-swiftjclouds

Uploading to OpenStack Multipart With Path


I'm using java Jclouds to upload to a container inside an OpenStack Swift, the upload is going fine on the root, but when i pass a path(contains folders then the file), the file is uploaded but also creates another folder with the same name of the file. the original file name is 8mb.bin

the code is:

try {
    ByteSource fileBytes = Files.asByteSource(file);
    File file = new File(filePath);
    String name = "test/test2/" + file.getName();
    Blob blob = blobStore.blobBuilder(name)
        .userMetadata(ImmutableMap.of("ContentType", contentType, "test", String.valueOf(test)))
        .payload(fileBytes)
        .contentLength(file.length())
        .contentType(contentType)
        .build();

    ///sednig the request
    blobStore.putBlob(ContainerName, blob, multipart());
    return contentLength;    
}

and in the designated path its like this: enter image description here

the folder 8mb.bin has the path inside it /slo/1522766773.076000/8200000/33554432 and then a file called 00000000 with the same size of the original file size.

how to solve this?

Thanks


Solution

  • jclouds implements Swift multipart using Static Large Objects. This has the limitation that parts exist in the same namespace as the manifest and modifying or deleting the parts invalidates the manifest. JCLOUDS-1285 suggests putting the parts in another container to clean up object listing although this requires some extra logic for deletes and overwrites.