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

Unified Diff: impl/memory/info.go

Issue 1916463004: impl/memory: Disallow empty namespace. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Rbase. Created 4 years, 8 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/datastore_test.go ('k') | impl/memory/memcache.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/info.go
diff --git a/impl/memory/info.go b/impl/memory/info.go
index 432f70195ee82efab6f464cde55b466392c049af..c19044b45c4b7ed9b40370464580101c71d1a2c2 100644
--- a/impl/memory/info.go
+++ b/impl/memory/info.go
@@ -29,11 +29,18 @@ var defaultGlobalInfoData = globalInfoData{
type globalInfoData struct {
appid string
- namespace string
+ namespace *string
versionID string
requestID string
}
+func (gid *globalInfoData) getNamespace() (string, bool) {
+ if ns := gid.namespace; ns != nil {
+ return *ns, true
+ }
+ return "", false
+}
+
func curGID(c context.Context) *globalInfoData {
if gid, ok := c.Value(giContextKey).(*globalInfoData); ok {
return gid
@@ -68,8 +75,8 @@ type giImpl struct {
var _ = info.Interface((*giImpl)(nil))
-func (gi *giImpl) GetNamespace() string {
- return gi.namespace
+func (gi *giImpl) GetNamespace() (string, bool) {
+ return gi.getNamespace()
}
func (gi *giImpl) Namespace(ns string) (ret context.Context, err error) {
@@ -78,7 +85,7 @@ func (gi *giImpl) Namespace(ns string) (ret context.Context, err error) {
}
return useGID(gi.c, func(mod *globalInfoData) {
- mod.namespace = ns
+ mod.namespace = &ns
}), nil
}
« no previous file with comments | « impl/memory/datastore_test.go ('k') | impl/memory/memcache.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698