<html><body>
<p><tt><font size="2">Jay Pipes <jaypipes@gmail.com> wrote on 03/18/2014 12:02:50 PM:<br>
<br>
> From: Jay Pipes <jaypipes@gmail.com></font></tt><br>
<tt><font size="2">> To: openstack-dev@lists.openstack.org, </font></tt><br>
<tt><font size="2">> Date: 03/18/2014 12:15 PM</font></tt><br>
<tt><font size="2">> Subject: Re: [openstack-dev] Offset support in REST API pagination</font></tt><br>
<tt><font size="2">> <br>
> On Tue, 2014-03-18 at 11:31 -0500, Steven Kaufer wrote:<br>
> > First, here is some background on this topic:<br>
> > <a href="http://www.gossamer-threads.com/lists/openstack/dev/2777">http://www.gossamer-threads.com/lists/openstack/dev/2777</a><br>
> > <br>
> > Does anyone have any insight as to why offset is not supported in the<br>
> > REST API calls that support pagination? I realize that there are<br>
> > tradeoffs when using a offset (vs. marker) but I believe that there is<br>
> > value in supporting both. For example, if you want to jump to the<br>
> > n-th page of data without having to traverse all of the previous<br>
> > pages.<br>
> > <br>
> > Is there a reason why the APIs do not support either a marker or an<br>
> > offset (obviously not both) on the API request? It appears that<br>
> > sqlalchemy has offset support.<br>
> > <br>
> > Also, it seems that cinder at least looks for the offset parameter<br>
> > (but ignores it). Does this mean that it was supported at one time<br>
> > but later the support was removed?<br>
> > <a href="https://github.com/openstack/cinder/blob/master/cinder/api/v2/">https://github.com/openstack/cinder/blob/master/cinder/api/v2/</a><br>
> volumes.py#L214<br>
> > <br>
> > Thanks for the information.<br>
> <br>
> Hail to thee, stranger! Thou hast apparently not passed into the cave of<br>
> marker/offset before!<br>
> <br>
> I humbly direct you to buried mailing list treasures which shall<br>
> enlighten you!<br>
> <br>
> This lengthy thread shall show you how yours truly was defeated in<br>
> written combat by the great Justin Santa Barbara, who doth exposed the<br>
> perils of the offset:<br>
> <br>
> <a href="http://www.gossamer-threads.com/lists/openstack/dev/2803">http://www.gossamer-threads.com/lists/openstack/dev/2803</a><br>
> <br>
> A most recent incantation of the marker/offset wars is giveth here:<br>
> <br>
> <a href="http://lists.openstack.org/pipermail/openstack-dev/2013-November/018861.html">http://lists.openstack.org/pipermail/openstack-dev/2013-November/018861.html</a><br>
> <br>
> Best of days to you,<br>
> -jay<br>
</font></tt><br>
<tt><font size="2">Jay:</font></tt><br>
<br>
<tt><font size="2">Thanks for the feedback and the history on this topic. I understand that the limit/marker</font></tt><br>
<tt><font size="2">approach is superior when simply traversing all of the pages. However, consider the</font></tt><br>
<tt><font size="2">following:</font></tt><br>
<br>
<tt><font size="2">- User knows that there are 1000 items (VMs, volumes, images, really doesn't matter)</font></tt><br>
<tt><font size="2">- User knows that the item that they want is in roughly the middle of the data set (assume</font></tt><br>
<tt><font size="2">everything is sorted by display name)</font></tt><br>
<tt><font size="2">- User cannot remember the exact name so a filter will not help and changing the sort </font></tt><br>
<tt><font size="2">direction will not help (since the item they want it is in the middle of the dataset)</font></tt><br>
<tt><font size="2">- User supplies an offset of 500 to jump into the middle of the data set</font></tt><br>
<tt><font size="2">- User then uses the marker approach to traverse the pages from this point to find the</font></tt><br>
<tt><font size="2">item that they want</font></tt><br>
<br>
<tt><font size="2">In this case the offset approach is not used to traverse pages so there are no issues with</font></tt><br>
<tt><font size="2">missing an item or seeing a duplicate.</font></tt><br>
<br>
<tt><font size="2">Why couldn't the APIs support either marker or offset on a given request? Also, to encourage</font></tt><br>
<tt><font size="2">the use of marker instead of offset, the next/previous links on any request with an offset</font></tt><br>
<tt><font size="2">supplied should contain the appropriate marker key values -- this should help discourage</font></tt><br>
<tt><font size="2">simply increasing the offset when traversing the pages.</font></tt><br>
<br>
<tt><font size="2">I realize that if only one solution had to be chosen, then limit/marker would always win</font></tt><br>
<tt><font size="2">this war. But why can't both be supported?</font></tt><br>
<br>
<tt><font size="2">Thanks,</font></tt><br>
<br>
<tt><font size="2">Steven Kaufer</font></tt><br>
<br>
<tt><font size="2">> <br>
> <br>
> _______________________________________________<br>
> OpenStack-dev mailing list<br>
> OpenStack-dev@lists.openstack.org<br>
> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
> <br>
</font></tt></body></html>