Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: impl/prod/module.go

Issue 1772943003: Add wrappers for the module module (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: CL comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « impl/prod/context.go ('k') | service/module/context.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 prod
6
7 import (
8 "github.com/luci/gae/service/module"
9 "golang.org/x/net/context"
10 aeModule "google.golang.org/appengine/module"
11 )
12
13 // useModule adds a Module implementation to context.
14 func useModule(usrCtx context.Context) context.Context {
15 return module.SetFactory(usrCtx, func(ci context.Context) module.Interfa ce {
16 return modImpl{ci, AEContext(ci)}
17 })
18 }
19
20 type modImpl struct {
21 usrCtx context.Context
22 aeCtx context.Context
23 }
24
25 func (m modImpl) List() ([]string, error) {
26 return aeModule.List(m.aeCtx)
27 }
28
29 func (m modImpl) NumInstances(module, version string) (int, error) {
30 return aeModule.NumInstances(m.aeCtx, module, version)
31 }
32
33 func (m modImpl) SetNumInstances(module, version string, instances int) error {
34 return aeModule.SetNumInstances(m.aeCtx, module, version, instances)
35 }
36
37 func (m modImpl) Versions(module string) ([]string, error) {
38 return aeModule.Versions(m.aeCtx, module)
39 }
40
41 func (m modImpl) DefaultVersion(module string) (string, error) {
42 return aeModule.DefaultVersion(m.aeCtx, module)
43 }
44
45 func (m modImpl) Start(module, version string) error {
46 return aeModule.Start(m.aeCtx, module, version)
47 }
48
49 func (m modImpl) Stop(module, version string) error {
50 return aeModule.Stop(m.aeCtx, module, version)
51 }
OLDNEW
« no previous file with comments | « impl/prod/context.go ('k') | service/module/context.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698