MCPcopy
hub / github.com/grpc/grpc-go / swap

Method swap

internal/xds/balancer/outlierdetection/callcounter.go:58–66  ·  view source on GitHub ↗

"When the timer triggers, the inactive bucket is zeroed and swapped with the active bucket. Then the inactive bucket contains the number of successes and failures since the last time the timer triggered. Those numbers are used to evaluate the ejection criteria." - A50.

()

Source from the content-addressed store, hash-verified

56// failures since the last time the timer triggered. Those numbers are used to
57// evaluate the ejection criteria." - A50.
58func (cc *callCounter) swap() {
59 ib := cc.inactiveBucket
60 *ib = bucket{}
61 ab := cc.activeBucket.Swap(ib)
62 cc.inactiveBucket = &bucket{
63 numSuccesses: atomic.LoadUint32(&ab.numSuccesses),
64 numFailures: atomic.LoadUint32(&ab.numFailures),
65 }
66}

Callers 2

TestSwapMethod · 0.45

Calls 1

SwapMethod · 0.45

Tested by 1

TestSwapMethod · 0.36