当前位置: 首页>>代码示例>>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;未经允许,请勿转载。