MCPcopy Create free account
hub / github.com/dadgar/onecache / serfEventHandler

Method serfEventHandler

onecache/onecache.go:158–181  ·  view source on GitHub ↗

serfEventHandler is a dispatch method on Serf Events. Should be started in a goroutine.

()

Source from the content-addressed store, hash-verified

156// serfEventHandler is a dispatch method on Serf Events. Should be started in a
157// goroutine.
158func (n *Node) serfEventHandler() {
159 for {
160 select {
161 case <-n.quitCh:
162 return
163 case e := <-n.eventCh:
164 switch t := e.(type) {
165 case serf.MemberEvent:
166 switch t.EventType() {
167 case serf.EventMemberJoin:
168 go n.handleNodeJoins(t.Members)
169 case serf.EventMemberLeave, serf.EventMemberFailed:
170 go n.handleNodeLeaves(t.Members)
171 default:
172 // Don't handle any other event type.
173 continue
174 }
175 default:
176 n.logger.Printf("[ERROR] onecache: unexpected Serf event type %v\n", t)
177 continue
178 }
179 }
180 }
181}
182
183// Exit removes this Node from the ring, kills background tasks and frees any
184// used resources. Once this is called the Node will no longer accept

Callers 1

StartMethod · 0.95

Calls 2

handleNodeJoinsMethod · 0.95
handleNodeLeavesMethod · 0.95

Tested by

no test coverage detected