func (d *dataStoreData) allocateIDs(incomplete *ds.Key, n int) (int64, error) { d.Lock() defer d.Unlock() ents := d.mutableEntsLocked(incomplete.Namespace()) return d.allocateIDsLocked(ents, incomplete, n) }
func (d *dataStoreData) fixKeyLocked(ents *memCollection, key *ds.Key) (*ds.Key, error) { if key.Incomplete() { id, err := d.allocateIDsLocked(ents, key, 1) if err != nil { return key, err } key = ds.NewKey(key.AppID(), key.Namespace(), key.Kind(), "", id, key.Parent()) } return key, nil }
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 { compIdx = append(compIdx, i) return true }) mergeIndexes(key.Namespace(), store, indexEntriesWithBuiltins(key, oldEnt, compIdx), indexEntriesWithBuiltins(key, newEnt, compIdx)) }
func indexEntriesWithBuiltins(k *ds.Key, pm ds.PropertyMap, complexIdxs []*ds.IndexDefinition) *memStore { sip := serialize.PropertyMapPartially(k, pm) return indexEntries(sip, k.Namespace(), append(defaultIndexes(k.Kind(), pm), complexIdxs...)) }