ClaimTokens transfers all the tokens from one ingester to another, returning the claimed token. This method assumes that Ring is in the correct state, 'to' ingester has no tokens anywhere. Tokens list must be sorted properly. If all of this is true, everything will be fine.
(from, to string)
| 88 | // This method assumes that Ring is in the correct state, 'to' ingester has no tokens anywhere. |
| 89 | // Tokens list must be sorted properly. If all of this is true, everything will be fine. |
| 90 | func (d *Desc) ClaimTokens(from, to string) Tokens { |
| 91 | var result Tokens |
| 92 | |
| 93 | if fromDesc, found := d.Ingesters[from]; found { |
| 94 | result = fromDesc.Tokens |
| 95 | fromDesc.Tokens = nil |
| 96 | d.Ingesters[from] = fromDesc |
| 97 | } |
| 98 | |
| 99 | ing := d.Ingesters[to] |
| 100 | ing.Tokens = result |
| 101 | d.Ingesters[to] = ing |
| 102 | |
| 103 | return result |
| 104 | } |
| 105 | |
| 106 | // FindIngestersByState returns the list of ingesters in the given state |
| 107 | func (d *Desc) FindIngestersByState(state InstanceState) []InstanceDesc { |
no outgoing calls