Find a way to replace ActivityPub offset pagination with keyset pagination

Why are we doing this work

Currently, ActivityStreams serializer uses an offset pagination, inherited from Gitlab::Serializer::Pagination.

The problem is that those serializers may be used with tables that could have a lot of records (like events), so we need an option to use Keyset pagination instead.

Ideally, we should give both options (offset and keyset pagination), so that implementer can decide which one is best for their resource. It shouldn't be a problem in usage since ActivityStreams Collection and CollectionPage provide full urls to the various pages (first, last, next, prev) - so it works very well with multiple pagination architectures.

Relevant links

  • initial discussion on the topic
  • Keyset pagination
  • Gitlab::Serializer::Pagination
  • Gitlab::Pagination::Keyset::Pager
  • Documentation: we should update the serializer documentation to let know of the various pagination options
  • Testing:

Implementation plan

  • implement a second option of pagination in Gitlab::Serializer::Pagination
  • implement its use in ActivityPub::ActivityStreamsSerializer

Verification steps

TBD

Assignee Loading
Time tracking Loading