Add lexicographic based repository pagination and counting
Context
This MR adds a way to lexicographically find and count repositories based on their path. This is needed for the GET /v2/_catalog
route.
Rationale
The existing filesystem walk based pagination used by the GET /v2/_catalog
route has some particular constraints:
- The pagination is done based on repositories' path;
- Navigating to the next page is done by providing a
last
query parameter, which should be set to the path of the last repository returned on the current response/page; - Even if there are no repositories with a path equal to
last
, all repositories with a path lexicographically beforelast
are ignored; - Repositories are sorted lexicographically, with a possible limit (
n
query parameter) being applied after they're sorted; - Repositories that do not have any manifests (empty) are ignored.
To comply with the existing API behavior we have to respect the constraints above. For this reason, the new methods are likely going to be used exclusively by the catalog API handler.
Related to #124 (closed).
Edited by João Pereira