MCPcopy
hub / github.com/olric-data/olric / Join

Method Join

internal/discovery/discovery.go:196–205  ·  view source on GitHub ↗

Join is used to take an existing Memberlist and attempt to Join a cluster by contacting all the given hosts and performing a state sync. Initially, the Memberlist only contains our own state, so doing this will cause remote nodes to become aware of the existence of this node, effectively joining the

()

Source from the content-addressed store, hash-verified

194// the Memberlist only contains our own state, so doing this will cause remote
195// nodes to become aware of the existence of this node, effectively joining the cluster.
196func (d *Discovery) Join() (int, error) {
197 if d.serviceDiscovery != nil {
198 peers, err := d.serviceDiscovery.DiscoverPeers()
199 if err != nil {
200 return 0, err
201 }
202 return d.memberlist.Join(peers)
203 }
204 return d.memberlist.Join(d.config.Peers)
205}
206
207func (d *Discovery) Rejoin(peers []string) (int, error) {
208 return d.memberlist.Join(peers)

Callers 5

StartMethod · 0.45
AddMemberMethod · 0.45
addNewMemberMethod · 0.45
RejoinMethod · 0.45

Calls 1

DiscoverPeersMethod · 0.65

Tested by 2

addNewMemberMethod · 0.36