4bdbb25d83
We will remove segments loop soon so we need first to move Segment definition to rangedloop package. https://github.com/storj/storj/issues/5237 Change-Id: Ibe6aad316ffb7073cc4de166f1f17b87aac07363
23 lines
610 B
Go
23 lines
610 B
Go
// Copyright (C) 2022 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package rangedloop
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
// RangeSplitter splits a source of segments into ranges,
|
|
// so that multiple segments can be processed concurrently.
|
|
// It usually abstracts over a database.
|
|
// It is a subcomponent of the ranged segment loop.
|
|
type RangeSplitter interface {
|
|
CreateRanges(nRanges int, batchSize int) ([]SegmentProvider, error)
|
|
}
|
|
|
|
// SegmentProvider iterates through a range of segments.
|
|
type SegmentProvider interface {
|
|
Range() UUIDRange
|
|
Iterate(ctx context.Context, fn func([]Segment) error) error
|
|
}
|