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

Unified Diff: impl/memory/module.go

Issue 1772943003: Add wrappers for the module module (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « impl/memory/context.go ('k') | impl/prod/context.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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!
« no previous file with comments | « impl/memory/context.go ('k') | impl/prod/context.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698