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

Side by Side Diff: filter/featureBreaker/mc.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 "golang.org/x/net/context" 8 "golang.org/x/net/context"
9 9
10 mc "github.com/luci/gae/service/memcache" 10 mc "github.com/luci/gae/service/memcache"
(...skipping 19 matching lines...) Expand all
30 30
31 func (m *mcState) DeleteMulti(keys []string, cb mc.RawCB) error { 31 func (m *mcState) DeleteMulti(keys []string, cb mc.RawCB) error {
32 return m.run(func() error { return m.RawInterface.DeleteMulti(keys, cb) }) 32 return m.run(func() error { return m.RawInterface.DeleteMulti(keys, cb) })
33 } 33 }
34 34
35 func (m *mcState) CompareAndSwapMulti(items []mc.Item, cb mc.RawCB) error { 35 func (m *mcState) CompareAndSwapMulti(items []mc.Item, cb mc.RawCB) error {
36 return m.run(func() error { return m.RawInterface.CompareAndSwapMulti(it ems, cb) }) 36 return m.run(func() error { return m.RawInterface.CompareAndSwapMulti(it ems, cb) })
37 } 37 }
38 38
39 func (m *mcState) Flush() error { 39 func (m *mcState) Flush() error {
40 » return m.run(m.RawInterface.Flush) 40 » return m.run(func() error {
41 » » return m.RawInterface.Flush()
42 » })
iannucci 2016/09/16 01:01:13 hm... why was this transformation necessary?
dnj 2016/09/16 05:44:42 Don't remember, un-did it.
41 } 43 }
42 44
43 func (m *mcState) Stats() (ret *mc.Statistics, err error) { 45 func (m *mcState) Stats() (ret *mc.Statistics, err error) {
44 err = m.run(func() (err error) { 46 err = m.run(func() (err error) {
45 ret, err = m.RawInterface.Stats() 47 ret, err = m.RawInterface.Stats()
46 return 48 return
47 }) 49 })
48 return 50 return
49 } 51 }
50 52
51 // FilterMC installs a featureBreaker mc filter in the context. 53 // FilterMC installs a featureBreaker mc filter in the context.
52 func FilterMC(c context.Context, defaultError error) (context.Context, FeatureBr eaker) { 54 func FilterMC(c context.Context, defaultError error) (context.Context, FeatureBr eaker) {
53 state := newState(defaultError) 55 state := newState(defaultError)
54 return mc.AddRawFilters(c, func(ic context.Context, rds mc.RawInterface) mc.RawInterface { 56 return mc.AddRawFilters(c, func(ic context.Context, rds mc.RawInterface) mc.RawInterface {
55 return &mcState{state, rds} 57 return &mcState{state, rds}
56 }), state 58 }), state
57 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698