示例#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())
	}
}
示例#2
0
文件: testetcd.go 项目: logan/heim
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
}
示例#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())
}