OLD | NEW |
1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 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 prod | 5 package prod |
6 | 6 |
7 import ( | 7 import ( |
8 "github.com/luci/gae/service/module" | 8 "github.com/luci/gae/service/module" |
9 "golang.org/x/net/context" | 9 "golang.org/x/net/context" |
10 aeModule "google.golang.org/appengine/module" | 10 aeModule "google.golang.org/appengine/module" |
11 ) | 11 ) |
12 | 12 |
13 // useModule adds a Module implementation to context. | 13 // useModule adds a Module implementation to context. |
14 func useModule(usrCtx context.Context) context.Context { | 14 func useModule(usrCtx context.Context) context.Context { |
15 return module.SetFactory(usrCtx, func(ci context.Context) module.RawInte
rface { | 15 return module.SetFactory(usrCtx, func(ci context.Context) module.RawInte
rface { |
16 » » return modImpl{AEContext(ci)} | 16 » » return modImpl{getAEContext(ci)} |
17 }) | 17 }) |
18 } | 18 } |
19 | 19 |
20 type modImpl struct { | 20 type modImpl struct { |
21 aeCtx context.Context | 21 aeCtx context.Context |
22 } | 22 } |
23 | 23 |
24 func (m modImpl) List() ([]string, error) { | 24 func (m modImpl) List() ([]string, error) { |
25 return aeModule.List(m.aeCtx) | 25 return aeModule.List(m.aeCtx) |
26 } | 26 } |
(...skipping 14 matching lines...) Expand all Loading... |
41 return aeModule.DefaultVersion(m.aeCtx, module) | 41 return aeModule.DefaultVersion(m.aeCtx, module) |
42 } | 42 } |
43 | 43 |
44 func (m modImpl) Start(module, version string) error { | 44 func (m modImpl) Start(module, version string) error { |
45 return aeModule.Start(m.aeCtx, module, version) | 45 return aeModule.Start(m.aeCtx, module, version) |
46 } | 46 } |
47 | 47 |
48 func (m modImpl) Stop(module, version string) error { | 48 func (m modImpl) Stop(module, version string) error { |
49 return aeModule.Stop(m.aeCtx, module, version) | 49 return aeModule.Stop(m.aeCtx, module, version) |
50 } | 50 } |
OLD | NEW |