OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |