本文整理匯總了Golang中github.com/control-center/serviced/domain/service.Service.DesiredState方法的典型用法代碼示例。如果您正苦於以下問題:Golang Service.DesiredState方法的具體用法?Golang Service.DesiredState怎麽用?Golang Service.DesiredState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/control-center/serviced/domain/service.Service
的用法示例。
在下文中一共展示了Service.DesiredState方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: UpdateService
func (f *Facade) UpdateService(ctx datastore.Context, svc service.Service) error {
glog.V(2).Infof("Facade.UpdateService: %+v", svc)
//cannot update service without validating it.
if svc.DesiredState != int(service.SVCStop) {
if err := f.validateServicesForStarting(ctx, &svc); err != nil {
glog.Warningf("Could not validate service %s (%s) for starting: %s", svc.Name, svc.ID, err)
svc.DesiredState = int(service.SVCStop)
}
for _, ep := range svc.GetServiceVHosts() {
for _, vh := range ep.VHosts {
//check that vhosts aren't already started elsewhere
if err := zkAPI(f).CheckRunningVHost(vh, svc.ID); err != nil {
return err
}
}
}
}
return f.updateService(ctx, &svc)
}