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

Method initSerf

onecache/onecache.go:135–154  ·  view source on GitHub ↗

initSerf initializes serf and advertizes this nodes RPC port to other nodes.

(config *serf.Config)

Source from the content-addressed store, hash-verified

133
134// initSerf initializes serf and advertizes this nodes RPC port to other nodes.
135func (n *Node) initSerf(config *serf.Config) error {
136 config.NodeName = n.name
137 config.EventCh = n.eventCh
138
139 // Advertize the RPC port
140 tags := map[string]string{
141 externalRpcTag: strconv.Itoa(n.port),
142 }
143
144 config.Tags = tags
145
146 // Start serf for discovery
147 s, err := serf.Create(config)
148 if err != nil {
149 return err
150 }
151
152 n.serf = s
153 return nil
154}
155
156// serfEventHandler is a dispatch method on Serf Events. Should be started in a
157// goroutine.

Callers 1

CreateFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected