本文整理汇总了Golang中github.com/GoogleCloudPlatform/kubernetes/pkg/tools.IsEtcdNodeExist函数的典型用法代码示例。如果您正苦于以下问题:Golang IsEtcdNodeExist函数的具体用法?Golang IsEtcdNodeExist怎么用?Golang IsEtcdNodeExist使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsEtcdNodeExist函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: becomeMaster
// becomeMaster attempts to become the master for this lock.
// returns "", nil if the attempt failed
// returns id, nil if the attempt succeeded
// returns "", err if an error occurred
func (e *etcdMasterElector) becomeMaster(path, id string, ttl uint64) (string, error) {
_, err := e.etcd.Create(path, id, ttl)
if err != nil && !tools.IsEtcdNodeExist(err) {
// unexpected error
return "", err
}
if err != nil && tools.IsEtcdNodeExist(err) {
return "", nil
}
return id, nil
}
开发者ID:K-A-Z,项目名称:kubernetes,代码行数:15,代码来源:etcd_master.go
示例2: CreateService
// CreateService creates a new Service.
func (r *Registry) CreateService(svc api.Service) error {
err := r.CreateObj(makeServiceKey(svc.ID), svc)
if tools.IsEtcdNodeExist(err) {
return apiserver.NewAlreadyExistsErr("service", svc.ID)
}
return err
}
开发者ID:nvdnkpr,项目名称:kubernetes,代码行数:8,代码来源:etcd.go
示例3: CreateController
// CreateController creates a new ReplicationController.
func (r *Registry) CreateController(controller api.ReplicationController) error {
err := r.CreateObj(makeControllerKey(controller.ID), controller)
if tools.IsEtcdNodeExist(err) {
return apiserver.NewAlreadyExistsErr("replicationController", controller.ID)
}
return err
}
开发者ID:nvdnkpr,项目名称:kubernetes,代码行数:8,代码来源:etcd.go
示例4: CreateImage
// CreateImage creates a new image
func (r *Etcd) CreateImage(image *api.Image) error {
err := r.CreateObj(makeImageKey(image.ID), image)
if tools.IsEtcdNodeExist(err) {
return apierrors.NewAlreadyExists("image", image.ID)
}
return err
}
开发者ID:rajdavies,项目名称:origin,代码行数:8,代码来源:etcd.go
示例5: CreateBuild
// CreateBuild creates a new Build.
func (r *EtcdRegistry) CreateBuild(build *api.Build) error {
err := r.CreateObj(makeBuildKey(build.ID), build)
if tools.IsEtcdNodeExist(err) {
return errors.NewAlreadyExists("build", build.ID)
}
return err
}
开发者ID:lmiccini,项目名称:origin,代码行数:8,代码来源:etcdregistry.go
示例6: CreateBuildConfig
// CreateBuildConfig creates a new BuildConfig.
func (r *EtcdRegistry) CreateBuildConfig(config *api.BuildConfig) error {
err := r.CreateObj(makeBuildConfigKey(config.ID), config)
if tools.IsEtcdNodeExist(err) {
return errors.NewAlreadyExists("buildConfig", config.ID)
}
return err
}
开发者ID:lmiccini,项目名称:origin,代码行数:8,代码来源:etcdregistry.go
示例7: CreateImageRepository
// CreateImageRepository registers the given ImageRepository.
func (r *Etcd) CreateImageRepository(repo *api.ImageRepository) error {
err := r.CreateObj(makeImageRepositoryKey(repo.ID), repo)
if err != nil && tools.IsEtcdNodeExist(err) {
return apierrors.NewAlreadyExists("imageRepository", repo.ID)
}
return err
}
开发者ID:rajdavies,项目名称:origin,代码行数:9,代码来源:etcd.go
示例8: InterpretUpdateError
// InterpretUpdateError converts a generic etcd error on a update
// operation into the appropriate API error.
func InterpretUpdateError(err error, kind, name string) error {
switch {
case tools.IsEtcdTestFailed(err), tools.IsEtcdNodeExist(err):
return errors.NewConflict(kind, name, err)
default:
return err
}
}
开发者ID:eghobo,项目名称:kubedash,代码行数:10,代码来源:etcd.go
示例9: InterpretCreateError
// InterpretCreateError converts a generic etcd error on a create
// operation into the appropriate API error.
func InterpretCreateError(err error, kind, name string) error {
switch {
case tools.IsEtcdNodeExist(err):
return errors.NewAlreadyExists(kind, name)
default:
return err
}
}
开发者ID:eghobo,项目名称:kubedash,代码行数:10,代码来源:etcd.go
示例10: InterpretCreateError
// InterpretCreateError converts a generic etcd error on a create
// operation into the appropriate API error.
func InterpretCreateError(err error, kind, name string) error {
switch {
case tools.IsEtcdNodeExist(err):
return errors.NewAlreadyExists(kind, name)
case errors.IsAPIStatusError(err):
return err
default:
return errors.NewInternalError(err)
}
}
开发者ID:alexmavr,项目名称:dashboard,代码行数:12,代码来源:etcd.go
注:本文中的github.com/GoogleCloudPlatform/kubernetes/pkg/tools.IsEtcdNodeExist函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论