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

Unified Diff: impl/memory/datastore.go

Issue 1302813003: impl/memory: Implement Queries (Closed) Base URL: https://github.com/luci/gae.git@add_multi_iterator
Patch Set: Created 5 years, 4 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
Index: impl/memory/datastore.go
diff --git a/impl/memory/datastore.go b/impl/memory/datastore.go
index 857b06e307a686b38eef483c4e650fb3467ea6b3..df95cb115e38f43672b2330ba0c36d8f1094da80 100644
--- a/impl/memory/datastore.go
+++ b/impl/memory/datastore.go
@@ -69,10 +69,12 @@ func (d *dsImpl) NewQuery(kind string) ds.Query {
}
func (d *dsImpl) Run(q ds.Query, cb ds.RawRunCB) error {
- rq := q.(*queryImpl)
- done, err := rq.valid(d.ns, true)
- if done || err != nil {
- return err // will be nil if done
+ _, err := q.(*queryImpl).prep(d.ns, true)
+ if err != nil {
+ if err == errQueryDone {
+ return nil
+ }
+ return err
}
return nil
}
@@ -142,16 +144,16 @@ func (d *txnDsImpl) DeleteMulti(keys []ds.Key, cb ds.DeleteMultiCB) error {
}
func (d *txnDsImpl) Run(q ds.Query, cb ds.RawRunCB) error {
- rq := q.(*queryImpl)
- done, err := rq.valid(d.ns, true)
- if done || err != nil {
- return err // will be nil if done
+ _, err := q.(*queryImpl).prep(d.ns, true)
+ if err != nil {
+ if err == errQueryDone {
+ return nil
+ }
+ return err
}
- if rq.eventualConsistency {
- rq = rq.checkMutateClone(nil, nil)
- rq.eventualConsistency = false
+ if q.(*queryImpl).eventualConsistency {
+ // TODO(riannucci): use head instead of snap for indexes
}
- // TODO(riannucci): use head instead of snap for indexes
panic("NOT IMPLEMENTED")
}

Powered by Google App Engine
This is Rietveld 408576698