libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LIBCLOUD-986) List / Iterate container with prefix for Azure Blob service (This support exists in the other drivers already)
Date Wed, 21 Mar 2018 19:30:00 GMT

    [ https://issues.apache.org/jira/browse/LIBCLOUD-986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16408465#comment-16408465
] 

ASF GitHub Bot commented on LIBCLOUD-986:
-----------------------------------------

GitHub user jhawkinson opened a pull request:

    https://github.com/apache/libcloud/pull/1193

    LIBCLOUD-986: Add prefix option to azure blob list and iterate containers

    ## LIBCLOUD-986: Add prefix filter for list and iterate containers to Azure Blob Storage
Driver
    
    ### Description
    While testing out the libcloud storage abstraction I've come across a curious omission
in driver support. It seems that for many drivers there is additional support for the list_container_objects()
and iterate_container_objects() to support a prefix (or ex_prefix). 
    
    This functionality is not present in the Azure driver for some reason.   I've gone and
checked the list_blobs API and it also supports this functionality as seen here:
    
    https://docs.microsoft.com/en-us/rest/api/storageservices/list-blobs
    
    I've added the support to the AzureBlobsStorageDriver with these changes.
    
    ### Status
    - done, ready for review
    
    ### Checklist
    - [x] [Code linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide)
(required, can be done after the PR checks)
    - [ ] Documentation
    - [x] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
    - [ ] [ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jhawkinson/libcloud LIBCLOUD-986

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/libcloud/pull/1193.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1193
    
----
commit 735c9e645a067da48192f4846502fd50e1feef0b
Author: jhawk <jhawkinson@...>
Date:   2018-03-21T19:08:02Z

    LIBCLOUD-986: Add prefix option to azure blob list and iterate container methods

----


> List / Iterate container with prefix for Azure Blob service (This support exists in the
other drivers already)
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: LIBCLOUD-986
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-986
>             Project: Libcloud
>          Issue Type: Improvement
>          Components: Storage
>            Reporter: Joshua Hawkinson
>            Priority: Major
>
> While testing out the libcloud storage abstraction I've come across a curious omission
in driver support. It seems that for many drivers there is additional support for the {{list_container_objects()}} and
{{iterate_container_objects()}} to support a prefix (or {{ex_prefix)}}. 
> This functionality is not present in the Azure driver for some reason.   I've gone
and checked the list_blobs API and it also supports this functionality as seen here:
> [https://docs.microsoft.com/en-us/rest/api/storageservices/list-blobs]
>  
> I've attempted a quick and dirty patch that seems to work as well.
> {code}
> azure_blobs.py Line 384
> -    def iterate_container_objects(self, container):
> +    def iterate_container_objects(self, container, ex_prefix=None):
>         """
>         @inherits: :class:`StorageDriver.iterate_container_objects`
>         """
>         params = {'restype': 'container',
>                   'comp': 'list',
> +                  'prefix': ex_prefix,
>                   'maxresults': RESPONSES_PER_REQUEST,
>                   'include': 'metadata'}
> Line 419 (Add new function)
>     def list_container_objects(self, container, ex_prefix=None):
>         """
>         Return a list of objects for the given container.
>     
>         :param container: Container instance.
>         :type container: :class:`Container`
>     
>         :param ex_prefix: Only return objects starting with ex_prefix
>         :type ex_prefix: ``str``
>     
>         :return: A list of Object instances.
>         :rtype: ``list`` of :class:`Object`
>         """
>         return list(self.iterate_container_objects(container,
>                                                    ex_prefix=ex_prefix))
>     
>  {code}
>  
> I've just worked around this at a higher level for now. There isn't any urgency on my
end,  but it would be nice if the abstraction was more consistent so I could remove the workaround
code.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message