satellite/metabase: sync batchSizeLimit and ListLimit constants

This change syncs batchSizeLimit and ListLimit constants to prevent
throwing away results returned while listing with a maximum returns
limit.

Change-Id: Ie2425542d945cb88653dcc34c079737bb32320d4
This commit is contained in:
Artur M. Wolff 2021-08-11 16:37:11 +02:00
parent ca5215c481
commit e452f85163

View File

@ -28,7 +28,16 @@ const (
// ListLimit is the maximum number of items the client can request for listing. // ListLimit is the maximum number of items the client can request for listing.
const ListLimit = intLimitRange(1000) const ListLimit = intLimitRange(1000)
const batchsizeLimit = intLimitRange(1000) // batchsizeLimit specifies up to how many items fetch from the storage layer at
// a time.
//
// NOTE: A frequent pattern while listing items is to list up to ListLimit items
// and see whether there is more by trying to fetch another one. If the caller
// requests a list of ListLimit size and batchSizeLimit equals ListLimit, we
// would have queried another batch on that check for more items. Most of these
// results, except the first one, would be thrown away by callers. To prevent
// this from happening, we add 1 to batchSizeLimit.
const batchsizeLimit = ListLimit + 1
// BucketPrefix consists of <project id>/<bucket name>. // BucketPrefix consists of <project id>/<bucket name>.
type BucketPrefix string type BucketPrefix string