Skip to content
This repository was archived by the owner on Aug 13, 2019. It is now read-only.

Commit 4b7a4fb

Browse files
committed
Don't export MemTombstones.
Signed-off-by: Callum Styan <[email protected]>
1 parent 476bbec commit 4b7a4fb

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

querier_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,11 @@ func TestBlockQuerierDelete(t *testing.T) {
413413
exp SeriesSet
414414
}
415415

416+
tstones := tombstones.NewMemTombstones()
417+
tstones.AddInterval(1, tombstones.Interval{1, 3})
418+
tstones.AddInterval(2, tombstones.Interval{1, 3}, tombstones.Interval{6, 10})
419+
tstones.AddInterval(3, tombstones.Interval{6, 10})
420+
416421
cases := struct {
417422
data []seriesSamples
418423

@@ -461,11 +466,7 @@ func TestBlockQuerierDelete(t *testing.T) {
461466
},
462467
},
463468
},
464-
tombstones: &tombstones.MemTombstones{IntvlGroups: map[uint64]tombstones.Intervals{
465-
1: tombstones.Intervals{{1, 3}},
466-
2: tombstones.Intervals{{1, 3}, {6, 10}},
467-
3: tombstones.Intervals{{6, 10}},
468-
}},
469+
tombstones: tstones,
469470
queries: []query{
470471
{
471472
mint: 2,

tombstones/tombstones.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -199,55 +199,55 @@ func ReadTombstones(dir string) (TombstoneReader, int64, error) {
199199
return stonesMap, int64(len(b)), nil
200200
}
201201

202-
type MemTombstones struct {
203-
IntvlGroups map[uint64]Intervals
202+
type memTombstones struct {
203+
intvlGroups map[uint64]Intervals
204204
mtx sync.RWMutex
205205
}
206206

207207
// NewMemTombstones creates new in memory TombstoneReader
208208
// that allows adding new intervals.
209-
func NewMemTombstones() *MemTombstones {
210-
return &MemTombstones{IntvlGroups: make(map[uint64]Intervals)}
209+
func NewMemTombstones() *memTombstones {
210+
return &memTombstones{intvlGroups: make(map[uint64]Intervals)}
211211
}
212212

213-
func (t *MemTombstones) Get(ref uint64) (Intervals, error) {
213+
func (t *memTombstones) Get(ref uint64) (Intervals, error) {
214214
t.mtx.RLock()
215215
defer t.mtx.RUnlock()
216-
return t.IntvlGroups[ref], nil
216+
return t.intvlGroups[ref], nil
217217
}
218218

219-
func (t *MemTombstones) Iter(f func(uint64, Intervals) error) error {
219+
func (t *memTombstones) Iter(f func(uint64, Intervals) error) error {
220220
t.mtx.RLock()
221221
defer t.mtx.RUnlock()
222-
for ref, ivs := range t.IntvlGroups {
222+
for ref, ivs := range t.intvlGroups {
223223
if err := f(ref, ivs); err != nil {
224224
return err
225225
}
226226
}
227227
return nil
228228
}
229229

230-
func (t *MemTombstones) Total() uint64 {
230+
func (t *memTombstones) Total() uint64 {
231231
t.mtx.RLock()
232232
defer t.mtx.RUnlock()
233233

234234
total := uint64(0)
235-
for _, ivs := range t.IntvlGroups {
235+
for _, ivs := range t.intvlGroups {
236236
total += uint64(len(ivs))
237237
}
238238
return total
239239
}
240240

241241
// AddInterval to an existing MemTombstones
242-
func (t *MemTombstones) AddInterval(ref uint64, itvs ...Interval) {
242+
func (t *memTombstones) AddInterval(ref uint64, itvs ...Interval) {
243243
t.mtx.Lock()
244244
defer t.mtx.Unlock()
245245
for _, itv := range itvs {
246-
t.IntvlGroups[ref] = t.IntvlGroups[ref].Add(itv)
246+
t.intvlGroups[ref] = t.intvlGroups[ref].Add(itv)
247247
}
248248
}
249249

250-
func (*MemTombstones) Close() error {
250+
func (*memTombstones) Close() error {
251251
return nil
252252
}
253253

0 commit comments

Comments
 (0)