Skip to content

Add API pagination#423

Merged
petrutlucian94 merged 10 commits intocloudbase:masterfrom
petrutlucian94:pagination
May 8, 2026
Merged

Add API pagination#423
petrutlucian94 merged 10 commits intocloudbase:masterfrom
petrutlucian94:pagination

Conversation

@petrutlucian94
Copy link
Copy Markdown
Member

@petrutlucian94 petrutlucian94 commented May 5, 2026

At the moment, listing endpoint instances is the only Coriolis API that supports pagination. For this reason, Coriolis clients often retrieve much more database records than needed, leading to poor performance.

We're now adding pagination to other Coriolis APIs:

  • transfers
  • transfer executions
  • deployments

New optional parameters:

  • sort_key - sort key, repeatable. created_at and id are used by default.
  • sort_dir - sort direction, repeatable. asc or desc (default).
  • marker - the last seen ID, omitted from the results.
  • limit - the maximum number of records to retrieve.

The pagination will be performed on the db API side, leveraging the "utils.paginate_query" helper from oslo_db.

Example:

GET http://server:7667/v1/transfers?marker=a7061715-e56c-470c-a6ac-80bb02f1f198&limit=2&sort_key=id&sort_dir=asc

Note that the integration tests depend on the client changes: cloudbase/python-coriolisclient#98

@petrutlucian94 petrutlucian94 force-pushed the pagination branch 2 times, most recently from a43834f to f648dc1 Compare May 5, 2026 13:11
@petrutlucian94 petrutlucian94 requested a review from claudiubelu May 5, 2026 18:19
Comment thread coriolis/api/common.py
return marker, limit


def get_sort_params(req,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shared by most Openstack services.

Comment thread coriolis/db/api.py
setattr(lifecycle, 'updated_at', timeutils.utcnow())


def process_sort_params(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shared by most Openstack services.

@petrutlucian94 petrutlucian94 force-pushed the pagination branch 2 times, most recently from 6d2dda5 to f1e7acb Compare May 6, 2026 10:22
Comment thread coriolis/tests/integration/test_pagination.py Outdated
Comment thread coriolis/tests/integration/test_pagination.py Outdated
@petrutlucian94 petrutlucian94 force-pushed the pagination branch 4 times, most recently from d760176 to f30e307 Compare May 8, 2026 12:58
At the moment, listing endpoint instances is the only Coriolis
API that supports pagination. For this reason, Coriolis clients
often retrieve much more database records than needed, leading to
poor performance.

We're now adding pagination to other Coriolis APIs, starting with
the transfer executions. A transfer can have a large amount of
executions, especially in case of cron jobs.

New optional parameters:
* limit - the maximum number of entries to retrieve
* marker - the last seen id, will not be retrieved again

The pagination will be performed on the db API side, leveraging the
"utils.paginate_query" helper from oslo_db.
Non-admin operations will be tenant scoped, which means that we don't
have to care about other entries from the database.
@petrutlucian94 petrutlucian94 merged commit 5277917 into cloudbase:master May 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants