本文整理匯總了Golang中github.com/diffeo/go-coordinate/coordinate.Worker.Expiration方法的典型用法代碼示例。如果您正苦於以下問題:Golang Worker.Expiration方法的具體用法?Golang Worker.Expiration怎麽用?Golang Worker.Expiration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/diffeo/go-coordinate/coordinate.Worker
的用法示例。
在下文中一共展示了Worker.Expiration方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: fillWorker
func (api *restAPI) fillWorker(namespace coordinate.Namespace, worker coordinate.Worker, result *restdata.Worker) error {
err := api.fillWorkerShort(namespace, worker, &result.WorkerShort)
if err == nil {
err = buildURLs(api.Router,
"namespace", namespace.Name(),
"worker", worker.Name(),
).
URL(&result.RequestAttemptsURL, "workerRequestAttempts").
URL(&result.MakeAttemptURL, "workerMakeAttempt").
URL(&result.ActiveAttemptsURL, "workerActiveAttempts").
URL(&result.AllAttemptsURL, "workerAllAttempts").
URL(&result.ChildAttemptsURL, "workerChildAttempts").
Error
}
var parent coordinate.Worker
if err == nil {
parent, err = worker.Parent()
}
if err == nil && parent != nil {
parentName := parent.Name()
result.Parent = &parentName
err = buildURLs(api.Router,
"namespace", namespace.Name(),
"worker", parent.Name(),
).
URL(&result.ParentURL, "worker").
Error
}
var children []coordinate.Worker
if err == nil {
children, err = worker.Children()
}
if err == nil {
result.ChildURLs = make([]string, len(children))
for i, child := range children {
err = buildURLs(api.Router,
"namespace", namespace.Name(),
"worker", child.Name(),
).
URL(&result.ChildURLs[i], "worker").
Error
if err != nil {
break
}
}
}
if err == nil {
result.Active, err = worker.Active()
}
if err == nil {
result.Mode, err = worker.Mode()
}
if err == nil {
result.Data, err = worker.Data()
}
if err == nil {
result.Expiration, err = worker.Expiration()
}
if err == nil {
result.LastUpdate, err = worker.LastUpdate()
}
return err
}