 Chromium Code Reviews
 Chromium Code Reviews Issue 1355783002:
  Refactor keys and queries in datastore service and implementation.  (Closed) 
  Base URL: https://github.com/luci/gae.git@master
    
  
    Issue 1355783002:
  Refactor keys and queries in datastore service and implementation.  (Closed) 
  Base URL: https://github.com/luci/gae.git@master| Index: filter/featureBreaker/rds.go | 
| diff --git a/filter/featureBreaker/rds.go b/filter/featureBreaker/rds.go | 
| index 5f8fa64d9582e84b8fab5b6278767e50726f065e..8a007869e5a10bed25d3a3d0dba10b691ec22311 100644 | 
| --- a/filter/featureBreaker/rds.go | 
| +++ b/filter/featureBreaker/rds.go | 
| @@ -13,44 +13,55 @@ import ( | 
| type dsState struct { | 
| *state | 
| - ds.RawInterface | 
| + rds ds.RawInterface | 
| } | 
| -func (r *dsState) DecodeKey(encoded string) (ret ds.Key, err error) { | 
| - err = r.run(func() (err error) { | 
| - ret, err = r.RawInterface.DecodeKey(encoded) | 
| +func (r *dsState) DecodeCursor(s string) (ds.Cursor, error) { | 
| + curs := ds.Cursor(nil) | 
| + err := r.run(func() (err error) { | 
| + curs, err = r.rds.DecodeCursor(s) | 
| return | 
| }) | 
| - return | 
| + return curs, err | 
| +} | 
| + | 
| +func (r *dsState) Run(q *ds.FinalizedQuery, cb ds.RawRunCB) error { | 
| 
iannucci
2015/09/18 04:31:52
turns out I was missing this method entirely becau
 | 
| + return r.run(func() error { | 
| + return r.rds.Run(q, cb) | 
| + }) | 
| } | 
| func (r *dsState) RunInTransaction(f func(c context.Context) error, opts *ds.TransactionOptions) error { | 
| return r.run(func() error { | 
| - return r.RawInterface.RunInTransaction(f, opts) | 
| + return r.rds.RunInTransaction(f, opts) | 
| }) | 
| } | 
| // TODO(riannucci): Allow the user to specify a multierror which will propagate | 
| // to the callback correctly. | 
| -func (r *dsState) DeleteMulti(keys []ds.Key, cb ds.DeleteMultiCB) error { | 
| +func (r *dsState) DeleteMulti(keys []*ds.Key, cb ds.DeleteMultiCB) error { | 
| return r.run(func() error { | 
| - return r.RawInterface.DeleteMulti(keys, cb) | 
| + return r.rds.DeleteMulti(keys, cb) | 
| }) | 
| } | 
| -func (r *dsState) GetMulti(keys []ds.Key, meta ds.MultiMetaGetter, cb ds.GetMultiCB) error { | 
| +func (r *dsState) GetMulti(keys []*ds.Key, meta ds.MultiMetaGetter, cb ds.GetMultiCB) error { | 
| return r.run(func() error { | 
| - return r.RawInterface.GetMulti(keys, meta, cb) | 
| + return r.rds.GetMulti(keys, meta, cb) | 
| }) | 
| } | 
| -func (r *dsState) PutMulti(keys []ds.Key, vals []ds.PropertyMap, cb ds.PutMultiCB) error { | 
| +func (r *dsState) PutMulti(keys []*ds.Key, vals []ds.PropertyMap, cb ds.PutMultiCB) error { | 
| return r.run(func() (err error) { | 
| - return r.RawInterface.PutMulti(keys, vals, cb) | 
| + return r.rds.PutMulti(keys, vals, cb) | 
| }) | 
| } | 
| +func (r *dsState) Testable() ds.Testable { | 
| + return r.rds.Testable() | 
| +} | 
| + | 
| // FilterRDS installs a counter datastore filter in the context. | 
| func FilterRDS(c context.Context, defaultError error) (context.Context, FeatureBreaker) { | 
| state := newState(defaultError) |