Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for Azure Blob index tags #563

Open
alapierre opened this issue Dec 4, 2024 · 0 comments
Open

add support for Azure Blob index tags #563

alapierre opened this issue Dec 4, 2024 · 0 comments

Comments

@alapierre
Copy link

alapierre commented Dec 4, 2024

Feature description

currently it is only possible to use Metadata on UploadRequest and cannot add tags. In Azure Blob Storage index tags can by used to search blobs, so in many cases Micronaut implementation is useless if one need add tags for search functionality.

With Azure SDK it can be made like:

val blob = blobClient.getBlobClient(path);
            BlobHttpHeaders headers = new BlobHttpHeaders().setContentType("........................");

            BlobParallelUploadOptions options = new BlobParallelUploadOptions(BinaryData.fromStream(source))
                    .setHeaders(headers)
                    .setTags(Map.of("issued", DateTimeFormatter.ofPattern("yyyy-MM-dd").format(attributes.issueDate())));

val r = blob.uploadWithResponse(options, null, null);

I tryed this:

UploadRequest request = UploadRequest
            .fromPath(Path.of("..................pdf")
                    , "blob/path");

        val res = objectStorage.upload(request, options -> {
            options.setTags(Map.of("type", "FS", "issued", "2024-12-01"));
        });

but it not works, probably because of this (tags are not copied):

    private BlockBlobSimpleUploadOptions toBlockBlobSimpleUploadOptions(@NonNull BlobParallelUploadOptions options, @NonNull InputStream inputStream, @NonNull long length) {
        BlockBlobSimpleUploadOptions simpleUploadOptions = new BlockBlobSimpleUploadOptions(new BufferedInputStream(inputStream), length);
        simpleUploadOptions.setMetadata(options.getMetadata());
        simpleUploadOptions.setHeaders(options.getHeaders());
        return simpleUploadOptions;
    }

from AzureBlobStorageOperations

BTW using client.deleteIfExists() is in my opinion bad practice:

  1. by default uploadWithResponse overrides existing blob, according to javadoc: "Creates a new blob, or updates the content of an existing blob"
  2. how it will works with version-level immutability support containers?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant