本文整理汇总了Golang中github.com/diffeo/go-coordinate/coordinate.Worker.Mode方法的典型用法代码示例。如果您正苦于以下问题:Golang Worker.Mode方法的具体用法?Golang Worker.Mode怎么用?Golang Worker.Mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/diffeo/go-coordinate/coordinate.Worker
的用法示例。
在下文中一共展示了Worker.Mode方法的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
}