WaitRingTokensStability waits for the Ring to be unchanged at least for minStability time period, excluding transitioning between allowed states (e.g. JOINING->ACTIVE if allowed by op). This can be used to avoid wasting resources on moving data around due to multiple changes in the Ring.
(ctx context.Context, r ReadRing, op Operation, minStability, maxWaiting time.Duration)
| 70 | // This can be used to avoid wasting resources on moving data around |
| 71 | // due to multiple changes in the Ring. |
| 72 | func WaitRingTokensStability(ctx context.Context, r ReadRing, op Operation, minStability, maxWaiting time.Duration) error { |
| 73 | return waitStability(ctx, r, op, minStability, maxWaiting, HasReplicationSetChangedWithoutState) |
| 74 | } |
| 75 | |
| 76 | func waitStability(ctx context.Context, r ReadRing, op Operation, minStability, maxWaiting time.Duration, isChanged func(ReplicationSet, ReplicationSet) bool) error { |
| 77 | // Configure the max waiting time as a context deadline. |