| Index: impl/memory/plist.go
|
| diff --git a/memory/plist.go b/impl/memory/plist.go
|
| similarity index 90%
|
| rename from memory/plist.go
|
| rename to impl/memory/plist.go
|
| index f91b97cf1e3cdd833ecd94ad6ac7e8cd14bb4f99..22a942b313f035fe6e56579c360a0e89936f2d0d 100644
|
| --- a/memory/plist.go
|
| +++ b/impl/memory/plist.go
|
| @@ -9,9 +9,7 @@ import (
|
| "fmt"
|
| "sort"
|
|
|
| - "github.com/luci/gae"
|
| - "github.com/luci/gae/helper"
|
| -
|
| + rds "github.com/luci/gae/service/rawdatastore"
|
| "github.com/luci/gkvlite"
|
| )
|
|
|
| @@ -23,13 +21,13 @@ func (s qIndexSlice) Len() int { return len(s) }
|
| func (s qIndexSlice) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
| func (s qIndexSlice) Less(i, j int) bool { return s[i].Less(s[j]) }
|
|
|
| -func defaultIndicies(kind string, pmap gae.DSPropertyMap) []*qIndex {
|
| +func defaultIndicies(kind string, pmap rds.PropertyMap) []*qIndex {
|
| ret := make(qIndexSlice, 0, 2*len(pmap)+1)
|
| ret = append(ret, &qIndex{kind, false, nil})
|
| for name, pvals := range pmap {
|
| needsIndex := false
|
| for _, v := range pvals {
|
| - if v.IndexSetting() == gae.ShouldIndex {
|
| + if v.IndexSetting() == rds.ShouldIndex {
|
| needsIndex = true
|
| break
|
| }
|
| @@ -46,7 +44,7 @@ func defaultIndicies(kind string, pmap gae.DSPropertyMap) []*qIndex {
|
| return ret
|
| }
|
|
|
| -func indexEntriesWithBuiltins(k gae.DSKey, pm gae.DSPropertyMap, complexIdxs []*qIndex) *memStore {
|
| +func indexEntriesWithBuiltins(k rds.Key, pm rds.PropertyMap, complexIdxs []*qIndex) *memStore {
|
| sip := partiallySerialize(pm)
|
| return sip.indexEntries(k, append(defaultIndicies(k.Kind(), pm), complexIdxs...))
|
| }
|
| @@ -61,7 +59,7 @@ func (s serializedPvals) Less(i, j int) bool { return bytes.Compare(s[i], s[j])
|
| // prop name -> [<serialized DSProperty>, ...]
|
| type serializedIndexablePmap map[string]serializedPvals
|
|
|
| -func partiallySerialize(pm gae.DSPropertyMap) (ret serializedIndexablePmap) {
|
| +func partiallySerialize(pm rds.PropertyMap) (ret serializedIndexablePmap) {
|
| if len(pm) == 0 {
|
| return
|
| }
|
| @@ -71,11 +69,11 @@ func partiallySerialize(pm gae.DSPropertyMap) (ret serializedIndexablePmap) {
|
| for k, vals := range pm {
|
| newVals := make(serializedPvals, 0, len(vals))
|
| for _, v := range vals {
|
| - if v.IndexSetting() == gae.NoIndex {
|
| + if v.IndexSetting() == rds.NoIndex {
|
| continue
|
| }
|
| buf.Reset()
|
| - helper.WriteDSProperty(buf, v, helper.WithoutContext)
|
| + rds.WriteProperty(buf, v, rds.WithoutContext)
|
| newVal := make([]byte, buf.Len())
|
| copy(newVal, buf.Bytes())
|
| newVals = append(newVals, newVal)
|
| @@ -177,7 +175,7 @@ func (m *matcher) match(idx *qIndex, sip serializedIndexablePmap) (indexRowGen,
|
| return m.buf, true
|
| }
|
|
|
| -func (sip serializedIndexablePmap) indexEntries(k gae.DSKey, idxs []*qIndex) *memStore {
|
| +func (sip serializedIndexablePmap) indexEntries(k rds.Key, idxs []*qIndex) *memStore {
|
| ret := newMemStore()
|
| idxColl := ret.SetCollection("idx", nil)
|
| // getIdxEnts retrieves an index collection or adds it if it's not there.
|
| @@ -190,7 +188,7 @@ func (sip serializedIndexablePmap) indexEntries(k gae.DSKey, idxs []*qIndex) *me
|
| }
|
|
|
| buf := &bytes.Buffer{}
|
| - helper.WriteDSKey(buf, helper.WithoutContext, k)
|
| + rds.WriteKey(buf, rds.WithoutContext, k)
|
| keyData := buf.Bytes()
|
|
|
| walkPermutations := func(prefix []byte, irg indexRowGen, ents *memCollection) {
|
| @@ -214,7 +212,7 @@ func (sip serializedIndexablePmap) indexEntries(k gae.DSKey, idxs []*qIndex) *me
|
| } else if idx.ancestor {
|
| for ancKey := k; ancKey != nil; ancKey = ancKey.Parent() {
|
| buf := &bytes.Buffer{}
|
| - helper.WriteDSKey(buf, helper.WithoutContext, ancKey)
|
| + rds.WriteKey(buf, rds.WithoutContext, ancKey)
|
| walkPermutations(buf.Bytes(), irg, idxEnts)
|
| }
|
| } else {
|
| @@ -226,7 +224,7 @@ func (sip serializedIndexablePmap) indexEntries(k gae.DSKey, idxs []*qIndex) *me
|
| return ret
|
| }
|
|
|
| -func updateIndicies(store *memStore, key gae.DSKey, oldEnt, newEnt gae.DSPropertyMap) {
|
| +func updateIndicies(store *memStore, key rds.Key, oldEnt, newEnt rds.PropertyMap) {
|
| idxColl := store.GetCollection("idx")
|
| if idxColl == nil {
|
| idxColl = store.SetCollection("idx", nil)
|
|
|