Exemple #1
0
func (c *ClusterConfig) EtcdCluster(ctx scope.Context) (cluster.Cluster, error) {
	switch c.EtcdHost {
	case "":
		return nil, fmt.Errorf("cluster: etcd-host must be specified")
	case "mock":
		return &cluster.TestCluster{}, nil
	default:
		return etcd.EtcdCluster(ctx, c.EtcdHome, c.EtcdHost, c.DescribeSelf())
	}
}
Exemple #2
0
func (s *EtcdServer) Join(root, id, era string) cluster.Cluster {
	desc := &cluster.PeerDesc{
		ID:  id,
		Era: era,
	}
	c, err := etcd.EtcdCluster(scope.New(), root, s.addr, desc)
	if err != nil {
		panic(fmt.Sprintf("error joining cluster: %s", err))
	}
	return c
}
Exemple #3
0
func (c *ClusterConfig) EtcdCluster(ctx scope.Context) (cluster.Cluster, error) {
	if c.EtcdHost == "" {
		return nil, fmt.Errorf("cluster: etcd-host must be specified")
	}
	return etcd.EtcdCluster(ctx, c.EtcdHome, c.EtcdHost, c.DescribeSelf())
}