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

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

Issue 1253263002: Make rawdatastore API safer for writing filters. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fix comments Created 5 years, 4 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 | « filter/count/count_test.go ('k') | filter/count/rds.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"
11 11
12 "github.com/luci/gae/service/info" 12 "github.com/luci/gae/service/info"
13 ) 13 )
14 14
15 // InfoCounter is the counter object for the GlobalInfo service. 15 // InfoCounter is the counter object for the GlobalInfo service.
16 type InfoCounter struct { 16 type InfoCounter struct {
17 AppID Entry 17 AppID Entry
18 GetNamespace Entry
18 Datacenter Entry 19 Datacenter Entry
19 DefaultVersionHostname Entry 20 DefaultVersionHostname Entry
20 InstanceID Entry 21 InstanceID Entry
21 IsDevAppServer Entry 22 IsDevAppServer Entry
22 IsOverQuota Entry 23 IsOverQuota Entry
23 IsTimeoutError Entry 24 IsTimeoutError Entry
24 ModuleHostname Entry 25 ModuleHostname Entry
25 ModuleName Entry 26 ModuleName Entry
26 RequestID Entry 27 RequestID Entry
27 ServerSoftware Entry 28 ServerSoftware Entry
(...skipping 11 matching lines...) Expand all
39 gi info.Interface 40 gi info.Interface
40 } 41 }
41 42
42 var _ info.Interface = (*infoCounter)(nil) 43 var _ info.Interface = (*infoCounter)(nil)
43 44
44 func (g *infoCounter) AppID() string { 45 func (g *infoCounter) AppID() string {
45 g.c.AppID.up() 46 g.c.AppID.up()
46 return g.gi.AppID() 47 return g.gi.AppID()
47 } 48 }
48 49
50 func (g *infoCounter) GetNamespace() string {
51 g.c.GetNamespace.up()
52 return g.gi.GetNamespace()
53 }
54
49 func (g *infoCounter) Datacenter() string { 55 func (g *infoCounter) Datacenter() string {
50 g.c.Datacenter.up() 56 g.c.Datacenter.up()
51 return g.gi.Datacenter() 57 return g.gi.Datacenter()
52 } 58 }
53 59
54 func (g *infoCounter) DefaultVersionHostname() string { 60 func (g *infoCounter) DefaultVersionHostname() string {
55 g.c.DefaultVersionHostname.up() 61 g.c.DefaultVersionHostname.up()
56 return g.gi.DefaultVersionHostname() 62 return g.gi.DefaultVersionHostname()
57 } 63 }
58 64
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return 134 return
129 } 135 }
130 136
131 // FilterGI installs a counter GlobalInfo filter in the context. 137 // FilterGI installs a counter GlobalInfo filter in the context.
132 func FilterGI(c context.Context) (context.Context, *InfoCounter) { 138 func FilterGI(c context.Context) (context.Context, *InfoCounter) {
133 state := &InfoCounter{} 139 state := &InfoCounter{}
134 return info.AddFilters(c, func(ic context.Context, gi info.Interface) in fo.Interface { 140 return info.AddFilters(c, func(ic context.Context, gi info.Interface) in fo.Interface {
135 return &infoCounter{state, gi} 141 return &infoCounter{state, gi}
136 }), state 142 }), state
137 } 143 }
OLDNEW
« no previous file with comments | « filter/count/count_test.go ('k') | filter/count/rds.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698