mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
rename mts
to intvlGroups
Signed-off-by: codwu <wuhan9087@163.com>
This commit is contained in:
parent
e4444ca48c
commit
bc6ef0b94e
|
@ -557,7 +557,7 @@ func TestBlockQuerierDelete(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tombstones: &memTombstones{mts: map[uint64]Intervals{
|
tombstones: &memTombstones{intvlGroups: map[uint64]Intervals{
|
||||||
1: Intervals{{1, 3}},
|
1: Intervals{{1, 3}},
|
||||||
2: Intervals{{1, 3}, {6, 10}},
|
2: Intervals{{1, 3}, {6, 10}},
|
||||||
3: Intervals{{6, 10}},
|
3: Intervals{{6, 10}},
|
||||||
|
|
|
@ -157,24 +157,24 @@ func readTombstones(dir string) (*memTombstones, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type memTombstones struct {
|
type memTombstones struct {
|
||||||
mts map[uint64]Intervals
|
intvlGroups map[uint64]Intervals
|
||||||
mtx sync.RWMutex
|
mtx sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMemTombstones() *memTombstones {
|
func NewMemTombstones() *memTombstones {
|
||||||
return &memTombstones{mts: make(map[uint64]Intervals)}
|
return &memTombstones{intvlGroups: make(map[uint64]Intervals)}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *memTombstones) Get(ref uint64) (Intervals, error) {
|
func (t *memTombstones) Get(ref uint64) (Intervals, error) {
|
||||||
t.mtx.RLock()
|
t.mtx.RLock()
|
||||||
defer t.mtx.RUnlock()
|
defer t.mtx.RUnlock()
|
||||||
return t.mts[ref], nil
|
return t.intvlGroups[ref], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *memTombstones) Iter(f func(uint64, Intervals) error) error {
|
func (t *memTombstones) Iter(f func(uint64, Intervals) error) error {
|
||||||
t.mtx.RLock()
|
t.mtx.RLock()
|
||||||
defer t.mtx.RUnlock()
|
defer t.mtx.RUnlock()
|
||||||
for ref, ivs := range t.mts {
|
for ref, ivs := range t.intvlGroups {
|
||||||
if err := f(ref, ivs); err != nil {
|
if err := f(ref, ivs); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ func (t *memTombstones) addInterval(ref uint64, itvs ...Interval) {
|
||||||
t.mtx.Lock()
|
t.mtx.Lock()
|
||||||
defer t.mtx.Unlock()
|
defer t.mtx.Unlock()
|
||||||
for _, itv := range itvs {
|
for _, itv := range itvs {
|
||||||
t.mts[ref] = t.mts[ref].add(itv)
|
t.intvlGroups[ref] = t.intvlGroups[ref].add(itv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue