MCPcopy Create free account
hub / github.com/cortexproject/cortex / numTokens

Function numTokens

pkg/ingester/lifecycle_test.go:125–135  ·  view source on GitHub ↗

numTokens determines the number of tokens owned by the specified address

(c kv.Client, name, ringKey string)

Source from the content-addressed store, hash-verified

123// numTokens determines the number of tokens owned by the specified
124// address
125func numTokens(c kv.Client, name, ringKey string) int {
126 ringDesc, err := c.Get(context.Background(), ringKey)
127
128 // The ringDesc may be null if the lifecycler hasn't stored the ring
129 // to the KVStore yet.
130 if ringDesc == nil || err != nil {
131 return 0
132 }
133 rd := ringDesc.(*ring.Desc)
134 return len(rd.Ingesters[name].Tokens)
135}

Callers 2

TestIngesterRestartFunction · 0.70

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected