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

Unified Diff: impl/memory/datastore_data.go

Issue 1302813003: impl/memory: Implement Queries (Closed) Base URL: https://github.com/luci/gae.git@add_multi_iterator
Patch Set: Baby's first query! 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_data.go
diff --git a/impl/memory/datastore_data.go b/impl/memory/datastore_data.go
index 5ef87530ded64c4c31f367bb859d3f87c43b8d7b..2bfc13256f25f08eb97d833be1697c0e02f7090c 100644
--- a/impl/memory/datastore_data.go
+++ b/impl/memory/datastore_data.go
@@ -98,14 +98,14 @@ func curVersion(ents *memCollection, key []byte) int64 {
if ents != nil {
if v := ents.Get(key); v != nil {
pm, err := rpm(v)
- if err != nil {
- panic(err) // memory corruption
- }
+ memoryCorruption(err)
+
pl, ok := pm["__version__"]
if ok && len(pl) > 0 && pl[0].Type() == ds.PTInt {
return pl[0].Value().(int64)
}
- panic(fmt.Errorf("__version__ property missing or wrong: %v", pm))
+
+ memoryCorruption(fmt.Errorf("__version__ property missing or wrong: %v", pm))
}
}
return 0
@@ -247,9 +247,7 @@ func (d *dataStoreData) canApplyTxn(obj memContextObj) bool {
continue
}
k, err := serialize.ReadKey(bytes.NewBufferString(rk), serialize.WithContext, "", "")
- if err != nil {
- panic(err)
- }
+ memoryCorruption(err)
entKey := "ents:" + k.Namespace()
mkey := groupMetaKey(k)
@@ -281,10 +279,7 @@ func (d *dataStoreData) applyTxn(c context.Context, obj memContextObj) {
d.putMulti([]ds.Key{m.key}, []ds.PropertyMap{m.data},
func(_ ds.Key, e error) { err = e })
}
- err = errors.SingleError(err)
- if err != nil {
- panic(err)
- }
+ impossible(err)
}
}
}
@@ -338,10 +333,11 @@ func (td *txnDataStoreData) endTxn() {
atomic.StoreInt32(&td.closed, 1)
}
func (*txnDataStoreData) applyTxn(context.Context, memContextObj) {
- panic("txnDataStoreData cannot apply transactions")
+ impossible(fmt.Errorf("cannot creat a recursive transaction"))
}
func (*txnDataStoreData) mkTxn(*ds.TransactionOptions) memContextObj {
- panic("impossible")
+ impossible(fmt.Errorf("cannot creat a recursive transaction"))
+ return nil
}
func (td *txnDataStoreData) run(f func() error) error {

Powered by Google App Engine
This is Rietveld 408576698