Index: impl/memory/plist_test.go |
diff --git a/memory/plist_test.go b/impl/memory/plist_test.go |
similarity index 67% |
rename from memory/plist_test.go |
rename to impl/memory/plist_test.go |
index 681896c58248ae409dc69368a9fb6d800007f0f8..b0fce094acacecd18623a5883c0a46c2d36e5f44 100644 |
--- a/memory/plist_test.go |
+++ b/impl/memory/plist_test.go |
@@ -8,7 +8,7 @@ import ( |
"testing" |
"time" |
- "github.com/luci/gae" |
+ rds "github.com/luci/gae/service/rawdatastore" |
"github.com/luci/gkvlite" |
. "github.com/smartystreets/goconvey/convey" |
) |
@@ -24,7 +24,7 @@ func TestCollated(t *testing.T) { |
Convey("TestCollated", t, func() { |
Convey("nil list", func() { |
- pm := (gae.DSPropertyMap)(nil) |
+ pm := (rds.PropertyMap)(nil) |
sip := partiallySerialize(pm) |
So(sip, ShouldBeNil) |
@@ -47,7 +47,7 @@ func TestCollated(t *testing.T) { |
}) |
Convey("list", func() { |
- pm := gae.DSPropertyMap{ |
+ pm := rds.PropertyMap{ |
"wat": {propNI("thing"), prop("hat"), prop(100)}, |
"nerd": {prop(103.7)}, |
"spaz": {propNI(false)}, |
@@ -59,12 +59,12 @@ func TestCollated(t *testing.T) { |
Convey("indexableMap", func() { |
So(sip, ShouldResemble, serializedIndexablePmap{ |
"wat": { |
- cat(gae.DSPTInt, 100), |
- cat(gae.DSPTString, "hat"), |
+ cat(rds.PTInt, 100), |
+ cat(rds.PTString, "hat"), |
// 'thing' is skipped, because it's not NoIndex |
}, |
"nerd": { |
- cat(gae.DSPTFloat, 103.7), |
+ cat(rds.PTFloat, 103.7), |
}, |
}) |
}) |
@@ -88,7 +88,7 @@ var rgenComplexKey = key("kind", "id") |
var rowGenTestCases = []struct { |
name string |
- pmap gae.DSPropertyMap |
+ pmap rds.PropertyMap |
withBuiltin bool |
idxs []*qIndex |
@@ -101,7 +101,7 @@ var rowGenTestCases = []struct { |
}{ |
{ |
name: "simple including builtins", |
- pmap: gae.DSPropertyMap{ |
+ pmap: rds.PropertyMap{ |
"wat": {propNI("thing"), prop("hat"), prop(100)}, |
"nerd": {prop(103.7)}, |
"spaz": {propNI(false)}, |
@@ -112,13 +112,13 @@ var rowGenTestCases = []struct { |
}, |
expected: []serializedPvals{ |
{{}}, // B:knd |
- {icat(gae.DSPTFloat, 103.7)}, // B:knd/-nerd |
- {icat(gae.DSPTString, "hat"), icat(gae.DSPTInt, 100)}, // B:knd/-wat |
- {cat(gae.DSPTFloat, 103.7)}, // B:knd/nerd |
- {cat(gae.DSPTInt, 100), cat(gae.DSPTString, "hat")}, // B:knd/wat |
+ {icat(rds.PTFloat, 103.7)}, // B:knd/-nerd |
+ {icat(rds.PTString, "hat"), icat(rds.PTInt, 100)}, // B:knd/-wat |
+ {cat(rds.PTFloat, 103.7)}, // B:knd/nerd |
+ {cat(rds.PTInt, 100), cat(rds.PTString, "hat")}, // B:knd/wat |
{ // B:knd/-wat/nerd |
- cat(icat(gae.DSPTString, "hat"), cat(gae.DSPTFloat, 103.7)), |
- cat(icat(gae.DSPTInt, 100), cat(gae.DSPTFloat, 103.7)), |
+ cat(icat(rds.PTString, "hat"), cat(rds.PTFloat, 103.7)), |
+ cat(icat(rds.PTInt, 100), cat(rds.PTFloat, 103.7)), |
}, |
}, |
collections: map[string][]kv{ |
@@ -135,22 +135,22 @@ var rowGenTestCases = []struct { |
{cat(fakeKey), []byte{}}, |
}, |
"idx:ns:" + sat(indx("knd", "wat")): { |
- {cat(gae.DSPTInt, 100, fakeKey), []byte{}}, |
- {cat(gae.DSPTString, "hat", fakeKey), cat(gae.DSPTInt, 100)}, |
+ {cat(rds.PTInt, 100, fakeKey), []byte{}}, |
+ {cat(rds.PTString, "hat", fakeKey), cat(rds.PTInt, 100)}, |
}, |
"idx:ns:" + sat(indx("knd", "-wat")): { |
- {cat(icat(gae.DSPTString, "hat"), fakeKey), []byte{}}, |
- {cat(icat(gae.DSPTInt, 100), fakeKey), icat(gae.DSPTString, "hat")}, |
+ {cat(icat(rds.PTString, "hat"), fakeKey), []byte{}}, |
+ {cat(icat(rds.PTInt, 100), fakeKey), icat(rds.PTString, "hat")}, |
}, |
}, |
}, |
{ |
name: "complex", |
- pmap: gae.DSPropertyMap{ |
+ pmap: rds.PropertyMap{ |
"yerp": {prop("hat"), prop(73.9)}, |
"wat": { |
prop(rgenComplexTime), |
- prop(gae.DSByteString("value")), |
+ prop(rds.ByteString("value")), |
prop(rgenComplexKey)}, |
"spaz": {prop(nil), prop(false), prop(true)}, |
}, |
@@ -163,31 +163,31 @@ var rowGenTestCases = []struct { |
{ // C:knd/yerp/-wat/spaz |
// thank goodness the binary serialization only happens 1/val in the |
// real code :). |
- cat(cat(gae.DSPTString, "hat"), icat(gae.DSPTKey, rgenComplexKey), cat(gae.DSPTNull)), |
- cat(cat(gae.DSPTString, "hat"), icat(gae.DSPTKey, rgenComplexKey), cat(gae.DSPTBoolFalse)), |
- cat(cat(gae.DSPTString, "hat"), icat(gae.DSPTKey, rgenComplexKey), cat(gae.DSPTBoolTrue)), |
- cat(cat(gae.DSPTString, "hat"), icat(gae.DSPTBytes, "value"), cat(gae.DSPTNull)), |
- cat(cat(gae.DSPTString, "hat"), icat(gae.DSPTBytes, "value"), cat(gae.DSPTBoolFalse)), |
- cat(cat(gae.DSPTString, "hat"), icat(gae.DSPTBytes, "value"), cat(gae.DSPTBoolTrue)), |
- cat(cat(gae.DSPTString, "hat"), icat(gae.DSPTTime, rgenComplexTime), cat(gae.DSPTNull)), |
- cat(cat(gae.DSPTString, "hat"), icat(gae.DSPTTime, rgenComplexTime), cat(gae.DSPTBoolFalse)), |
- cat(cat(gae.DSPTString, "hat"), icat(gae.DSPTTime, rgenComplexTime), cat(gae.DSPTBoolTrue)), |
+ cat(cat(rds.PTString, "hat"), icat(rds.PTKey, rgenComplexKey), cat(rds.PTNull)), |
+ cat(cat(rds.PTString, "hat"), icat(rds.PTKey, rgenComplexKey), cat(rds.PTBoolFalse)), |
+ cat(cat(rds.PTString, "hat"), icat(rds.PTKey, rgenComplexKey), cat(rds.PTBoolTrue)), |
+ cat(cat(rds.PTString, "hat"), icat(rds.PTBytes, "value"), cat(rds.PTNull)), |
+ cat(cat(rds.PTString, "hat"), icat(rds.PTBytes, "value"), cat(rds.PTBoolFalse)), |
+ cat(cat(rds.PTString, "hat"), icat(rds.PTBytes, "value"), cat(rds.PTBoolTrue)), |
+ cat(cat(rds.PTString, "hat"), icat(rds.PTTime, rgenComplexTime), cat(rds.PTNull)), |
+ cat(cat(rds.PTString, "hat"), icat(rds.PTTime, rgenComplexTime), cat(rds.PTBoolFalse)), |
+ cat(cat(rds.PTString, "hat"), icat(rds.PTTime, rgenComplexTime), cat(rds.PTBoolTrue)), |
- cat(cat(gae.DSPTFloat, 73.9), icat(gae.DSPTKey, rgenComplexKey), cat(gae.DSPTNull)), |
- cat(cat(gae.DSPTFloat, 73.9), icat(gae.DSPTKey, rgenComplexKey), cat(gae.DSPTBoolFalse)), |
- cat(cat(gae.DSPTFloat, 73.9), icat(gae.DSPTKey, rgenComplexKey), cat(gae.DSPTBoolTrue)), |
- cat(cat(gae.DSPTFloat, 73.9), icat(gae.DSPTBytes, "value"), cat(gae.DSPTNull)), |
- cat(cat(gae.DSPTFloat, 73.9), icat(gae.DSPTBytes, "value"), cat(gae.DSPTBoolFalse)), |
- cat(cat(gae.DSPTFloat, 73.9), icat(gae.DSPTBytes, "value"), cat(gae.DSPTBoolTrue)), |
- cat(cat(gae.DSPTFloat, 73.9), icat(gae.DSPTTime, rgenComplexTime), cat(gae.DSPTNull)), |
- cat(cat(gae.DSPTFloat, 73.9), icat(gae.DSPTTime, rgenComplexTime), cat(gae.DSPTBoolFalse)), |
- cat(cat(gae.DSPTFloat, 73.9), icat(gae.DSPTTime, rgenComplexTime), cat(gae.DSPTBoolTrue)), |
+ cat(cat(rds.PTFloat, 73.9), icat(rds.PTKey, rgenComplexKey), cat(rds.PTNull)), |
+ cat(cat(rds.PTFloat, 73.9), icat(rds.PTKey, rgenComplexKey), cat(rds.PTBoolFalse)), |
+ cat(cat(rds.PTFloat, 73.9), icat(rds.PTKey, rgenComplexKey), cat(rds.PTBoolTrue)), |
+ cat(cat(rds.PTFloat, 73.9), icat(rds.PTBytes, "value"), cat(rds.PTNull)), |
+ cat(cat(rds.PTFloat, 73.9), icat(rds.PTBytes, "value"), cat(rds.PTBoolFalse)), |
+ cat(cat(rds.PTFloat, 73.9), icat(rds.PTBytes, "value"), cat(rds.PTBoolTrue)), |
+ cat(cat(rds.PTFloat, 73.9), icat(rds.PTTime, rgenComplexTime), cat(rds.PTNull)), |
+ cat(cat(rds.PTFloat, 73.9), icat(rds.PTTime, rgenComplexTime), cat(rds.PTBoolFalse)), |
+ cat(cat(rds.PTFloat, 73.9), icat(rds.PTTime, rgenComplexTime), cat(rds.PTBoolTrue)), |
}, |
}, |
}, |
{ |
name: "ancestor", |
- pmap: gae.DSPropertyMap{ |
+ pmap: rds.PropertyMap{ |
"wat": {prop("sup")}, |
}, |
idxs: []*qIndex{ |
@@ -195,8 +195,8 @@ var rowGenTestCases = []struct { |
}, |
collections: map[string][]kv{ |
"idx:ns:" + sat(indx("knd!", "wat")): { |
- {cat(fakeKey.Parent(), gae.DSPTString, "sup", fakeKey), []byte{}}, |
- {cat(fakeKey, gae.DSPTString, "sup", fakeKey), []byte{}}, |
+ {cat(fakeKey.Parent(), rds.PTString, "sup", fakeKey), []byte{}}, |
+ {cat(fakeKey, rds.PTString, "sup", fakeKey), []byte{}}, |
}, |
}, |
}, |
@@ -276,8 +276,8 @@ func TestIndexEntries(t *testing.T) { |
} |
type dumbItem struct { |
- key gae.DSKey |
- props gae.DSPropertyMap |
+ key rds.Key |
+ props rds.PropertyMap |
} |
var updateIndiciesTests = []struct { |
@@ -289,31 +289,31 @@ var updateIndiciesTests = []struct { |
{ |
name: "basic", |
data: []dumbItem{ |
- {key("knd", 1), gae.DSPropertyMap{ |
+ {key("knd", 1), rds.PropertyMap{ |
"wat": {prop(10)}, |
"yerp": {prop(10)}}, |
}, |
- {key("knd", 10), gae.DSPropertyMap{ |
+ {key("knd", 10), rds.PropertyMap{ |
"wat": {prop(1)}, |
"yerp": {prop(200)}}, |
}, |
- {key("knd", 1), gae.DSPropertyMap{ |
+ {key("knd", 1), rds.PropertyMap{ |
"wat": {prop(10)}, |
"yerp": {prop(202)}}, |
}, |
}, |
expected: map[string][][]byte{ |
"idx:ns:" + sat(indx("knd", "wat")): { |
- cat(gae.DSPTInt, 1, key("knd", 10)), |
- cat(gae.DSPTInt, 10, key("knd", 1)), |
+ cat(rds.PTInt, 1, key("knd", 10)), |
+ cat(rds.PTInt, 10, key("knd", 1)), |
}, |
"idx:ns:" + sat(indx("knd", "-wat")): { |
- cat(icat(gae.DSPTInt, 10), key("knd", 1)), |
- cat(icat(gae.DSPTInt, 1), key("knd", 10)), |
+ cat(icat(rds.PTInt, 10), key("knd", 1)), |
+ cat(icat(rds.PTInt, 1), key("knd", 10)), |
}, |
"idx:ns:" + sat(indx("knd", "yerp")): { |
- cat(gae.DSPTInt, 200, key("knd", 10)), |
- cat(gae.DSPTInt, 202, key("knd", 1)), |
+ cat(rds.PTInt, 200, key("knd", 10)), |
+ cat(rds.PTInt, 202, key("knd", 1)), |
}, |
}, |
}, |
@@ -321,33 +321,33 @@ var updateIndiciesTests = []struct { |
name: "compound", |
idxs: []*qIndex{indx("knd", "yerp", "-wat")}, |
data: []dumbItem{ |
- {key("knd", 1), gae.DSPropertyMap{ |
+ {key("knd", 1), rds.PropertyMap{ |
"wat": {prop(10)}, |
"yerp": {prop(100)}}, |
}, |
- {key("knd", 10), gae.DSPropertyMap{ |
+ {key("knd", 10), rds.PropertyMap{ |
"wat": {prop(1)}, |
"yerp": {prop(200)}}, |
}, |
- {key("knd", 11), gae.DSPropertyMap{ |
+ {key("knd", 11), rds.PropertyMap{ |
"wat": {prop(20)}, |
"yerp": {prop(200)}}, |
}, |
- {key("knd", 14), gae.DSPropertyMap{ |
+ {key("knd", 14), rds.PropertyMap{ |
"wat": {prop(20)}, |
"yerp": {prop(200)}}, |
}, |
- {key("knd", 1), gae.DSPropertyMap{ |
+ {key("knd", 1), rds.PropertyMap{ |
"wat": {prop(10)}, |
"yerp": {prop(202)}}, |
}, |
}, |
expected: map[string][][]byte{ |
"idx:ns:" + sat(indx("knd", "yerp", "-wat")): { |
- cat(gae.DSPTInt, 200, icat(gae.DSPTInt, 20), key("knd", 11)), |
- cat(gae.DSPTInt, 200, icat(gae.DSPTInt, 20), key("knd", 14)), |
- cat(gae.DSPTInt, 200, icat(gae.DSPTInt, 1), key("knd", 10)), |
- cat(gae.DSPTInt, 202, icat(gae.DSPTInt, 10), key("knd", 1)), |
+ cat(rds.PTInt, 200, icat(rds.PTInt, 20), key("knd", 11)), |
+ cat(rds.PTInt, 200, icat(rds.PTInt, 20), key("knd", 14)), |
+ cat(rds.PTInt, 200, icat(rds.PTInt, 1), key("knd", 10)), |
+ cat(rds.PTInt, 202, icat(rds.PTInt, 10), key("knd", 1)), |
}, |
}, |
}, |
@@ -365,7 +365,7 @@ func TestUpdateIndicies(t *testing.T) { |
idxColl.Set(cat(i), []byte{}) |
} |
- tmpLoader := map[string]gae.DSPropertyMap{} |
+ tmpLoader := map[string]rds.PropertyMap{} |
for _, itm := range tc.data { |
ks := itm.key.String() |
prev := tmpLoader[ks] |