[Openstack] Problems with path, prefix and delimiter with Object Storage

John Dickinson john.dickinson at rackspace.com
Thu Mar 17 13:42:35 UTC 2011


A path query requires directory marker objects to be present (http://docs.openstack.org/openstack-object-storage/developer/content/ch03s02.html#d5e514)

I would recommend using prefix+delimiter over path. Path query parameters are in swift to support backwards compatibility with the original Cloud Files API.

--John

On Mar 17, 2011, at 8:12 AM, Juan J. Martínez wrote:

> Hello,
> 
> We're having problems with the behaviour of path, prefix and delimiter
> parameters when calling list_objects, get_objects, etc; using
> python-cloudfiles and the Bexar release.
> 
> I'm asking here because we don't know if this is a bug or the
> documentation is wrong [1].
> 
> We're dealing with pseudo-hierarchical folders/directories, and when
> setting path we're not getting pseudo-directories (as the documentation
> seems to suggest with the given example).
> 
> We're trying the following case:
> 
> test/a/b/c.txt
> test/a/b/a.txt
> test/a/b.txt
> test/a.txt
> 
> That means: 4 files, and 2 different pseudo-directories (using test/ as
> root for the tests).
> 
> a. list_objects(prefix='test/')
> 
> ['test/a.txt', 'test/a/b.txt', 'test/a/b/a.txt', 'test/a/b/c.txt']
> 
> 4 files, as expected.
> 
> b. list_objects(prefix='test/', delimiter='/')
> 
> ['test/a.txt', 'test/a/']
> 
> 1 file and 1 pseudo-directory, as you can see with 'subdir':
> 
> c.list_objects_info(prefix='test/', delimiter='/')
> 
> [{u'bytes': 13, u'last_modified': u'2011-03-17T11:46:03.596480',
> u'hash': u'e6a394bb2cdb1a7b044b37a48e024b2c', u'name': u'test/a.txt',
> u'content_type': u'text/plain'}, {u'subdir': u'test/a/'}]
> 
> c. list_objects(path='test')
> 
> ['test/a.txt']
> 
> It's not returning any pseudo-directory (and according to common/db.py
> it can't).
> 
> So our problem is 'path' query parameter. Is this the expected behaviour
> or is it a bug?
> 
> Note: checking the code, path implies that prefix=path and
> delimiter='/'; and path won't return any pseudo-directories as shown in
> b).
> 
> If someone can explain the path behaviour maybe we should provide a
> patch for the documentation, or submit a bug. Thanks!
> 
> Kind regards,
> 
> Juan
> 
> [1]:
> http://docs.openstack.org/openstack-object-storage/developer/content/ch03s02.html#d5e407
> 
> -- 
> Juan J. Martínez
> Development, MEMSET
> 
> mail: juan at memset.com
> web: http://www.memset.com/
> 
> Memset Ltd., registration number 4504980. 25 Frederick Sanger Road, Guildford, Surrey, GU2 7YD, UK.
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack at lists.launchpad.net
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4245 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20110317/295900b9/attachment.bin>


More information about the Openstack mailing list