MCPcopy
hub / github.com/grafana/dskit / AddIngester

Method AddIngester

ring/model.go:59–79  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

57// AddIngester adds the given ingester to the ring. Ingester will only use supplied tokens,
58// any other tokens are removed.
59func (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.
82func (d *Desc) RemoveIngester(id string) {

Calls 1

timeToUnixSeconsFunction · 0.85