Exemple #1
0
func (e *Etcd) DeleteService(serviceName string) error {
	servicePath := path.Join(TycoonDir, serviceName)
	doption := new(client.DeleteOptions)
	doption.Dir = true
	doption.Recursive = true

	Response, err := e.client.Delete(context.Background(), servicePath, doption)
	log.Debugf("etcdclient.DeleteService():DeleteService On etcd Respone %+v", Response)
	return err
}
Exemple #2
0
func (etcd *EtcdSource) remove(node Node) error {
	var opts = client.DeleteOptions{
		Dir: node.IsDir,
	}

	if node.IsDir {
		opts.Recursive = true
	}

	if _, err := etcd.keysAPI.Delete(context.Background(), etcd.path(node.Path), &opts); err != nil {
		return fixupClusterError(err)
	} else {
		return nil
	}
}
Exemple #3
0
func (e *Etcd) UpdateServiceContainerIds(serviceName string, containerIds []string) error {
	servicePath := path.Join(TycoonDir, serviceName)
	doption := new(client.DeleteOptions)
	doption.Dir = true
	doption.Recursive = true

	Response, err := e.client.Delete(context.Background(), servicePath+"/ContainerIds/", doption)
	log.Debugf("etcdclient.CreateService():CreateService ServiceConfig On etcd Respone %+v", Response)
	if err != nil {
		return err
	}

	for index := range containerIds {
		Response, err := e.client.Create(context.Background(), servicePath+"/ContainerIds/"+containerIds[index], containerIds[index])
		log.Debugf("etcdclient.CreateService():CreateService ContainerIds On etcd Respone %+v", Response)
		if err != nil {
			return err
		}
	}
	return nil
}