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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package memory 5 package memory
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "regexp" 9 "regexp"
10 10
11 "github.com/luci/gae/impl/dummy" 11 "github.com/luci/gae/impl/dummy"
12 "github.com/luci/gae/service/info" 12 "github.com/luci/gae/service/info"
13 "golang.org/x/net/context" 13 "golang.org/x/net/context"
14 ) 14 )
15 15
16 type giContextKeyType int 16 type giContextKeyType int
17 17
18 var giContextKey giContextKeyType 18 var giContextKey giContextKeyType
19 19
20 // validNamespace matches valid namespace names. 20 // validNamespace matches valid namespace names.
21 var validNamespace = regexp.MustCompile(`^[0-9A-Za-z._-]{0,100}$`) 21 var validNamespace = regexp.MustCompile(`^[0-9A-Za-z._-]{1,100}$`)
22 22
23 var defaultGlobalInfoData = globalInfoData{ 23 var defaultGlobalInfoData = globalInfoData{
24 // versionID returns X.Y where Y is autogenerated by appengine, and X is 24 // versionID returns X.Y where Y is autogenerated by appengine, and X is
25 // whatever's in app.yaml. 25 // whatever's in app.yaml.
26 versionID: "testVersionID.1", 26 versionID: "testVersionID.1",
27 requestID: "test-request-id", 27 requestID: "test-request-id",
28 } 28 }
29 29
30 type globalInfoData struct { 30 type globalInfoData struct {
31 appid string 31 appid string
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return useGID(gi.c, func(mod *globalInfoData) { 118 return useGID(gi.c, func(mod *globalInfoData) {
119 mod.versionID = v 119 mod.versionID = v
120 }) 120 })
121 } 121 }
122 122
123 func (gi *giImpl) SetRequestID(v string) context.Context { 123 func (gi *giImpl) SetRequestID(v string) context.Context {
124 return useGID(gi.c, func(mod *globalInfoData) { 124 return useGID(gi.c, func(mod *globalInfoData) {
125 mod.requestID = v 125 mod.requestID = v
126 }) 126 })
127 } 127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698