(ctx context.Context, update func(ring *PartitionRingDesc) (bool, error))
| 253 | } |
| 254 | |
| 255 | func (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. |
| 270 | func (l *PartitionInstanceLifecycler) partitionOwnerID() string { |
no test coverage detected