[openstack-dev] [swift] limit/marker/count behavior when limit not given

Monty Taylor mordred at inaugust.com
Mon Dec 19 00:54:13 UTC 2016


Hey all,

In the docs for listing containers:

http://developer.openstack.org/api-ref/object-storage/?expanded=show-account-details-and-list-containers-detail

it says that limit is optional. However, if you give it
full_listing=True, swiftclient always sends at least a second query with
a marker set to the name of the last element of the original return
value. This leads me believe there is a default value for limit server
side that swiftclient is trying to account for.

Looking through capabilities, it seems there is:

swift.account_listing_limit
swift.container_listing_limit

I'm guessing swift.account_listing_limit would apply to getting the list
of containers, and container_listing_limit would apply to listing
objects in a container, yeah?

Relatedly, there is a X-Account-Container-Count header. Testing against
rackspace public shows me that it contains the total count of containers
even if I provide a limit parameter:

>>> r=c.get('/?format=json&limit=2')
>>> r.headers['X-Account-Container-Count']
'4'

Would that also be the case if I had hit the
swift.account_listing_limit limit?

I ask because it seems like it would be ever-so-mildly more efficient to
look at the returned count and the total count and only do the loop if
there is a mismatch - but I'm curious if there is something I should
account for I'm not seeing. (I'm working on making direct REST calls,
but starting with swiftclient's behavior to make sure I'm doing things
right)

Also - the question about limit behavior when not given seems like it
could be added to the docs - and I'd be happy to make that patch if I'm
reading things right.

Thanks!
Monty



More information about the OpenStack-dev mailing list