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 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 return gi.namespace | 49 return gi.namespace |
50 } | 50 } |
51 | 51 |
52 func (gi *giImpl) Namespace(ns string) (ret context.Context, err error) { | 52 func (gi *giImpl) Namespace(ns string) (ret context.Context, err error) { |
53 if !validNamespace.MatchString(ns) { | 53 if !validNamespace.MatchString(ns) { |
54 return nil, fmt.Errorf("appengine: namespace %q does not match /
%s/", ns, validNamespace) | 54 return nil, fmt.Errorf("appengine: namespace %q does not match /
%s/", ns, validNamespace) |
55 } | 55 } |
56 return context.WithValue(gi.c, giContextKey, &globalInfoData{gi.appid, n
s}), nil | 56 return context.WithValue(gi.c, giContextKey, &globalInfoData{gi.appid, n
s}), nil |
57 } | 57 } |
58 | 58 |
| 59 func (gi *giImpl) MustNamespace(ns string) context.Context { |
| 60 ret, err := gi.Namespace(ns) |
| 61 if err != nil { |
| 62 panic(err) |
| 63 } |
| 64 return ret |
| 65 } |
| 66 |
59 func (gi *giImpl) AppID() string { | 67 func (gi *giImpl) AppID() string { |
60 return gi.appid | 68 return gi.appid |
61 } | 69 } |
62 | 70 |
63 func (gi *giImpl) FullyQualifiedAppID() string { | 71 func (gi *giImpl) FullyQualifiedAppID() string { |
64 return gi.appid | 72 return gi.appid |
65 } | 73 } |
66 | 74 |
67 func (gi *giImpl) IsDevAppServer() bool { | 75 func (gi *giImpl) IsDevAppServer() bool { |
68 return true | 76 return true |
69 } | 77 } |
70 | 78 |
71 func (gi *giImpl) VersionID() string { | 79 func (gi *giImpl) VersionID() string { |
72 // VersionID returns X.Y where Y is autogenerated by appengine, and X is | 80 // VersionID returns X.Y where Y is autogenerated by appengine, and X is |
73 // whatever's in app.yaml. | 81 // whatever's in app.yaml. |
74 return "testVersionID.1" | 82 return "testVersionID.1" |
75 } | 83 } |
OLD | NEW |