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

Method GenerateTokens

pkg/ring/token_generator.go:29–29  ·  view source on GitHub ↗

GenerateTokens make numTokens unique random tokens, none of which clash with takenTokens. Generated tokens are sorted. GenerateTokens can return any number of token between 0 and numTokens if force is set to false. If force is set to true, all tokens needs to be generated

(ring *Desc, id, zone string, numTokens int, force bool)

Source from the content-addressed store, hash-verified

27 // GenerateTokens can return any number of token between 0 and numTokens if force is set to false.
28 // If force is set to true, all tokens needs to be generated
29 GenerateTokens(ring *Desc, id, zone string, numTokens int, force bool) []uint32
30}
31
32type RandomTokenGenerator struct{}

Callers 14

benchmarkBatchFunction · 0.65
benchmarkUpdateRingStateFunction · 0.65
TestGenerateTokensFunction · 0.65
GenerateTokensMethod · 0.65
RenewTokensMethod · 0.65
verifyTokensMethod · 0.65
autoJoinMethod · 0.65
GenerateTokensMethod · 0.65
verifyTokensMethod · 0.65

Implementers 3

mockedTokenGeneratorpkg/ring/token_generator_test.go
RandomTokenGeneratorpkg/ring/token_generator.go
MinimizeSpreadTokenGeneratorpkg/ring/token_generator.go

Calls

no outgoing calls

Tested by 6

benchmarkBatchFunction · 0.52
benchmarkUpdateRingStateFunction · 0.52
TestGenerateTokensFunction · 0.52
GenerateTokensMethod · 0.52