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

Unified Diff: go/src/infra/gae/libs/gae/globalinfo.go

Issue 1230303003: Revert "Refactor current GAE abstraction library to be free of the SDK*" (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years, 5 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 | « go/src/infra/gae/libs/gae/gae.infra_testing ('k') | go/src/infra/gae/libs/gae/helper/datastore.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/src/infra/gae/libs/gae/globalinfo.go
diff --git a/go/src/infra/gae/libs/gae/globalinfo.go b/go/src/infra/gae/libs/gae/globalinfo.go
deleted file mode 100644
index afeaac492baf92da423b775dde503ad97dde7691..0000000000000000000000000000000000000000
--- a/go/src/infra/gae/libs/gae/globalinfo.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2015 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 gae
-
-import (
- "time"
-
- "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 {
- 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
- RequestID() string
- ServerSoftware() string
- ServiceAccount() (string, error)
- VersionID() string
-
- 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)
-}
-
-// GIFactory is the function signature for factory methods compatible with
-// SetGIFactory.
-type GIFactory func(context.Context) GlobalInfo
-
-// GetGI gets gets the GlobalInfo implementation from context.
-func GetGI(c context.Context) GlobalInfo {
- if f, ok := c.Value(globalInfoKey).(GIFactory); ok && f != nil {
- return f(c)
- }
- return nil
-}
-
-// SetGIFactory sets the function to produce GlobalInfo instances, as returned
-// by the GetGI method.
-func SetGIFactory(c context.Context, gif GIFactory) context.Context {
- return context.WithValue(c, globalInfoKey, gif)
-}
-
-// SetGI sets the current GlobalInfo object in the context. Useful for testing
-// with a quick mock. This is just a shorthand SetGIFactory invocation to set
-// a factory which always returns the same object.
-func SetGI(c context.Context, gi GlobalInfo) context.Context {
- return SetGIFactory(c, func(context.Context) GlobalInfo { return gi })
-}
« no previous file with comments | « go/src/infra/gae/libs/gae/gae.infra_testing ('k') | go/src/infra/gae/libs/gae/helper/datastore.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698