Add lexicographic based tags pagination and counting
Context
This MR adds a way to lexicographically find and count tags within a repository based on their name. This is needed for the GET /v2/<name>/tags/list
route.
Related to #120 (closed).
Rationale
Although defined by the Docker Distribution spec, currently the registry doesn't implement pagination for tags. This is due to technical limitations (see #13 (comment 271769891)).
However, if it's ever implemented, it'll have the same constraints as the catalog pagination, as it would rely on the same filesystem walk method:
- The pagination is done based on the tags name;
- Navigating to the next page is done by providing a
last
query parameter, which should be set to the name of the last tag returned on the current response/page; - Even if there are no tags with a name equal to
last
, all tags with a name lexicographically beforelast
are ignored; - Tags are sorted lexicographically, with a possible limit (
n
query parameter) being applied after they're sorted.
We have to respect the constraints above. For this reason, the new methods are likely going to be used exclusively by the tag list API handler.