Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Owen Diehl <[email protected]>
  • Loading branch information
owen-d committed Jan 31, 2024
1 parent 88e24f1 commit 6c989a6
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion pkg/bloomcompactor/v2_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type Meta struct {
// is greater than or equal to the range of the actual data in the underlying blocks.
OwnershipRange v1.FingerprintBounds

// Old blocks which can be deleted in the future. These should be from pervious compaction rounds.
// Old blocks which can be deleted in the future. These should be from previous compaction rounds.
Tombstones []BlockRef

// The specific TSDB files used to generate the block.
Expand Down
2 changes: 1 addition & 1 deletion pkg/bloomcompactor/v2controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func blockPlansForGaps(tsdbs []tsdbGaps, metas []Meta) []blockPlan {
func(a, b BlockRef) bool {
return a == b
},
v1.Id[BlockRef],
v1.Identity[BlockRef],
func(a, _ BlockRef) BlockRef {
return a
},
Expand Down
48 changes: 24 additions & 24 deletions pkg/bloomcompactor/v2controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func Test_findGaps(t *testing.T) {
}
}

func tsdbId(n int) tsdb.SingleTenantTSDBIdentifier {
func tsdbID(n int) tsdb.SingleTenantTSDBIdentifier {
return tsdb.SingleTenantTSDBIdentifier{
TS: time.Unix(int64(n), 0),
}
Expand All @@ -125,7 +125,7 @@ func genMeta(min, max model.Fingerprint, sources []int, blocks []BlockRef) Meta
Blocks: blocks,
}
for _, source := range sources {
m.Sources = append(m.Sources, tsdbId(source))
m.Sources = append(m.Sources, tsdbID(source))
}
return m
}
Expand All @@ -144,21 +144,21 @@ func Test_gapsBetweenTSDBsAndMetas(t *testing.T) {
desc: "non-overlapping tsdbs and metas",
err: true,
ownershipRange: v1.NewBounds(0, 10),
tsdbs: []tsdb.Identifier{tsdbId(0)},
tsdbs: []tsdb.Identifier{tsdbID(0)},
metas: []Meta{
genMeta(11, 20, []int{0}, nil),
},
},
{
desc: "single tsdb",
ownershipRange: v1.NewBounds(0, 10),
tsdbs: []tsdb.Identifier{tsdbId(0)},
tsdbs: []tsdb.Identifier{tsdbID(0)},
metas: []Meta{
genMeta(4, 8, []int{0}, nil),
},
exp: []tsdbGaps{
{
tsdb: tsdbId(0),
tsdb: tsdbID(0),
gaps: []v1.FingerprintBounds{
v1.NewBounds(0, 3),
v1.NewBounds(9, 10),
Expand All @@ -169,20 +169,20 @@ func Test_gapsBetweenTSDBsAndMetas(t *testing.T) {
{
desc: "multiple tsdbs with separate blocks",
ownershipRange: v1.NewBounds(0, 10),
tsdbs: []tsdb.Identifier{tsdbId(0), tsdbId(1)},
tsdbs: []tsdb.Identifier{tsdbID(0), tsdbID(1)},
metas: []Meta{
genMeta(0, 5, []int{0}, nil),
genMeta(6, 10, []int{1}, nil),
},
exp: []tsdbGaps{
{
tsdb: tsdbId(0),
tsdb: tsdbID(0),
gaps: []v1.FingerprintBounds{
v1.NewBounds(6, 10),
},
},
{
tsdb: tsdbId(1),
tsdb: tsdbID(1),
gaps: []v1.FingerprintBounds{
v1.NewBounds(0, 5),
},
Expand All @@ -192,20 +192,20 @@ func Test_gapsBetweenTSDBsAndMetas(t *testing.T) {
{
desc: "multiple tsdbs with the same blocks",
ownershipRange: v1.NewBounds(0, 10),
tsdbs: []tsdb.Identifier{tsdbId(0), tsdbId(1)},
tsdbs: []tsdb.Identifier{tsdbID(0), tsdbID(1)},
metas: []Meta{
genMeta(0, 5, []int{0, 1}, nil),
genMeta(6, 8, []int{1}, nil),
},
exp: []tsdbGaps{
{
tsdb: tsdbId(0),
tsdb: tsdbID(0),
gaps: []v1.FingerprintBounds{
v1.NewBounds(6, 10),
},
},
{
tsdb: tsdbId(1),
tsdb: tsdbID(1),
gaps: []v1.FingerprintBounds{
v1.NewBounds(9, 10),
},
Expand Down Expand Up @@ -242,13 +242,13 @@ func Test_blockPlansForGaps(t *testing.T) {
{
desc: "single overlapping meta+no overlapping block",
ownershipRange: v1.NewBounds(0, 10),
tsdbs: []tsdb.Identifier{tsdbId(0)},
tsdbs: []tsdb.Identifier{tsdbID(0)},
metas: []Meta{
genMeta(5, 20, []int{1}, []BlockRef{genBlockRef(11, 20)}),
},
exp: []blockPlan{
{
tsdb: tsdbId(0),
tsdb: tsdbID(0),
gaps: []gapWithBlocks{
{
bounds: v1.NewBounds(0, 10),
Expand All @@ -260,13 +260,13 @@ func Test_blockPlansForGaps(t *testing.T) {
{
desc: "single overlapping meta+one overlapping block",
ownershipRange: v1.NewBounds(0, 10),
tsdbs: []tsdb.Identifier{tsdbId(0)},
tsdbs: []tsdb.Identifier{tsdbID(0)},
metas: []Meta{
genMeta(5, 20, []int{1}, []BlockRef{genBlockRef(9, 20)}),
},
exp: []blockPlan{
{
tsdb: tsdbId(0),
tsdb: tsdbID(0),
gaps: []gapWithBlocks{
{
bounds: v1.NewBounds(0, 10),
Expand All @@ -282,14 +282,14 @@ func Test_blockPlansForGaps(t *testing.T) {
// but we can trim the range needing generation
desc: "trims up to date area",
ownershipRange: v1.NewBounds(0, 10),
tsdbs: []tsdb.Identifier{tsdbId(0)},
tsdbs: []tsdb.Identifier{tsdbID(0)},
metas: []Meta{
genMeta(9, 20, []int{0}, []BlockRef{genBlockRef(9, 20)}), // block for same tsdb
genMeta(9, 20, []int{1}, []BlockRef{genBlockRef(9, 20)}), // block for different tsdb
},
exp: []blockPlan{
{
tsdb: tsdbId(0),
tsdb: tsdbID(0),
gaps: []gapWithBlocks{
{
bounds: v1.NewBounds(0, 8),
Expand All @@ -301,14 +301,14 @@ func Test_blockPlansForGaps(t *testing.T) {
{
desc: "uses old block for overlapping range",
ownershipRange: v1.NewBounds(0, 10),
tsdbs: []tsdb.Identifier{tsdbId(0)},
tsdbs: []tsdb.Identifier{tsdbID(0)},
metas: []Meta{
genMeta(9, 20, []int{0}, []BlockRef{genBlockRef(9, 20)}), // block for same tsdb
genMeta(5, 20, []int{1}, []BlockRef{genBlockRef(5, 20)}), // block for different tsdb
},
exp: []blockPlan{
{
tsdb: tsdbId(0),
tsdb: tsdbID(0),
gaps: []gapWithBlocks{
{
bounds: v1.NewBounds(0, 8),
Expand All @@ -321,7 +321,7 @@ func Test_blockPlansForGaps(t *testing.T) {
{
desc: "multi case",
ownershipRange: v1.NewBounds(0, 10),
tsdbs: []tsdb.Identifier{tsdbId(0), tsdbId(1)}, // generate for both tsdbs
tsdbs: []tsdb.Identifier{tsdbID(0), tsdbID(1)}, // generate for both tsdbs
metas: []Meta{
genMeta(0, 2, []int{0}, []BlockRef{
genBlockRef(0, 1),
Expand All @@ -334,7 +334,7 @@ func Test_blockPlansForGaps(t *testing.T) {
},
exp: []blockPlan{
{
tsdb: tsdbId(0),
tsdb: tsdbID(0),
gaps: []gapWithBlocks{
// tsdb (id=0) can source chunks from the blocks built from tsdb (id=1)
{
Expand All @@ -349,7 +349,7 @@ func Test_blockPlansForGaps(t *testing.T) {
},
// tsdb (id=1) can source chunks from the blocks built from tsdb (id=0)
{
tsdb: tsdbId(1),
tsdb: tsdbID(1),
gaps: []gapWithBlocks{
{
bounds: v1.NewBounds(0, 2),
Expand All @@ -369,7 +369,7 @@ func Test_blockPlansForGaps(t *testing.T) {
{
desc: "dedupes block refs",
ownershipRange: v1.NewBounds(0, 10),
tsdbs: []tsdb.Identifier{tsdbId(0)},
tsdbs: []tsdb.Identifier{tsdbID(0)},
metas: []Meta{
genMeta(9, 20, []int{1}, []BlockRef{
genBlockRef(1, 4),
Expand All @@ -382,7 +382,7 @@ func Test_blockPlansForGaps(t *testing.T) {
},
exp: []blockPlan{
{
tsdb: tsdbId(0),
tsdb: tsdbID(0),
gaps: []gapWithBlocks{
{
bounds: v1.NewBounds(0, 10),
Expand Down
2 changes: 1 addition & 1 deletion pkg/bloomgateway/multiplexing.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type Task struct {
// the last error of the task
// needs to be a pointer so multiple copies of the task can modify its value
err *wrappedError
// the respones received from the block queriers
// the responses received from the block queriers
responses []v1.Output

// series of the original request
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/bloom/v1/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ func (mb *MergeBuilder) Build(builder *BlockBuilder) (uint32, error) {
func(a, b *SeriesWithBloom) bool {
return a.Series.Fingerprint == b.Series.Fingerprint
},
Id[*SeriesWithBloom],
Identity[*SeriesWithBloom],
func(a, b *SeriesWithBloom) *SeriesWithBloom {
if len(a.Series.Chunks) > len(b.Series.Chunks) {
return a
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/bloom/v1/dedupe.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type DedupeIter[A, B any] struct {
}

// general helper, in this case created for DedupeIter[T,T]
func Id[A any](a A) A { return a }
func Identity[A any](a A) A { return a }

func NewDedupingIter[A, B any](
eq func(A, B) bool,
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/bloom/v1/dedupe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestMergeDedupeIter(t *testing.T) {
}
deduper := NewDedupingIter[*SeriesWithBloom, *SeriesWithBloom](
eq,
Id[*SeriesWithBloom],
Identity[*SeriesWithBloom],
merge,
NewPeekingIter[*SeriesWithBloom](mbq),
)
Expand Down

0 comments on commit 6c989a6

Please sign in to comment.