diff --git a/pkg/bloomcompactor/bloomcompactor.go b/pkg/bloomcompactor/bloomcompactor.go index 36dcf36ed1fb7..65759f2b07e5f 100644 --- a/pkg/bloomcompactor/bloomcompactor.go +++ b/pkg/bloomcompactor/bloomcompactor.go @@ -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") } diff --git a/pkg/bloomutils/ring.go b/pkg/bloomutils/ring.go index 03bb82f5d8f9d..afb40e8b01762 100644 --- a/pkg/bloomutils/ring.go +++ b/pkg/bloomutils/ring.go @@ -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) diff --git a/pkg/bloomutils/ring_test.go b/pkg/bloomutils/ring_test.go index 5e00038f271de..9f64a2f971567 100644 --- a/pkg/bloomutils/ring_test.go +++ b/pkg/bloomutils/ring_test.go @@ -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}}, @@ -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 @@ -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) })