當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Namespace.Name方法代碼示例

本文整理匯總了Golang中github.com/diffeo/go-coordinate/coordinate.Namespace.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang Namespace.Name方法的具體用法?Golang Namespace.Name怎麽用?Golang Namespace.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/diffeo/go-coordinate/coordinate.Namespace的用法示例。


在下文中一共展示了Namespace.Name方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: fillWorkSpecShort

func (api *restAPI) fillWorkSpecShort(namespace coordinate.Namespace, name string, short *restdata.WorkSpecShort) error {
	short.Name = name
	return buildURLs(api.Router,
		"namespace", namespace.Name(),
		"spec", name,
	).URL(&short.URL, "workSpec").Error
}
開發者ID:diffeo,項目名稱:go-coordinate,代碼行數:7,代碼來源:work_spec.go

示例2: fillWorkerShort

func (api *restAPI) fillWorkerShort(namespace coordinate.Namespace, worker coordinate.Worker, short *restdata.WorkerShort) error {
	short.Name = worker.Name()
	return buildURLs(api.Router,
		"namespace", namespace.Name(),
		"worker", short.Name,
	).
		URL(&short.URL, "worker").
		Error
}
開發者ID:diffeo,項目名稱:go-coordinate,代碼行數:9,代碼來源:worker.go

示例3: attemptURLBuilder

func (api *restAPI) attemptURLBuilder(namespace coordinate.Namespace, attempt coordinate.Attempt, startTime time.Time, err error) *urlBuilder {
	unit := attempt.WorkUnit()
	spec := unit.WorkSpec()
	worker := attempt.Worker()
	if err == nil {
		return buildURLs(api.Router,
			"namespace", namespace.Name(),
			"spec", spec.Name(),
			"unit", unit.Name(),
			"worker", worker.Name(),
			"start", startTime.Format(time.RFC3339),
		)
	}
	return &urlBuilder{Error: err}
}
開發者ID:diffeo,項目名稱:go-coordinate,代碼行數:15,代碼來源:attempt.go

示例4: fillWorkUnit

func (api *restAPI) fillWorkUnit(namespace coordinate.Namespace, spec coordinate.WorkSpec, unit coordinate.WorkUnit, repr *restdata.WorkUnit) error {
	err := api.fillWorkUnitShort(namespace, spec, unit.Name(), &repr.WorkUnitShort)
	if err == nil {
		repr.Data, err = unit.Data()
	}
	if err == nil {
		var meta coordinate.WorkUnitMeta
		meta, err = unit.Meta()
		repr.Meta = &meta
	}
	if err == nil {
		repr.Status, err = unit.Status()
	}
	if err == nil {
		err = buildURLs(api.Router,
			"namespace", namespace.Name(),
			"spec", spec.Name(),
			"unit", unit.Name(),
		).
			URL(&repr.WorkSpecURL, "workSpec").
			URL(&repr.AttemptsURL, "workUnitAttempts").
			Error
	}
	if err == nil {
		var attempt coordinate.Attempt
		attempt, err = unit.ActiveAttempt()
		if err == nil && attempt != nil {
			// This is cheating, a little, but it's probably
			// the easiest way to reuse this code
			var short restdata.AttemptShort
			err = api.fillAttemptShort(namespace, attempt, &short)
			if err == nil {
				repr.ActiveAttemptURL = short.URL
			}
		}
	}
	return err
}
開發者ID:diffeo,項目名稱:go-coordinate,代碼行數:38,代碼來源:work_unit.go

示例5: fillWorkSpec

func (api *restAPI) fillWorkSpec(namespace coordinate.Namespace, name string, repr *restdata.WorkSpec) error {
	err := api.fillWorkSpecShort(namespace, name, &repr.WorkSpecShort)
	if err == nil {
		err = buildURLs(api.Router,
			"namespace", namespace.Name(),
			"spec", name).
			URL(&repr.WorkUnitsURL, "workUnits").
			Template(&repr.WorkUnitURL, "workUnit", "unit").
			URL(&repr.MetaURL, "workSpecMeta").
			URL(&repr.WorkUnitCountsURL, "workSpecCounts").
			URL(&repr.WorkUnitChangeURL, "workSpecChange").
			URL(&repr.WorkUnitAdjustURL, "workSpecAdjust").
			Error
	}
	if err == nil {
		repr.MetaURL += "{?counts}"
		qs := "{?name*,status*,previous,limit}"
		repr.WorkUnitQueryURL = repr.WorkUnitsURL + qs
		repr.WorkUnitChangeURL += qs
		repr.WorkUnitAdjustURL += qs
	}
	return err
}
開發者ID:diffeo,項目名稱:go-coordinate,代碼行數:23,代碼來源:work_spec.go

示例6: fillNamespaceShort

func (api *restAPI) fillNamespaceShort(namespace coordinate.Namespace, summary *restdata.NamespaceShort) error {
	summary.Name = namespace.Name()
	return buildURLs(api.Router, "namespace", summary.Name).
		URL(&summary.URL, "namespace").
		Error
}
開發者ID:diffeo,項目名稱:go-coordinate,代碼行數:6,代碼來源:namespace.go

示例7: 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
}
開發者ID:diffeo,項目名稱:go-coordinate,代碼行數:63,代碼來源:worker.go


注:本文中的github.com/diffeo/go-coordinate/coordinate.Namespace.Name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。