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

Side by Side Diff: filter/count/gi.go

Issue 1766593002: Add a MustNamespace that panics if the namespace wasn't valid (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: Add MustNamespace to the interface Created 4 years, 9 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
« no previous file with comments | « no previous file | filter/featureBreaker/gi.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 count 5 package count
6 6
7 import ( 7 import (
8 "time" 8 "time"
9 9
10 "golang.org/x/net/context" 10 "golang.org/x/net/context"
(...skipping 12 matching lines...) Expand all
23 IsDevAppServer Entry 23 IsDevAppServer Entry
24 IsOverQuota Entry 24 IsOverQuota Entry
25 IsTimeoutError Entry 25 IsTimeoutError Entry
26 ModuleHostname Entry 26 ModuleHostname Entry
27 ModuleName Entry 27 ModuleName Entry
28 RequestID Entry 28 RequestID Entry
29 ServerSoftware Entry 29 ServerSoftware Entry
30 ServiceAccount Entry 30 ServiceAccount Entry
31 VersionID Entry 31 VersionID Entry
32 Namespace Entry 32 Namespace Entry
33 MustNamespace Entry
33 AccessToken Entry 34 AccessToken Entry
34 PublicCertificates Entry 35 PublicCertificates Entry
35 SignBytes Entry 36 SignBytes Entry
36 } 37 }
37 38
38 type infoCounter struct { 39 type infoCounter struct {
39 c *InfoCounter 40 c *InfoCounter
40 41
41 gi info.Interface 42 gi info.Interface
42 } 43 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 func (g *infoCounter) VersionID() string { 117 func (g *infoCounter) VersionID() string {
117 _ = g.c.VersionID.up() 118 _ = g.c.VersionID.up()
118 return g.gi.VersionID() 119 return g.gi.VersionID()
119 } 120 }
120 121
121 func (g *infoCounter) Namespace(namespace string) (context.Context, error) { 122 func (g *infoCounter) Namespace(namespace string) (context.Context, error) {
122 ret, err := g.gi.Namespace(namespace) 123 ret, err := g.gi.Namespace(namespace)
123 return ret, g.c.Namespace.up(err) 124 return ret, g.c.Namespace.up(err)
124 } 125 }
125 126
127 func (g *infoCounter) MustNamespace(namespace string) context.Context {
128 g.c.MustNamespace.up()
129 return g.gi.MustNamespace(namespace)
130 }
131
126 func (g *infoCounter) AccessToken(scopes ...string) (string, time.Time, error) { 132 func (g *infoCounter) AccessToken(scopes ...string) (string, time.Time, error) {
127 token, expiry, err := g.gi.AccessToken(scopes...) 133 token, expiry, err := g.gi.AccessToken(scopes...)
128 return token, expiry, g.c.AccessToken.up(err) 134 return token, expiry, g.c.AccessToken.up(err)
129 } 135 }
130 136
131 func (g *infoCounter) PublicCertificates() ([]info.Certificate, error) { 137 func (g *infoCounter) PublicCertificates() ([]info.Certificate, error) {
132 ret, err := g.gi.PublicCertificates() 138 ret, err := g.gi.PublicCertificates()
133 return ret, g.c.PublicCertificates.up(err) 139 return ret, g.c.PublicCertificates.up(err)
134 } 140 }
135 141
136 func (g *infoCounter) SignBytes(bytes []byte) (string, []byte, error) { 142 func (g *infoCounter) SignBytes(bytes []byte) (string, []byte, error) {
137 keyName, signature, err := g.gi.SignBytes(bytes) 143 keyName, signature, err := g.gi.SignBytes(bytes)
138 return keyName, signature, g.c.SignBytes.up(err) 144 return keyName, signature, g.c.SignBytes.up(err)
139 } 145 }
140 146
141 // FilterGI installs a counter GlobalInfo filter in the context. 147 // FilterGI installs a counter GlobalInfo filter in the context.
142 func FilterGI(c context.Context) (context.Context, *InfoCounter) { 148 func FilterGI(c context.Context) (context.Context, *InfoCounter) {
143 state := &InfoCounter{} 149 state := &InfoCounter{}
144 return info.AddFilters(c, func(ic context.Context, gi info.Interface) in fo.Interface { 150 return info.AddFilters(c, func(ic context.Context, gi info.Interface) in fo.Interface {
145 return &infoCounter{state, gi} 151 return &infoCounter{state, gi}
146 }), state 152 }), state
147 } 153 }
OLDNEW
« no previous file with comments | « no previous file | filter/featureBreaker/gi.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698