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

Unified Diff: filter/dscache/serialize.go

Issue 1292913002: Split off serialization and key functions to their own packages. (Closed) Base URL: https://github.com/luci/gae.git@make_queries_better
Patch Set: rebase Created 5 years, 4 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
« no previous file with comments | « filter/dscache/dscache_test.go ('k') | filter/dscache/support.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: filter/dscache/serialize.go
diff --git a/filter/dscache/serialize.go b/filter/dscache/serialize.go
index ecf685a028c64f28d66051510c3e2f18d25fb4c5..38cca7e505ef67f78243f29c3924a95f487358a3 100644
--- a/filter/dscache/serialize.go
+++ b/filter/dscache/serialize.go
@@ -10,6 +10,7 @@ import (
"io/ioutil"
ds "github.com/luci/gae/service/datastore"
+ "github.com/luci/gae/service/datastore/serialize"
)
func encodeItemValue(pm ds.PropertyMap) []byte {
@@ -18,7 +19,7 @@ func encodeItemValue(pm ds.PropertyMap) []byte {
buf := bytes.Buffer{}
// errs can't happen, since we're using a byte buffer.
_ = buf.WriteByte(byte(NoCompression))
- _ = pm.Write(&buf, ds.WithoutContext)
+ _ = serialize.WritePropertyMap(&buf, serialize.WithoutContext, pm)
data := buf.Bytes()
if buf.Len() > CompressionThreshold {
@@ -55,7 +56,5 @@ func decodeItemValue(val []byte, ns, aid string) (ds.PropertyMap, error) {
}
buf = bytes.NewBuffer(data)
}
- ret := ds.PropertyMap{}
- err = ret.Read(buf, ds.WithoutContext, ns, aid)
- return ret, err
+ return serialize.ReadPropertyMap(buf, serialize.WithoutContext, ns, aid)
}
« no previous file with comments | « filter/dscache/dscache_test.go ('k') | filter/dscache/support.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698