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

Unified Diff: service/module/interface.go

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: Created 4 years, 4 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
Index: service/module/interface.go
diff --git a/service/module/interface.go b/service/module/interface.go
index 84c0de74b3c393f65606d41d5f3727bc5c95b432..f9816d0de6c9be27876fa84e61faa67b32c5b2da 100644
--- a/service/module/interface.go
+++ b/service/module/interface.go
@@ -4,9 +4,13 @@
package module
-// Interface is the interface for all of the package methods which normally
+import (
+ "golang.org/x/net/context"
+)
+
+// RawInterface is the interface for all of the package methods which normally
// would be in the 'module' package.
-type Interface interface {
+type RawInterface interface {
List() ([]string, error)
NumInstances(module, version string) (int, error)
SetNumInstances(module, version string, instances int) error
@@ -15,3 +19,52 @@ type Interface interface {
Start(module, version string) error
Stop(module, version string) error
}
+
+// List lists the names of modules belonging to this application.
+func List(c context.Context) ([]string, error) {
+ return Raw(c).List()
+}
+
+// NumInstances returns the number of instances servicing the specified
+// module/version.
+//
+// If module or version is the empty string, it means the default.
+func NumInstances(c context.Context, module, version string) (int, error) {
+ return Raw(c).NumInstances(module, version)
+}
+
+// SetNumInstances sets the number of instances of a given module/version.
+//
+// If module or version is the empty string, it means the default.
+func SetNumInstances(c context.Context, module, version string, instances int) error {
+ return Raw(c).SetNumInstances(module, version, instances)
+}
+
+// Versions returns the names of versions for the specified module.
+//
+// If module is the empty string, it means the default.
+func Versions(c context.Context, module string) ([]string, error) {
+ return Raw(c).Versions(module)
+}
+
+// DefaultVersion returns the name of the default version for the specified
+// module.
+//
+// If module is the empty string, it means the default.
+func DefaultVersion(c context.Context, module string) (string, error) {
+ return Raw(c).DefaultVersion(module)
+}
+
+// Start starts the specified module/version.
+//
+// If module or version is the empty string, it means the default.
+func Start(c context.Context, module, version string) error {
+ return Raw(c).Start(module, version)
+}
+
+// Stop stops the specified module/version.
+//
+// If module or version is the empty string, it means the default.
+func Stop(c context.Context, module, version string) error {
+ return Raw(c).Stop(module, version)
+}

Powered by Google App Engine
This is Rietveld 408576698