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

Method updateRing

ring/partition_instance_lifecycler.go:255–267  ·  view source on GitHub ↗
(ctx context.Context, update func(ring *PartitionRingDesc) (bool, error))

Source from the content-addressed store, hash-verified

253}
254
255func (l *PartitionInstanceLifecycler) updateRing(ctx context.Context, update func(ring *PartitionRingDesc) (bool, error)) error {
256 return l.store.CAS(ctx, l.ringKey, func(in interface{}) (out interface{}, retry bool, err error) {
257 ringDesc := GetOrCreatePartitionRingDesc(in)
258
259 if changed, err := update(ringDesc); err != nil {
260 return nil, false, err
261 } else if !changed {
262 return nil, false, nil
263 }
264
265 return ringDesc, true, nil
266 })
267}
268
269// partitionOwnerID returns the instance ID used to register the owner in the ring.
270func (l *PartitionInstanceLifecycler) partitionOwnerID() string {

Callers 6

ChangePartitionStateMethod · 0.95
stoppingMethod · 0.95

Calls 2

CASMethod · 0.65

Tested by

no test coverage detected