当前位置: 首页>>代码示例>>Golang>>正文


Golang Action.GetValue方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry-incubator/bbs/models.Action.GetValue方法的典型用法代码示例。如果您正苦于以下问题:Golang Action.GetValue方法的具体用法?Golang Action.GetValue怎么用?Golang Action.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry-incubator/bbs/models.Action的用法示例。


在下文中一共展示了Action.GetValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: updateTimeoutInAction

func updateTimeoutInAction(logger lager.Logger, action *models.Action) {
	if action == nil {
		logger.Debug("no-action-to-convert")
		return
	}

	a := action.GetValue()
	switch actionModel := a.(type) {
	case *models.RunAction, *models.DownloadAction, *models.UploadAction:
		return

	case *models.TimeoutAction:
		timeoutAction := actionModel
		timeoutAction.TimeoutMs = timeoutAction.DeprecatedTimeoutNs / 1000000

	case *models.EmitProgressAction:
		updateTimeoutInAction(logger, actionModel.Action)

	case *models.TryAction:
		updateTimeoutInAction(logger, actionModel.Action)

	case *models.ParallelAction:
		for _, subaction := range actionModel.Actions {
			updateTimeoutInAction(logger, subaction)
		}

	case *models.SerialAction:
		for _, subaction := range actionModel.Actions {
			updateTimeoutInAction(logger, subaction)
		}

	case *models.CodependentAction:
		for _, subaction := range actionModel.Actions {
			updateTimeoutInAction(logger, subaction)
		}
	}
}
开发者ID:timani,项目名称:bbs,代码行数:37,代码来源:1451635200_timeouts_to_milliseconds.go

示例2: StepFor

func (transformer *Transformer) StepFor(
	logStreamer log_streamer.LogStreamer,
	action *models.Action,
	container garden.Container,
	externalIP string,
	ports []executor.PortMapping,
	logger lager.Logger,
) steps.Step {

	a := action.GetValue()
	switch actionModel := a.(type) {
	case *models.RunAction:
		return steps.NewRun(
			container,
			*actionModel,
			logStreamer.WithSource(actionModel.LogSource),
			logger,
			externalIP,
			ports,
			transformer.exportNetworkEnvVars,
			transformer.clock,
		)

	case *models.DownloadAction:
		return steps.NewDownload(
			container,
			*actionModel,
			transformer.cachedDownloader,
			transformer.downloadLimiter,
			logStreamer.WithSource(actionModel.LogSource),
			logger,
		)

	case *models.UploadAction:
		return steps.NewUpload(
			container,
			*actionModel,
			transformer.uploader,
			transformer.compressor,
			transformer.tempDir,
			logStreamer.WithSource(actionModel.LogSource),
			transformer.uploadLimiter,
			logger,
		)

	case *models.EmitProgressAction:
		return steps.NewEmitProgress(
			transformer.StepFor(
				logStreamer,
				actionModel.Action,
				container,
				externalIP,
				ports,
				logger,
			),
			actionModel.StartMessage,
			actionModel.SuccessMessage,
			actionModel.FailureMessagePrefix,
			logStreamer.WithSource(actionModel.LogSource),
			logger,
		)

	case *models.TimeoutAction:
		return steps.NewTimeout(
			transformer.StepFor(
				logStreamer.WithSource(actionModel.LogSource),
				actionModel.Action,
				container,
				externalIP,
				ports,
				logger,
			),
			time.Duration(actionModel.Timeout),
			logger,
		)

	case *models.TryAction:
		return steps.NewTry(
			transformer.StepFor(
				logStreamer.WithSource(actionModel.LogSource),
				actionModel.Action,
				container,
				externalIP,
				ports,
				logger,
			),
			logger,
		)

	case *models.ParallelAction:
		subSteps := make([]steps.Step, len(actionModel.Actions))
		for i, action := range actionModel.Actions {
			subSteps[i] = transformer.StepFor(
				logStreamer.WithSource(actionModel.LogSource),
				action,
				container,
				externalIP,
				ports,
				logger,
			)
//.........这里部分代码省略.........
开发者ID:snowsnail,项目名称:executor,代码行数:101,代码来源:transformer.go


注:本文中的github.com/cloudfoundry-incubator/bbs/models.Action.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。