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

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

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package featureBreaker 5 package featureBreaker
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 16 matching lines...) Expand all
27 } 27 }
28 28
29 func (g *infoState) ServiceAccount() (ret string, err error) { 29 func (g *infoState) ServiceAccount() (ret string, err error) {
30 err = g.run(func() (err error) { 30 err = g.run(func() (err error) {
31 ret, err = g.RawInterface.ServiceAccount() 31 ret, err = g.RawInterface.ServiceAccount()
32 return 32 return
33 }) 33 })
34 return 34 return
35 } 35 }
36 36
37 func (g *infoState) Namespace(namespace string) (ret context.Context, err error) { 37 func (g *infoState) Namespace(namespace string) (c context.Context, err error) {
38 » err = g.run(func() (err error) { 38 » err = g.run(func() error {
39 » » ret, err = g.RawInterface.Namespace(namespace) 39 » » c, err = g.RawInterface.Namespace(namespace)
iannucci 2016/09/16 01:01:13 I think this is wrong now; this err was intentiona
dnj 2016/09/16 05:44:42 Done.
40 » » return 40 » » return err
41 }) 41 })
42 return 42 return
43 } 43 }
44 44
45 func (g *infoState) AccessToken(scopes ...string) (token string, expiry time.Tim e, err error) { 45 func (g *infoState) AccessToken(scopes ...string) (token string, expiry time.Tim e, err error) {
46 err = g.run(func() (err error) { 46 err = g.run(func() (err error) {
47 token, expiry, err = g.RawInterface.AccessToken(scopes...) 47 token, expiry, err = g.RawInterface.AccessToken(scopes...)
48 return 48 return
49 }) 49 })
50 return 50 return
(...skipping 15 matching lines...) Expand all
66 return 66 return
67 } 67 }
68 68
69 // FilterGI installs a featureBreaker info filter in the context. 69 // FilterGI installs a featureBreaker info filter in the context.
70 func FilterGI(c context.Context, defaultError error) (context.Context, FeatureBr eaker) { 70 func FilterGI(c context.Context, defaultError error) (context.Context, FeatureBr eaker) {
71 state := newState(defaultError) 71 state := newState(defaultError)
72 return info.AddFilters(c, func(ic context.Context, i info.RawInterface) info.RawInterface { 72 return info.AddFilters(c, func(ic context.Context, i info.RawInterface) info.RawInterface {
73 return &infoState{state, i} 73 return &infoState{state, i}
74 }), state 74 }), state
75 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698