[openstack-dev] [api] Counting resources

Kevin L. Mitchell kevin.mitchell at rackspace.com
Thu Nov 20 16:39:27 UTC 2014


On Thu, 2014-11-20 at 08:28 -0800, Morgan Fainberg wrote:
> The only thing I want to caution against is making a SQL-specific
> choice. In the case of some other backends, it may not be possible
> (for an extremely large dataset) to get a full count, where SQL does
> this fairly elegantly. For example, LDAP (in some cases) may have an
> administrative limit that will say that no more than 10,000 entries
> would be returned; likely you’re going to have an issue, since you
> need to issue the query and see how many things match, if you hit the
> overall limit you’ll get the same count every time (but possibly a
> different dataset).

Hmmm…interesting limitation.

> I want to be very careful that we’re not recommending functionality as
> a baseline that should be used as a pattern across all similar APIs,
> especially since we have some backends/storage systems that can’t
> elegantly always support it.
> 
> 
> Personally, I like Gerrit’s model (as Sean described) - with the above
> caveat that not all backends support this type of count.

How about if we include some sentinel that can be used to indicate that
count is unsupported, to cover cases such as an LDAP backend?  That
could be as simple as allowing a null value.
-- 
Kevin L. Mitchell <kevin.mitchell at rackspace.com>
Rackspace




More information about the OpenStack-dev mailing list