MCPcopy
hub / github.com/dgraph-io/badger / getKeyRange

Function getKeyRange

compaction.go:67–88  ·  view source on GitHub ↗
(tables ...*table.Table)

Source from the content-addressed store, hash-verified

65}
66
67func getKeyRange(tables ...*table.Table) keyRange {
68 if len(tables) == 0 {
69 return keyRange{}
70 }
71 smallest := tables[0].Smallest()
72 biggest := tables[0].Biggest()
73 for i := 1; i < len(tables); i++ {
74 if y.CompareKeys(tables[i].Smallest(), smallest) < 0 {
75 smallest = tables[i].Smallest()
76 }
77 if y.CompareKeys(tables[i].Biggest(), biggest) > 0 {
78 biggest = tables[i].Biggest()
79 }
80 }
81
82 // We pick all the versions of the smallest and the biggest key. Note that version zero would
83 // be the rightmost key, considering versions are default sorted in descending order.
84 return keyRange{
85 left: y.KeyWithTs(y.ParseKey(smallest), math.MaxUint64),
86 right: y.KeyWithTs(y.ParseKey(biggest), 0),
87 }
88}
89
90type levelCompactStatus struct {
91 ranges []keyRange

Callers 4

checkOverlapMethod · 0.85
fillTablesL0Method · 0.85
sortByOverlapMethod · 0.85
fillTablesMethod · 0.85

Calls 5

CompareKeysFunction · 0.92
KeyWithTsFunction · 0.92
ParseKeyFunction · 0.92
SmallestMethod · 0.65
BiggestMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…