MCPcopy
hub / github.com/redis/go-redis / Vote

Method Vote

ring.go:299–312  ·  view source on GitHub ↗

Vote votes to set shard state and returns true if state was changed.

(up bool)

Source from the content-addressed store, hash-verified

297
298// Vote votes to set shard state and returns true if state was changed.
299func (shard *ringShard) Vote(up bool) bool {
300 if up {
301 changed := shard.IsDown()
302 atomic.StoreInt32(&shard.down, 0)
303 return changed
304 }
305
306 if shard.IsDown() {
307 return false
308 }
309
310 atomic.AddInt32(&shard.down, 1)
311 return shard.IsDown()
312}
313
314//------------------------------------------------------------------------------
315

Callers 1

HeartbeatMethod · 0.80

Calls 1

IsDownMethod · 0.95

Tested by

no test coverage detected