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

Unified Diff: impl/memory/datastore_index.go

Issue 1355783002: Refactor keys and queries in datastore service and implementation. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: 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
Index: impl/memory/datastore_index.go
diff --git a/impl/memory/datastore_index.go b/impl/memory/datastore_index.go
index aa84af641ba6d587a14749f5688432cca435453c..13c403f3899d270e85b775de9b11f635aba1ed9d 100644
--- a/impl/memory/datastore_index.go
+++ b/impl/memory/datastore_index.go
@@ -44,9 +44,9 @@ func defaultIndexes(kind string, pmap ds.PropertyMap) []*ds.IndexDefinition {
return ret
}
-func indexEntriesWithBuiltins(k ds.Key, pm ds.PropertyMap, complexIdxs []*ds.IndexDefinition) *memStore {
+func indexEntriesWithBuiltins(k *ds.Key, pm ds.PropertyMap, complexIdxs []*ds.IndexDefinition) *memStore {
sip := partiallySerialize(k, pm)
- return sip.indexEntries(k.Namespace(), append(defaultIndexes(k.Kind(), pm), complexIdxs...))
+ return sip.indexEntries(k.Namespace(), append(defaultIndexes(k.Last().Kind, pm), complexIdxs...))
}
// serializedPvals is all of the serialized DSProperty values in qASC order.
@@ -78,7 +78,7 @@ func serializeRow(vals []ds.Property) serializedPvals {
return ret
}
-func partiallySerialize(k ds.Key, pm ds.PropertyMap) (ret serializedIndexablePmap) {
+func partiallySerialize(k *ds.Key, pm ds.PropertyMap) (ret serializedIndexablePmap) {
ret = make(serializedIndexablePmap, len(pm)+2)
if k == nil {
impossible(fmt.Errorf("key to partiallySerialize is nil"))
@@ -289,7 +289,7 @@ func addIndex(store *memStore, ns string, compIdx []*ds.IndexDefinition) {
prop, err := serialize.ReadProperty(bytes.NewBuffer(i.Key), serialize.WithoutContext, globalAppID, ns)
memoryCorruption(err)
- k := prop.Value().(ds.Key)
+ k := prop.Value().(*ds.Key)
sip := partiallySerialize(k, pm)
@@ -301,7 +301,7 @@ func addIndex(store *memStore, ns string, compIdx []*ds.IndexDefinition) {
}
}
-func updateIndexes(store *memStore, key ds.Key, oldEnt, newEnt ds.PropertyMap) {
+func updateIndexes(store *memStore, key *ds.Key, oldEnt, newEnt ds.PropertyMap) {
// load all current complex query index definitions.
compIdx := []*ds.IndexDefinition{}
walkCompIdxs(store, nil, func(i *ds.IndexDefinition) bool {

Powered by Google App Engine
This is Rietveld 408576698