本文整理匯總了Golang中github.com/eris-ltd/eris-cli/definitions.Do.Timeout方法的典型用法代碼示例。如果您正苦於以下問題:Golang Do.Timeout方法的具體用法?Golang Do.Timeout怎麽用?Golang Do.Timeout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/eris-ltd/eris-cli/definitions.Do
的用法示例。
在下文中一共展示了Do.Timeout方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: KillChain
func KillChain(do *definitions.Do) error {
chain, err := loaders.LoadChainDefinition(do.Name, false, do.Operations.ContainerNumber)
if err != nil {
return err
}
if do.Force {
do.Timeout = 0 //overrides 10 sec default
}
if IsChainRunning(chain) {
if err := perform.DockerStop(chain.Service, chain.Operations, do.Timeout); err != nil {
return err
}
} else {
logger.Infoln("Chain not currently running. Skipping.")
}
if do.Rm {
if err := perform.DockerRemove(chain.Service, chain.Operations, do.RmD, do.Volumes); err != nil {
return err
}
}
return nil
}
示例2: KillService
func KillService(do *definitions.Do) error {
var services []*definitions.ServiceDefinition
for _, servName := range do.Args {
s, e := BuildServicesGroup(servName, do.Operations.ContainerNumber)
if e != nil {
return e
}
services = append(services, s...)
}
var err error
services, err = BuildChainGroup(do.ChainName, services)
if err != nil {
return err
}
// if force flag given, this will override any timeout flag
if do.Force {
do.Timeout = 0
}
for _, service := range services {
if IsServiceRunning(service.Service, service.Operations) {
logger.Debugf("Stopping Service =>\t\t%s:%d\n", service.Service.Name, service.Operations.ContainerNumber)
if err := perform.DockerStop(service.Service, service.Operations, do.Timeout); err != nil {
return err
}
} else {
logger.Infoln("Service not currently running. Skipping.")
}
if do.Rm {
if err := perform.DockerRemove(service.Service, service.Operations, do.RmD); err != nil {
return err
}
}
}
return nil
}
示例3: KillService
func KillService(do *definitions.Do) (err error) {
var services []*definitions.ServiceDefinition
log.WithField("args", do.Operations.Args).Info("Building services group")
for _, servName := range do.Operations.Args {
s, e := BuildServicesGroup(servName, do.Operations.ContainerNumber)
if e != nil {
return e
}
services = append(services, s...)
}
// if force flag given, this will override any timeout flag
if do.Force {
do.Timeout = 0
}
for _, service := range services {
if IsServiceRunning(service.Service, service.Operations) {
log.WithField("=>", fmt.Sprintf("%s:%d", service.Service.Name, service.Operations.ContainerNumber)).Debug("Stopping service")
if err := perform.DockerStop(service.Service, service.Operations, do.Timeout); err != nil {
return err
}
} else {
log.WithField("=>", service.Service.Name).Info("Service not currently running. Skipping")
}
if do.Rm {
if err := perform.DockerRemove(service.Service, service.Operations, do.RmD, do.Volumes, do.Force); err != nil {
return err
}
}
}
return nil
}