| 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 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 FullyQualifiedAppID Entry |
| 18 GetNamespace Entry | 19 GetNamespace Entry |
| 19 Datacenter Entry | 20 Datacenter Entry |
| 20 DefaultVersionHostname Entry | 21 DefaultVersionHostname Entry |
| 21 InstanceID Entry | 22 InstanceID Entry |
| 22 IsDevAppServer Entry | 23 IsDevAppServer Entry |
| 23 IsOverQuota Entry | 24 IsOverQuota Entry |
| 24 IsTimeoutError Entry | 25 IsTimeoutError Entry |
| 25 ModuleHostname Entry | 26 ModuleHostname Entry |
| 26 ModuleName Entry | 27 ModuleName Entry |
| 27 RequestID Entry | 28 RequestID Entry |
| (...skipping 12 matching lines...) Expand all Loading... |
| 40 gi info.Interface | 41 gi info.Interface |
| 41 } | 42 } |
| 42 | 43 |
| 43 var _ info.Interface = (*infoCounter)(nil) | 44 var _ info.Interface = (*infoCounter)(nil) |
| 44 | 45 |
| 45 func (g *infoCounter) AppID() string { | 46 func (g *infoCounter) AppID() string { |
| 46 g.c.AppID.up() | 47 g.c.AppID.up() |
| 47 return g.gi.AppID() | 48 return g.gi.AppID() |
| 48 } | 49 } |
| 49 | 50 |
| 51 func (g *infoCounter) FullyQualifiedAppID() string { |
| 52 g.c.FullyQualifiedAppID.up() |
| 53 return g.gi.FullyQualifiedAppID() |
| 54 } |
| 55 |
| 50 func (g *infoCounter) GetNamespace() string { | 56 func (g *infoCounter) GetNamespace() string { |
| 51 g.c.GetNamespace.up() | 57 g.c.GetNamespace.up() |
| 52 return g.gi.GetNamespace() | 58 return g.gi.GetNamespace() |
| 53 } | 59 } |
| 54 | 60 |
| 55 func (g *infoCounter) Datacenter() string { | 61 func (g *infoCounter) Datacenter() string { |
| 56 g.c.Datacenter.up() | 62 g.c.Datacenter.up() |
| 57 return g.gi.Datacenter() | 63 return g.gi.Datacenter() |
| 58 } | 64 } |
| 59 | 65 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 return | 140 return |
| 135 } | 141 } |
| 136 | 142 |
| 137 // FilterGI installs a counter GlobalInfo filter in the context. | 143 // FilterGI installs a counter GlobalInfo filter in the context. |
| 138 func FilterGI(c context.Context) (context.Context, *InfoCounter) { | 144 func FilterGI(c context.Context) (context.Context, *InfoCounter) { |
| 139 state := &InfoCounter{} | 145 state := &InfoCounter{} |
| 140 return info.AddFilters(c, func(ic context.Context, gi info.Interface) in
fo.Interface { | 146 return info.AddFilters(c, func(ic context.Context, gi info.Interface) in
fo.Interface { |
| 141 return &infoCounter{state, gi} | 147 return &infoCounter{state, gi} |
| 142 }), state | 148 }), state |
| 143 } | 149 } |
| OLD | NEW |