Skip to content

Commit

Permalink
fixup! Use constraints.Integer
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Haudum <[email protected]>
  • Loading branch information
chaudum committed Feb 15, 2024
1 parent ddb53e9 commit af12e2f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/bloomcompactor/bloomcompactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func (c *Compactor) ownsTenant(tenant string) (v1.FingerprintBounds, bool, error

}

ownershipBounds, err := bloomutils.GetInstanceWithTokenRange(c.cfg.Ring.InstanceID, rs.Instances)
ownershipBounds, err := bloomutils.OwnershipBoundsForInstance(c.cfg.Ring.InstanceID, rs.Instances)
if err != nil {
return v1.FingerprintBounds{}, false, errors.Wrap(err, "getting instance token range")
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/bloomutils/ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ func (i InstancesWithTokenRange) Contains(token uint32) bool {
return false
}

// GetInstanceWithTokenRange calculates the token range for a specific instance
// OwnershipBoundsForInstance calculates the token range for a specific instance
// with given id based on the first token in the ring.
// This assumes that each instance in the ring is configured with only a single
// token.
func GetInstanceWithTokenRange(id string, instances []ring.InstanceDesc) (v1.FingerprintBounds, error) {
func OwnershipBoundsForInstance(id string, instances []ring.InstanceDesc) (v1.FingerprintBounds, error) {

// Sort instances -- they may not be sorted
// because they're usually accessed by looking up the tokens (which are sorted)
Expand Down
6 changes: 3 additions & 3 deletions pkg/bloomutils/ring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
v1 "github.com/grafana/loki/pkg/storage/bloom/v1"
)

func TestBloomGatewayClient_SortInstancesByToken(t *testing.T) {
func TestBloomGatewayClient_InstanceSortMergeIterator(t *testing.T) {
input := []ring.InstanceDesc{
{Id: "1", Tokens: []uint32{5, 9}},
{Id: "2", Tokens: []uint32{3, 7}},
Expand All @@ -33,7 +33,7 @@ func TestBloomGatewayClient_SortInstancesByToken(t *testing.T) {
}
}

func TestBloomGatewayClient_GetInstanceWithTokenRange(t *testing.T) {
func TestBloomGatewayClient_OwnershipBoundsForInstance(t *testing.T) {
for name, tc := range map[string]struct {
id string
input []ring.InstanceDesc
Expand Down Expand Up @@ -69,7 +69,7 @@ func TestBloomGatewayClient_GetInstanceWithTokenRange(t *testing.T) {
} {
tc := tc
t.Run(name, func(t *testing.T) {
result, err := GetInstanceWithTokenRange(tc.id, tc.input)
result, err := OwnershipBoundsForInstance(tc.id, tc.input)
require.NoError(t, err)
require.Equal(t, tc.expected, result)
})
Expand Down

0 comments on commit af12e2f

Please sign in to comment.