Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 memory | |
| 6 | |
| 7 import ( | |
| 8 "github.com/luci/gae/service/module" | |
| 9 "golang.org/x/net/context" | |
| 10 ) | |
| 11 | |
| 12 type modContextKeyType int | |
| 13 | |
| 14 var modContextKey modContextKeyType | |
| 15 | |
| 16 type modImpl struct { | |
| 17 c context.Context | |
| 18 } | |
| 19 | |
| 20 // useMod adds a Module interface to the context | |
| 21 func useMod(c context.Context) context.Context { | |
| 22 return module.SetFactory(c, func(ic context.Context) module.Interface { | |
| 23 return &modImpl{ic} | |
| 24 }) | |
| 25 } | |
| 26 | |
| 27 var _ = module.Interface((*modImpl)(nil)) | |
| 28 | |
| 29 func (mod *modImpl) List() ([]string, error) { | |
| 30 return []string{"testModule1", "testModule2"}, nil | |
| 31 } | |
| 32 | |
| 33 func (mod *modImpl) NumInstances(module, version string) (int, error) { | |
| 34 return 1, nil | |
| 35 } | |
| 36 | |
| 37 func (mod *modImpl) SetNumInstances(module, version string, instances int) error { | |
| 38 return nil | |
| 39 } | |
|
iannucci1
2016/03/08 07:44:26
this should probably change the number of instance
dsansome
2016/03/08 10:55:36
Done.
| |
| 40 | |
| 41 func (mod *modImpl) Versions(module string) ([]string, error) { | |
| 42 return []string{"testVersion1", "testVersion2"}, nil | |
| 43 } | |
| 44 | |
| 45 func (mod *modImpl) DefaultVersion(module string) (string, error) { | |
| 46 return "testVersion1", nil | |
| 47 } | |
| 48 | |
| 49 func (mod *modImpl) Start(module, version string) error { | |
| 50 return nil | |
| 51 } | |
| 52 | |
| 53 func (mod *modImpl) Stop(module, version string) error { | |
| 54 return nil | |
| 55 } | |
|
iannucci1
2016/03/08 07:44:26
I guess we'll expand this implementation as needed
dsansome
2016/03/08 10:55:36
Sure!
| |
| OLD | NEW |