update addInterval function and test.

Signed-off-by: codwu <wuhan9087@163.com>
This commit is contained in:
codwu 2018-07-06 20:30:27 +08:00
parent 667e539a7a
commit e4444ca48c
2 changed files with 6 additions and 3 deletions

View file

@ -557,7 +557,11 @@ func TestBlockQuerierDelete(t *testing.T) {
},
},
},
tombstones: NewMemTombstones().addInterval(1, Interval{1, 3}).addInterval(2, Interval{1, 3}, Interval{6, 10}).addInterval(3, Interval{6, 10}),
tombstones: &memTombstones{mts: map[uint64]Intervals{
1: Intervals{{1, 3}},
2: Intervals{{1, 3}, {6, 10}},
3: Intervals{{6, 10}},
}},
queries: []query{
{
mint: 2,

View file

@ -183,13 +183,12 @@ func (t *memTombstones) Iter(f func(uint64, Intervals) error) error {
}
// addInterval to an existing memTombstones
func (t *memTombstones) addInterval(ref uint64, itvs ...Interval) *memTombstones {
func (t *memTombstones) addInterval(ref uint64, itvs ...Interval) {
t.mtx.Lock()
defer t.mtx.Unlock()
for _, itv := range itvs {
t.mts[ref] = t.mts[ref].add(itv)
}
return t
}
func (memTombstones) Close() error {