OLD | NEW |
1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
4 | 4 |
5 package deps | 5 package deps |
6 | 6 |
7 import ( | 7 import ( |
8 » "github.com/luci/gae/service/datastore" | 8 » "github.com/luci/luci-go/appengine/cmd/dm/mutate" |
9 » "github.com/luci/luci-go/appengine/cmd/dm/model" | 9 » dm "github.com/luci/luci-go/common/api/dm/service/v1" |
10 » "github.com/luci/luci-go/common/api/dm/service/v1" | 10 » "github.com/luci/luci-go/common/logging" |
11 google_pb "github.com/luci/luci-go/common/proto/google" | 11 google_pb "github.com/luci/luci-go/common/proto/google" |
12 "golang.org/x/net/context" | 12 "golang.org/x/net/context" |
13 ) | 13 ) |
14 | 14 |
15 func (d *deps) ActivateExecution(c context.Context, req *dm.ActivateExecutionReq
) (*google_pb.Empty, error) { | 15 func (d *deps) ActivateExecution(c context.Context, req *dm.ActivateExecutionReq
) (*google_pb.Empty, error) { |
16 » err := datastore.Get(c).RunInTransaction(func(c context.Context) error { | 16 » logging.Fields{"execution": req.Auth.Id}.Infof(c, "activating") |
17 » » _, _, err := model.ActivateExecution(c, req.Auth, req.ExecutionT
oken) | 17 » err := tumbleNow(c, &mutate.ActivateExecution{ |
18 » » return err | 18 » » Auth: req.Auth, |
19 » }, nil) | 19 » » NewTok: req.ExecutionToken, |
| 20 » }) |
20 return &google_pb.Empty{}, err | 21 return &google_pb.Empty{}, err |
21 } | 22 } |
OLD | NEW |