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

Side by Side Diff: impl/memory/datastore_index.go

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: Lightning talk licenses. Created 4 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 unified diff | Download patch
« no previous file with comments | « impl/memory/datastore_data.go ('k') | impl/memory/datastore_index_selection.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package memory 5 package memory
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "fmt" 9 "fmt"
10 "sort" 10 "sort"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 normalized[i] = idx.Normalize() 233 normalized[i] = idx.Normalize()
234 idxColl.Set(serialize.ToBytes(*normalized[i].PrepForIdxTable()), []byte{}) 234 idxColl.Set(serialize.ToBytes(*normalized[i].PrepForIdxTable()), []byte{})
235 } 235 }
236 236
237 for _, ns := range namespaces(store) { 237 for _, ns := range namespaces(store) {
238 if allEnts := store.Snapshot().GetCollection("ents:" + ns); allE nts != nil { 238 if allEnts := store.Snapshot().GetCollection("ents:" + ns); allE nts != nil {
239 allEnts.VisitItemsAscend(nil, true, func(i *gkvlite.Item ) bool { 239 allEnts.VisitItemsAscend(nil, true, func(i *gkvlite.Item ) bool {
240 pm, err := rpm(i.Val) 240 pm, err := rpm(i.Val)
241 memoryCorruption(err) 241 memoryCorruption(err)
242 242
243 » » » » prop, err := serialize.ReadProperty(bytes.NewBuf fer(i.Key), serialize.WithoutContext, aid, ns) 243 » » » » prop, err := serialize.ReadProperty(bytes.NewBuf fer(i.Key), serialize.WithoutContext, ds.KeyContext{aid, ns})
244 memoryCorruption(err) 244 memoryCorruption(err)
245 245
246 k := prop.Value().(*ds.Key) 246 k := prop.Value().(*ds.Key)
247 247
248 sip := serialize.PropertyMapPartially(k, pm) 248 sip := serialize.PropertyMapPartially(k, pm)
249 249
250 mergeIndexes(ns, store, 250 mergeIndexes(ns, store,
251 newMemStore(), 251 newMemStore(),
252 indexEntries(sip, ns, normalized)) 252 indexEntries(sip, ns, normalized))
253 return true 253 return true
254 }) 254 })
255 } 255 }
256 } 256 }
257 } 257 }
258 258
259 func updateIndexes(store memStore, key *ds.Key, oldEnt, newEnt ds.PropertyMap) { 259 func updateIndexes(store memStore, key *ds.Key, oldEnt, newEnt ds.PropertyMap) {
260 // load all current complex query index definitions. 260 // load all current complex query index definitions.
261 compIdx := []*ds.IndexDefinition{} 261 compIdx := []*ds.IndexDefinition{}
262 walkCompIdxs(store.Snapshot(), nil, func(i *ds.IndexDefinition) bool { 262 walkCompIdxs(store.Snapshot(), nil, func(i *ds.IndexDefinition) bool {
263 compIdx = append(compIdx, i) 263 compIdx = append(compIdx, i)
264 return true 264 return true
265 }) 265 })
266 266
267 mergeIndexes(key.Namespace(), store, 267 mergeIndexes(key.Namespace(), store,
268 indexEntriesWithBuiltins(key, oldEnt, compIdx), 268 indexEntriesWithBuiltins(key, oldEnt, compIdx),
269 indexEntriesWithBuiltins(key, newEnt, compIdx)) 269 indexEntriesWithBuiltins(key, newEnt, compIdx))
270 } 270 }
OLDNEW
« no previous file with comments | « impl/memory/datastore_data.go ('k') | impl/memory/datastore_index_selection.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698