Skip to content

Commit cff147d

Browse files
authored
receive: remove Get() method from hashring (#8226)
Get() is equivalent to GetN(1) so remove it. It's not used. Signed-off-by: Giedrius Statkevičius <[email protected]>
1 parent 7d7ea65 commit cff147d

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

pkg/receive/hashring.go

-7
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ func (i *insufficientNodesError) Error() string {
5151
// for a specified tenant.
5252
// It returns the node and any error encountered.
5353
type Hashring interface {
54-
// Get returns the first node that should handle the given tenant and time series.
55-
Get(tenant string, timeSeries *prompb.TimeSeries) (Endpoint, error)
5654
// GetN returns the nth node that should handle the given tenant and time series.
5755
GetN(tenant string, timeSeries *prompb.TimeSeries, n uint64) (Endpoint, error)
5856
// Nodes returns a sorted slice of nodes that are in this hashring. Addresses could be duplicated
@@ -63,11 +61,6 @@ type Hashring interface {
6361
// SingleNodeHashring always returns the same node.
6462
type SingleNodeHashring string
6563

66-
// Get implements the Hashring interface.
67-
func (s SingleNodeHashring) Get(tenant string, ts *prompb.TimeSeries) (Endpoint, error) {
68-
return s.GetN(tenant, ts, 0)
69-
}
70-
7164
func (s SingleNodeHashring) Nodes() []Endpoint {
7265
return []Endpoint{{Address: string(s), CapNProtoAddress: string(s)}}
7366
}

pkg/receive/hashring_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func TestHashringGet(t *testing.T) {
201201
hs, err := NewMultiHashring(AlgorithmHashmod, 3, tc.cfg)
202202
require.NoError(t, err)
203203

204-
h, err := hs.Get(tc.tenant, ts)
204+
h, err := hs.GetN(tc.tenant, ts, 0)
205205
if tc.nodes != nil {
206206
if err != nil {
207207
t.Errorf("case %q: got unexpected error: %v", tc.name, err)

0 commit comments

Comments
 (0)