Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/layout/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ func EntriesPathForLogIndex(seq, logSize uint64) string {
//
// If from >= treeSize or N == 0, the returned iterator will yield no elements.
func Range(from, N, treeSize uint64) iter.Seq[RangeInfo] {
// Mostly hypothetical, but ensure we never overflow uint64.
if math.MaxUint64-from < N {
N = math.MaxUint64 - from
}
return func(yield func(RangeInfo) bool) {
// Range is empty if we're entirely beyond the extent of the tree, or we've been asked for zero items.
if from >= treeSize || N == 0 {
Expand Down
2 changes: 1 addition & 1 deletion client/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func EntryBundles(ctx context.Context, numWorkers uint, getSize TreeSizeFunc, ge

// For each bundle, pop a future into the bundles channel and kick off an async request
// to resolve it.
for ri := range layout.Range(fromEntry, fromEntry+N, treeSize) {
for ri := range layout.Range(fromEntry, N, treeSize) {
select {
case <-exit:
return
Expand Down
Loading