OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package mutate | |
6 | |
7 import ( | |
8 "golang.org/x/net/context" | |
9 | |
10 "github.com/luci/gae/service/datastore" | |
11 "github.com/luci/luci-go/appengine/cmd/dm/model" | |
12 "github.com/luci/luci-go/appengine/tumble" | |
13 "github.com/luci/luci-go/common/api/dm/service/v1" | |
14 ) | |
15 | |
16 // 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.
| |
17 // SCHEDULING->RUNNING state, and resetting the execution timeout (if any). | |
18 type ActivateExecution struct { | |
19 Auth *dm.Execution_Auth | |
20 NewTok []byte | |
21 } | |
22 | |
23 // Root implements tumble.Mutation. | |
24 func (a *ActivateExecution) Root(c context.Context) *datastore.Key { | |
25 return model.AttemptKeyFromID(c, a.Auth.Id.AttemptID()) | |
26 } | |
27 | |
28 // RollForward implements tumble.Mutation | |
29 func (a *ActivateExecution) RollForward(c context.Context) (muts []tumble.Mutati on, err error) { | |
30 _, e, err := model.ActivateExecution(c, a.Auth, a.NewTok) | |
31 if err == nil { | |
32 err = ResetExecutionTimeout(c, e) | |
33 } | |
34 return | |
35 } | |
36 | |
37 func init() { | |
38 tumble.Register((*ActivateExecution)(nil)) | |
39 } | |
OLD | NEW |