aba2f14595
Additional elements added: * monkit metric for observers methods like Start/Fork/Join/Finish to be able to check how much time those methods are taking * few more logs e.g. entries with processed range * segmentsProcessed metric to be able to check loop progress Change-Id: I65dd51f7f5c4bdbb4014fbf04e5b6b10bdb035ec
25 lines
672 B
Go
25 lines
672 B
Go
// Copyright (C) 2022 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package rangedloop
|
|
|
|
import (
|
|
"context"
|
|
|
|
"storj.io/storj/satellite/metabase/segmentloop"
|
|
)
|
|
|
|
// 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([]segmentloop.Segment) error) error
|
|
}
|