changeState of the instance within the ring. This function is guaranteed to be called within the lifecycler main goroutine.
(ctx context.Context, state InstanceState)
| 534 | // changeState of the instance within the ring. This function is guaranteed |
| 535 | // to be called within the lifecycler main goroutine. |
| 536 | func (l *BasicLifecycler) changeState(ctx context.Context, state InstanceState) error { |
| 537 | err := l.updateInstance(ctx, func(_ *Desc, i *InstanceDesc) bool { |
| 538 | // No-op if the state hasn't changed. |
| 539 | if i.State == state { |
| 540 | return false |
| 541 | } |
| 542 | |
| 543 | i.State = state |
| 544 | return true |
| 545 | }) |
| 546 | |
| 547 | if err != nil { |
| 548 | level.Warn(l.logger).Log("msg", "failed to change instance state in the ring", "from", l.GetState(), "to", state, "err", err) |
| 549 | } |
| 550 | |
| 551 | return err |
| 552 | } |
| 553 | |
| 554 | func (l *BasicLifecycler) changeReadOnlyState(ctx context.Context, readOnly bool) error { |
| 555 | err := l.updateInstance(ctx, func(_ *Desc, i *InstanceDesc) bool { |
no test coverage detected