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

Unified Diff: go/src/infra/gae/libs/gae/helper/serialize.go

Issue 1227183003: Change RawDatastore to do less reflection. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@move_dummy
Patch Set: fix No/ShouldIndex Created 5 years, 5 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: go/src/infra/gae/libs/gae/helper/serialize.go
diff --git a/go/src/infra/gae/libs/gae/helper/serialize.go b/go/src/infra/gae/libs/gae/helper/serialize.go
index e47285aa32bf190c3d3d549b7bd8097fefe83557..98f67b9cfa5091e6296483348babeeae7f5387d5 100644
--- a/go/src/infra/gae/libs/gae/helper/serialize.go
+++ b/go/src/infra/gae/libs/gae/helper/serialize.go
@@ -185,7 +185,7 @@ func ReadTime(buf *bytes.Buffer) (time.Time, error) {
// DSKey as its Value.
func WriteDSProperty(buf *bytes.Buffer, p gae.DSProperty, context DSKeyContext) {
typb := byte(p.Type())
- if p.NoIndex() {
+ if p.IndexSetting() == gae.NoIndex {
typb |= 0x80
}
buf.WriteByte(typb)
@@ -198,7 +198,7 @@ func WriteDSProperty(buf *bytes.Buffer, p gae.DSProperty, context DSKeyContext)
case gae.DSPTString:
cmpbin.WriteString(buf, p.Value().(string))
case gae.DSPTBytes:
- if p.NoIndex() {
+ if p.IndexSetting() == gae.NoIndex {
cmpbin.WriteBytes(buf, p.Value().([]byte))
} else {
cmpbin.WriteBytes(buf, p.Value().(gae.DSByteString))
@@ -223,7 +223,10 @@ func ReadDSProperty(buf *bytes.Buffer, context DSKeyContext, appid, namespace st
if err != nil {
return
}
- noIndex := (typb & 0x80) != 0 // highbit means noindex
+ is := gae.ShouldIndex
+ if (typb & 0x80) != 0 {
+ is = gae.NoIndex
+ }
switch gae.DSPropertyType(typb & 0x7f) {
case gae.DSPTNull:
case gae.DSPTBoolTrue:
@@ -241,7 +244,7 @@ func ReadDSProperty(buf *bytes.Buffer, context DSKeyContext, appid, namespace st
if b, _, err = cmpbin.ReadBytes(buf); err != nil {
break
}
- if noIndex {
+ if is == gae.NoIndex {
val = b
} else {
val = gae.DSByteString(b)
@@ -262,7 +265,7 @@ func ReadDSProperty(buf *bytes.Buffer, context DSKeyContext, appid, namespace st
err = fmt.Errorf("read: unknown type! %v", typb)
}
if err == nil {
- err = p.SetValue(val, noIndex)
+ err = p.SetValue(val, is)
}
return
}
« no previous file with comments | « go/src/infra/gae/libs/gae/helper/helper.infra_testing ('k') | go/src/infra/gae/libs/gae/helper/serialize_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698