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

Method GetTokens

pkg/ring/model.go:505–518  ·  view source on GitHub ↗

GetTokens returns sorted list of tokens owned by all instances within the ring.

()

Source from the content-addressed store, hash-verified

503
504// GetTokens returns sorted list of tokens owned by all instances within the ring.
505func (d *Desc) GetTokens() []uint32 {
506 instances := make([][]uint32, 0, len(d.Ingesters))
507 for _, instance := range d.Ingesters {
508 // Tokens may not be sorted for an older version which, so we enforce sorting here.
509 tokens := instance.Tokens
510 if !sort.IsSorted(Tokens(tokens)) {
511 sort.Sort(Tokens(tokens))
512 }
513
514 instances = append(instances, tokens)
515 }
516
517 return MergeTokens(instances)
518}
519
520// getTokensByZone returns instances tokens grouped by zone. Tokens within each zone
521// are guaranteed to be sorted.

Calls 2

TokensTypeAlias · 0.85
MergeTokensFunction · 0.85