本文整理匯總了Golang中github.com/cloudfoundry-incubator/garden.ContainerSpec.GraceTime方法的典型用法代碼示例。如果您正苦於以下問題:Golang ContainerSpec.GraceTime方法的具體用法?Golang ContainerSpec.GraceTime怎麽用?Golang ContainerSpec.GraceTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry-incubator/garden.ContainerSpec
的用法示例。
在下文中一共展示了ContainerSpec.GraceTime方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: handleCreate
func (s *GardenServer) handleCreate(w http.ResponseWriter, r *http.Request) {
var spec garden.ContainerSpec
if !s.readRequest(&spec, w, r) {
return
}
hLog := s.logger.Session("create", lager.Data{
"request": spec,
})
if spec.GraceTime == 0 {
spec.GraceTime = s.containerGraceTime
}
hLog.Debug("creating")
container, err := s.backend.Create(spec)
if err != nil {
s.writeError(w, err, hLog)
return
}
hLog.Info("created")
s.bomberman.Strap(container)
s.writeResponse(w, &struct{ Handle string }{
Handle: container.Handle(),
})
}
示例2: handleCreate
func (s *GardenServer) handleCreate(w http.ResponseWriter, r *http.Request) {
var spec garden.ContainerSpec
if !s.readRequest(&spec, w, r) {
return
}
hLog := s.logger.Session("create", lager.Data{
"request": containerDebugInfo{
Handle: spec.Handle,
GraceTime: spec.GraceTime,
RootFSPath: spec.RootFSPath,
BindMounts: spec.BindMounts,
Network: spec.Network,
Privileged: spec.Privileged,
Limits: spec.Limits,
},
})
if spec.GraceTime == 0 {
spec.GraceTime = s.containerGraceTime
}
hLog.Debug("creating")
container, err := s.backend.Create(spec)
if err != nil {
s.writeError(w, err, hLog)
return
}
hLog.Info("created")
s.bomberman.Strap(container)
s.writeResponse(w, &struct{ Handle string }{
Handle: container.Handle(),
})
}