Index: go/src/infra/gae/libs/wrapper/globalinfo.go |
diff --git a/go/src/infra/gae/libs/gae/globalinfo.go b/go/src/infra/gae/libs/wrapper/globalinfo.go |
similarity index 68% |
rename from go/src/infra/gae/libs/gae/globalinfo.go |
rename to go/src/infra/gae/libs/wrapper/globalinfo.go |
index afeaac492baf92da423b775dde503ad97dde7691..aab66bb572aa170460beb429b4059e042e2fd4c9 100644 |
--- a/go/src/infra/gae/libs/gae/globalinfo.go |
+++ b/go/src/infra/gae/libs/wrapper/globalinfo.go |
@@ -2,36 +2,56 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-package gae |
+package wrapper |
import ( |
"time" |
+ "appengine" |
+ |
"golang.org/x/net/context" |
) |
// GlobalInfo is the interface for all of the package methods which normally |
// would be in the 'appengine' package. |
type GlobalInfo interface { |
+ // methods usually requiring a Context |
+ |
+ AccessToken(scopes ...string) (token string, expiry time.Time, err error) |
AppID() string |
- Datacenter() string |
DefaultVersionHostname() string |
- InstanceID() string |
- IsDevAppServer() bool |
- IsOverQuota(err error) bool |
- IsTimeoutError(err error) bool |
ModuleHostname(module, version, instance string) (string, error) |
ModuleName() string |
+ PublicCertificates() ([]appengine.Certificate, error) |
RequestID() string |
- ServerSoftware() string |
ServiceAccount() (string, error) |
+ SignBytes(bytes []byte) (keyName string, signature []byte, err error) |
VersionID() string |
+ // our tweaked interface |
+ |
+ // Namespace takes the new namespace as a string, and returns a context |
+ // set to use that namespace, or an error. |
+ // The appengine SDK doesn't document what errors you can see from this |
+ // method, or under what circumstances they might occur. |
Namespace(namespace string) (context.Context, error) |
- AccessToken(scopes ...string) (token string, expiry time.Time, err error) |
- PublicCertificates() ([]GICertificate, error) |
- SignBytes(bytes []byte) (keyName string, signature []byte, err error) |
+ // Really global functions... these don't normally even require context, but |
+ // for the purposes of testing+consistency, they're included here. |
+ |
+ Datacenter() string |
+ InstanceID() string |
+ IsDevAppserver() bool |
+ ServerSoftware() string |
+ |
+ IsCapabilityDisabled(err error) bool |
+ IsOverQuota(err error) bool |
+ IsTimeoutError(err error) bool |
+ |
+ // Backends are deprecated in favor of modules, so simplify this a bit by |
+ // omitting them from the interface. |
+ // BackendHostname(name string, index int) string |
+ // BackendInstance() (name string, index int) |
} |
// GIFactory is the function signature for factory methods compatible with |