openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #01372
Re: Problems with path, prefix and delimiter with Object Storage
On Thu, 2011-03-17 at 08:42 -0500, John Dickinson wrote:
> A path query requires directory marker objects to be present (http://docs.openstack.org/openstack-object-storage/developer/content/ch03s02.html#d5e514)
After reading the documentation again, I can see what you mean, but it
isn't very obvious!
Perhaps we should change the documentation to say explicitly to use
prefix+delimiter and not path+delimiter?
Having an example with delimiter in the same section as the path example
is misleading, and there is no example of using prefix with delimiter.
> I would recommend using prefix+delimiter over path. Path query
> parameters are in swift to support backwards compatibility with
> the original Cloud Files API.
This was the conclusion we came too as well, instead of using
path="blah", use prefix="blah/", delimiter="/".
Maybe Anne could do something about this!
Regards,
Juan
> --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@xxxxxxxxxx
> > 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@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~openstack
> > More help : https://help.launchpad.net/ListHelp
>
--
Juan J. Martinez
Development, MEMSET
mail: juan@xxxxxxxxxx
web: http://www.memset.com/
Memset Ltd., registration number 4504980. 25 Frederick Sanger Road, Guildford, Surrey, GU2 7YD, UK.
Follow ups
References