Index: impl/memory/module.go |
diff --git a/impl/memory/module.go b/impl/memory/module.go |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ad09a31ab6ca8a5086b0a396737650940e073799 |
--- /dev/null |
+++ b/impl/memory/module.go |
@@ -0,0 +1,55 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package memory |
+ |
+import ( |
+ "github.com/luci/gae/service/module" |
+ "golang.org/x/net/context" |
+) |
+ |
+type modContextKeyType int |
+ |
+var modContextKey modContextKeyType |
+ |
+type modImpl struct { |
+ c context.Context |
+} |
+ |
+// useMod adds a Module interface to the context |
+func useMod(c context.Context) context.Context { |
+ return module.SetFactory(c, func(ic context.Context) module.Interface { |
+ return &modImpl{ic} |
+ }) |
+} |
+ |
+var _ = module.Interface((*modImpl)(nil)) |
+ |
+func (mod *modImpl) List() ([]string, error) { |
+ return []string{"testModule1", "testModule2"}, nil |
+} |
+ |
+func (mod *modImpl) NumInstances(module, version string) (int, error) { |
+ return 1, nil |
+} |
+ |
+func (mod *modImpl) SetNumInstances(module, version string, instances int) error { |
+ return nil |
+} |
iannucci1
2016/03/08 07:44:26
this should probably change the number of instance
dsansome
2016/03/08 10:55:36
Done.
|
+ |
+func (mod *modImpl) Versions(module string) ([]string, error) { |
+ return []string{"testVersion1", "testVersion2"}, nil |
+} |
+ |
+func (mod *modImpl) DefaultVersion(module string) (string, error) { |
+ return "testVersion1", nil |
+} |
+ |
+func (mod *modImpl) Start(module, version string) error { |
+ return nil |
+} |
+ |
+func (mod *modImpl) Stop(module, version string) error { |
+ return nil |
+} |
iannucci1
2016/03/08 07:44:26
I guess we'll expand this implementation as needed
dsansome
2016/03/08 10:55:36
Sure!
|