func()

in ringpop.go [417:442]


func (rp *Ringpop) Bootstrap(bootstrapOpts *swim.BootstrapOptions) ([]string, error) {
	if rp.getState() < initialized {
		err := rp.init()
		if err != nil {
			return nil, err
		}
	}

	// We shouldn't try to bootstrap if the channel is not listening
	if rp.channel.State() != tchannel.ChannelListening {
		rp.logger.WithField("channelState", rp.channel.State()).Error(ErrChannelNotListening.Error())
		return nil, ErrChannelNotListening
	}

	joined, err := rp.node.Bootstrap(bootstrapOpts)
	if err != nil {
		rp.logger.WithField("error", err).Info("bootstrap failed")
		rp.setState(initialized)
		return nil, err
	}

	rp.setState(ready)

	rp.logger.WithField("joined", joined).Info("bootstrap complete")
	return joined, nil
}