[openstack-dev] [keystone] Pagination
Jay Pipes
jaypipes at gmail.com
Tue Aug 13 16:17:31 UTC 2013
On 08/13/2013 03:05 AM, Yee, Guang wrote:
> Passing the query parameters, whatever they are, into the driver if the
> given driver supports pagination and allowing the driver to override the
> manager default pagination functionality seem reasonable to me.
Please do use the standards that are supported in other OpenStack
services already: limit, marker, sort_key and sort_dir.
Pagination is meaningless without a sort key and direction, so picking a
sensible default for user/project records is good. I'd go with either
created_at (what Glance/Nova/Cinder use..) or with the user/project UUID.
The Glance DB API pagination is well-documented and clean [1]. I highly
recommend it as a starting point.
Nova uses the same marker/limit/sort_key/sort_dir options for queries
that it allows pagination on. An example is the
instance_get_all_by_filters() call [2].
Cinder uses the same marker/limit/sort_key/sort_dir options for query
pagination as well. [3]
Finally, I'd consider supporting the standard change-since parameter for
listing operations. Both Nova [4] and Glance [5] support the parameter,
which is useful for tools that poll the APIs for "new" events/records.
In short, go with what is already a standard in the other projects...
Best,
-jay
[1]
https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L429
[2]
https://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/api.py#L1709
[3]
https://github.com/openstack/cinder/blob/master/cinder/common/sqlalchemyutils.py#L33
[4]
https://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/api.py#L1766
[5]
https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L618
More information about the OpenStack-dev
mailing list