Files
teleport/lib/utils/pagination
Trent Clarke c4ddf0c4f2 Adds types to make paginated listings less error prone (#47321)
Incorrectly paging through resource lists has been a common
source of bugs in Teleport. This patch adds some types we can use
to make that process less error prone.

The most common issue is recycling page tokens, so listing a resource
becomes an infinite loop. This patch introduced the PageRequestToken,
which wraps a token value and ensures that it is used at most once.
Attempting to recycle a token value without updating it returns an
error, making iteration bugs more obvious.

It also has a strongly typed NextPageToken that can be returned by
paginated listings. This both ensures that attempting to assign the
wrong token value to the wrong token type becomes a compile-time
error.

Example usage is in the package godoc.
2024-10-08 21:40:58 +00:00
..