func (c *cluster) SetVersion(ver *semver.Version) { c.Lock() defer c.Unlock() if c.version != nil { plog.Noticef("updated the cluster version from %v to %v", version.Cluster(c.version.String()), version.Cluster(ver.String())) } else { plog.Noticef("set the initial cluster version to %v", version.Cluster(ver.String())) } c.version = ver MustDetectDowngrade(c.version) }
func (c *cluster) Recover() { c.members, c.removed = membersFromStore(c.store) c.version = clusterVersionFromStore(c.store) MustDetectDowngrade(c.version) for _, m := range c.members { plog.Infof("added member %s %v to cluster %s from store", m.ID, m.PeerURLs, c.id) } if c.version != nil { plog.Infof("set the cluster version to %v from store", version.Cluster(c.version.String())) } }