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

Unified Diff: filter/featureBreaker/rds.go

Issue 1355783002: Refactor keys and queries in datastore service and implementation. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: appease errcheck Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « filter/dscache/support.go ('k') | impl/dummy/dummy.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
+ 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)
« no previous file with comments | « filter/dscache/support.go ('k') | impl/dummy/dummy.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698