Index: appengine/cmd/dm/mutate/activate_execution.go |
diff --git a/appengine/cmd/dm/mutate/activate_execution.go b/appengine/cmd/dm/mutate/activate_execution.go |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1accd7c5d5709dd4cc7c2658180c31b6b6b66909 |
--- /dev/null |
+++ b/appengine/cmd/dm/mutate/activate_execution.go |
@@ -0,0 +1,39 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package mutate |
+ |
+import ( |
+ "golang.org/x/net/context" |
+ |
+ "github.com/luci/gae/service/datastore" |
+ "github.com/luci/luci-go/appengine/cmd/dm/model" |
+ "github.com/luci/luci-go/appengine/tumble" |
+ "github.com/luci/luci-go/common/api/dm/service/v1" |
+) |
+ |
+// ActivateExecution executions an execution, moving it from the |
dnj (Google)
2016/06/09 18:00:56
nit: executions an execution!
iannucci
2016/06/15 00:46:01
Done.
|
+// SCHEDULING->RUNNING state, and resetting the execution timeout (if any). |
+type ActivateExecution struct { |
+ Auth *dm.Execution_Auth |
+ NewTok []byte |
+} |
+ |
+// Root implements tumble.Mutation. |
+func (a *ActivateExecution) Root(c context.Context) *datastore.Key { |
+ return model.AttemptKeyFromID(c, a.Auth.Id.AttemptID()) |
+} |
+ |
+// RollForward implements tumble.Mutation |
+func (a *ActivateExecution) RollForward(c context.Context) (muts []tumble.Mutation, err error) { |
+ _, e, err := model.ActivateExecution(c, a.Auth, a.NewTok) |
+ if err == nil { |
+ err = ResetExecutionTimeout(c, e) |
+ } |
+ return |
+} |
+ |
+func init() { |
+ tumble.Register((*ActivateExecution)(nil)) |
+} |