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

Function WaitRingTokensStability

ring/util.go:72–74  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

70// This can be used to avoid wasting resources on moving data around
71// due to multiple changes in the Ring.
72func WaitRingTokensStability(ctx context.Context, r ReadRing, op Operation, minStability, maxWaiting time.Duration) error {
73 return waitStability(ctx, r, op, minStability, maxWaiting, HasReplicationSetChangedWithoutState)
74}
75
76func 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.

Calls 1

waitStabilityFunction · 0.85