MCPcopy Index your code
hub / github.com/cortexproject/cortex / userToken

Function userToken

pkg/ruler/ruler_test.go:2441–2448  ·  view source on GitHub ↗

User shuffle shard token.

(user string, skip int)

Source from the content-addressed store, hash-verified

2439
2440// User shuffle shard token.
2441func userToken(user string, skip int) uint32 {
2442 r := rand.New(rand.NewSource(util.ShuffleShardSeed(user, "")))
2443
2444 for ; skip > 0; skip-- {
2445 _ = r.Uint32()
2446 }
2447 return r.Uint32()
2448}
2449
2450func sortTokens(tokens []uint32) []uint32 {
2451 slices.Sort(tokens)

Callers 2

TestShardingFunction · 0.70

Calls 1

ShuffleShardSeedFunction · 0.92

Tested by

no test coverage detected