Create will create a new Memberlist using the given configuration. This will not connect to any other node (see Join) yet, but will start all the listeners to allow other nodes to join this memberlist. After creating a Memberlist, the configuration given should not be modified by the user anymore.
(conf *Config)
| 246 | // After creating a Memberlist, the configuration given should not be |
| 247 | // modified by the user anymore. |
| 248 | func Create(conf *Config) (*Memberlist, error) { |
| 249 | m, err := newMemberlist(conf) |
| 250 | if err != nil { |
| 251 | return nil, err |
| 252 | } |
| 253 | if err := m.setAlive(); err != nil { |
| 254 | _ = m.Shutdown() |
| 255 | return nil, err |
| 256 | } |
| 257 | m.schedule() |
| 258 | return m, nil |
| 259 | } |
| 260 | |
| 261 | // Join is used to take an existing Memberlist and attempt to join a cluster |
| 262 | // by contacting all the given hosts and performing a state sync. Initially, |
searching dependent graphs…