OLD | NEW |
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 ds "github.com/luci/gae/service/datastore" | 10 ds "github.com/luci/gae/service/datastore" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 return r.rds.GetMulti(keys, meta, cb) | 66 return r.rds.GetMulti(keys, meta, cb) |
67 }) | 67 }) |
68 } | 68 } |
69 | 69 |
70 func (r *dsState) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.NewKeyCB
) error { | 70 func (r *dsState) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.NewKeyCB
) error { |
71 return r.run(func() (err error) { | 71 return r.run(func() (err error) { |
72 return r.rds.PutMulti(keys, vals, cb) | 72 return r.rds.PutMulti(keys, vals, cb) |
73 }) | 73 }) |
74 } | 74 } |
75 | 75 |
76 func (r *dsState) Testable() ds.Testable { | 76 func (r *dsState) WithTransaction(t ds.Transaction) context.Context { |
77 » return r.rds.Testable() | 77 » return r.rds.WithTransaction(t) |
| 78 } |
| 79 |
| 80 func (r *dsState) CurrentTransaction() ds.Transaction { |
| 81 » return r.rds.CurrentTransaction() |
| 82 } |
| 83 |
| 84 func (r *dsState) GetTestable() ds.Testable { |
| 85 » return r.rds.GetTestable() |
78 } | 86 } |
79 | 87 |
80 // FilterRDS installs a featureBreaker datastore filter in the context. | 88 // FilterRDS installs a featureBreaker datastore filter in the context. |
81 func FilterRDS(c context.Context, defaultError error) (context.Context, FeatureB
reaker) { | 89 func FilterRDS(c context.Context, defaultError error) (context.Context, FeatureB
reaker) { |
82 state := newState(defaultError) | 90 state := newState(defaultError) |
83 return ds.AddRawFilters(c, func(ic context.Context, RawDatastore ds.RawI
nterface) ds.RawInterface { | 91 return ds.AddRawFilters(c, func(ic context.Context, RawDatastore ds.RawI
nterface) ds.RawInterface { |
84 return &dsState{state, RawDatastore} | 92 return &dsState{state, RawDatastore} |
85 }), state | 93 }), state |
86 } | 94 } |
OLD | NEW |