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

Unified Diff: go/src/infra/gae/libs/wrapper/memory/datastore_data.go

Issue 1160253002: Add initial Query generation, correctness checking and index generation. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: address comments and stuff Created 5 years, 7 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: go/src/infra/gae/libs/wrapper/memory/datastore_data.go
diff --git a/go/src/infra/gae/libs/wrapper/memory/datastore_data.go b/go/src/infra/gae/libs/wrapper/memory/datastore_data.go
index ee185cdc4c0d1f96c9a1f3ac52e2f0eea95ca1ab..7ff288cdae84816d13ddef3e890a4a31cafabd26 100644
--- a/go/src/infra/gae/libs/wrapper/memory/datastore_data.go
+++ b/go/src/infra/gae/libs/wrapper/memory/datastore_data.go
@@ -81,6 +81,8 @@ func (d *dataStoreData) Unlock() {
d.rwlock.Unlock()
}
+/////////////////////////// indicies(dataStoreData) ////////////////////////////
+
func groupMetaKey(key *datastore.Key) []byte {
return keyBytes(noNS, newKey("", "__entity_group__", "", 1, rootKey(key)))
}
@@ -189,6 +191,18 @@ func (d *dataStoreData) putInner(key *datastore.Key, data *propertyList) (*datas
return nil, err
}
+ old := ents.Get(keyBytes(noNS, key))
+ oldPl := (*propertyList)(nil)
+ if old != nil {
+ oldPl = &propertyList{}
+ if err = oldPl.UnmarshalBinary(old); err != nil {
+ return nil, err
+ }
+ }
+ if err = updateIndicies(d.store, key, oldPl, data); err != nil {
+ return nil, err
+ }
+
ents.Set(keyBytes(noNS, key), dataBytes)
return key, nil
@@ -246,6 +260,18 @@ func (d *dataStoreData) del(ns string, key *datastore.Key) error {
return err
}
+ old := ents.Get(keyBuf)
+ oldPl := (*propertyList)(nil)
+ if old != nil {
+ oldPl = &propertyList{}
+ if err := oldPl.UnmarshalBinary(old); err != nil {
+ return err
+ }
+ }
+ if err := updateIndicies(d.store, key, oldPl, nil); err != nil {
+ return err
+ }
+
ents.Delete(keyBuf)
return nil
}
@@ -258,7 +284,7 @@ func (d *dataStoreData) canApplyTxn(obj memContextObj) bool {
if len(muts) == 0 { // read-only
continue
}
- k, err := keyFromByteString(withNS, rk)
+ k, err := keyFromByteString(withNS, rk, "")
if err != nil {
panic(err)
}
« no previous file with comments | « go/src/infra/gae/libs/wrapper/memory/datastore.go ('k') | go/src/infra/gae/libs/wrapper/memory/datastore_query.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698