Documentation ¶
Index ¶
- func NeedsMerge(left, right *RangeStats, splitSizeBytes, splitKeyCount uint64) bool
- func ZapRanges(ranges []Range) zapcore.Field
- type IncompleteRangesFetcher
- type ProgressRange
- type ProgressRangeTree
- type Range
- func (rg *Range) BytesAndKeys() (bytes, keys uint64)
- func (rg *Range) Contains(key []byte) bool
- func (rg *Range) ContainsRange(startKey, endKey []byte) bool
- func (rg *Range) Intersect(start, end []byte) (subStart, subEnd []byte, isIntersect bool)
- func (rg *Range) Less(than btree.Item) bool
- func (rg Range) String() string
- type RangeStats
- type RangeStatsTree
- type RangeTree
- func (rangeTree *RangeTree) Find(rg *Range) *Range
- func (rangeTree *RangeTree) GetIncompleteRange(startKey, endKey []byte) []Range
- func (rangeTree *RangeTree) InsertRange(rg Range) *Range
- func (rangeTree *RangeTree) Put(startKey, endKey []byte, files []*backuppb.File)
- func (rangeTree *RangeTree) Update(rg Range)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NeedsMerge ¶
func NeedsMerge(left, right *RangeStats, splitSizeBytes, splitKeyCount uint64) bool
NeedsMerge checks whether two ranges needs to be merged.
Types ¶
type IncompleteRangesFetcher ¶
type IncompleteRangesFetcher struct {
// contains filtered or unexported fields
}
func (*IncompleteRangesFetcher) GetIncompleteRanges ¶
func (iter *IncompleteRangesFetcher) GetIncompleteRanges() []Range
func (*IncompleteRangesFetcher) Len ¶
func (iter *IncompleteRangesFetcher) Len() int
type ProgressRange ¶
func (*ProgressRange) Less ¶
func (pr *ProgressRange) Less(than *ProgressRange) bool
Less impls btree.Item.
type ProgressRangeTree ¶
type ProgressRangeTree struct { *btree.BTreeG[*ProgressRange] }
ProgressRangeTree is a sorted tree for ProgressRanges. All the progress ranges it sorted do not overlap.
func NewProgressRangeTree ¶
func NewProgressRangeTree() ProgressRangeTree
NewProgressRangeTree returns an empty range tree.
func (*ProgressRangeTree) FindContained ¶
func (rangeTree *ProgressRangeTree) FindContained(startKey, endKey []byte) (*ProgressRange, error)
FindContained finds if there is a progress range containing the key range [startKey, endKey).
func (*ProgressRangeTree) Insert ¶
func (rangeTree *ProgressRangeTree) Insert(pr *ProgressRange) error
Insert inserts a ProgressRange into the tree, it will return an error if there is a overlapping range.
func (*ProgressRangeTree) Iter ¶
func (rangeTree *ProgressRangeTree) Iter() *IncompleteRangesFetcher
type Range ¶
Range represents a backup response.
func (*Range) BytesAndKeys ¶
BytesAndKeys returns total bytes and keys in a range.
func (*Range) ContainsRange ¶
ContainsRange check if the range contains the region's key range.
type RangeStats ¶
RangeStats represents a restore merge result.
type RangeStatsTree ¶
type RangeStatsTree struct { *btree.BTreeG[*RangeStats] }
func NewRangeStatsTree ¶
func NewRangeStatsTree() RangeStatsTree
func (*RangeStatsTree) InsertRange ¶
func (rangeTree *RangeStatsTree) InsertRange(rg *Range, rangeSize, rangeCount uint64) *RangeStats
InsertRange inserts ranges into the range tree. It returns a non-nil range if there are soe overlapped ranges.
func (*RangeStatsTree) MergedRanges ¶
func (rangeTree *RangeStatsTree) MergedRanges(splitSizeBytes, splitKeyCount uint64) []RangeStats
MergedRanges output the sortedRanges having merged according to given `splitSizeBytes` and `splitKeyCount`.
type RangeTree ¶
RangeTree is sorted tree for Ranges. All the ranges it stored do not overlap.
func (*RangeTree) Find ¶
Find is a helper function to find an item that contains the range start key.
func (*RangeTree) GetIncompleteRange ¶
GetIncompleteRange returns missing range covered by startKey and endKey.
func (*RangeTree) InsertRange ¶
InsertRange inserts ranges into the range tree. It returns a non-nil range if there are soe overlapped ranges.