AddIngester adds the given ingester to the ring. Ingester will only use supplied tokens, any other tokens are removed.
(id, addr, zone string, tokens []uint32, state InstanceState, registeredAt time.Time, readOnly bool, readOnlyUpdated time.Time, versions InstanceVersions)
| 57 | // AddIngester adds the given ingester to the ring. Ingester will only use supplied tokens, |
| 58 | // any other tokens are removed. |
| 59 | func (d *Desc) AddIngester(id, addr, zone string, tokens []uint32, state InstanceState, registeredAt time.Time, readOnly bool, readOnlyUpdated time.Time, versions InstanceVersions) InstanceDesc { |
| 60 | if d.Ingesters == nil { |
| 61 | d.Ingesters = map[string]InstanceDesc{} |
| 62 | } |
| 63 | |
| 64 | ingester := InstanceDesc{ |
| 65 | Id: id, |
| 66 | Addr: addr, |
| 67 | Timestamp: time.Now().Unix(), |
| 68 | State: state, |
| 69 | Tokens: tokens, |
| 70 | Zone: zone, |
| 71 | RegisteredTimestamp: timeToUnixSecons(registeredAt), |
| 72 | ReadOnly: readOnly, |
| 73 | ReadOnlyUpdatedTimestamp: timeToUnixSecons(readOnlyUpdated), |
| 74 | Versions: versions, |
| 75 | } |
| 76 | |
| 77 | d.Ingesters[id] = ingester |
| 78 | return ingester |
| 79 | } |
| 80 | |
| 81 | // RemoveIngester removes the given ingester and all its tokens. |
| 82 | func (d *Desc) RemoveIngester(id string) { |