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

Unified Diff: service/datastore/pls_impl.go

Issue 2048933004: Refactor multiarg, split MGS/PLS. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Rebarse? Created 4 years, 6 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 | « service/datastore/pls.go ('k') | service/datastore/pls_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/pls_impl.go
diff --git a/service/datastore/pls_impl.go b/service/datastore/pls_impl.go
index 691aa0df8211c710b685fa8e27ca24d2145f3a86..4380d65db1b66d0fef7624117d387f7e29af71bc 100644
--- a/service/datastore/pls_impl.go
+++ b/service/datastore/pls_impl.go
@@ -42,8 +42,9 @@ type structCodec struct {
}
type structPLS struct {
- o reflect.Value
- c *structCodec
+ o reflect.Value
+ c *structCodec
+ mgs MetaGetterSetter
}
var _ PropertyLoadSaver = (*structPLS)(nil)
@@ -232,7 +233,11 @@ func loadInner(codec *structCodec, structValue reflect.Value, index int, name st
func (p *structPLS) Save(withMeta bool) (PropertyMap, error) {
ret := PropertyMap(nil)
if withMeta {
- ret = getMGS(p.o.Addr().Interface()).GetAllMeta()
+ if p.mgs != nil {
+ ret = p.mgs.GetAllMeta()
+ } else {
+ ret = p.GetAllMeta()
+ }
} else {
ret = make(PropertyMap, len(p.c.byName))
}
@@ -252,7 +257,7 @@ func (p *structPLS) getDefaultKind() string {
func (p *structPLS) save(propMap PropertyMap, prefix string, is IndexSetting) (idxCount int, err error) {
saveProp := func(name string, si IndexSetting, v reflect.Value, st *structTag) (err error) {
if st.substructCodec != nil {
- count, err := (&structPLS{v, st.substructCodec}).save(propMap, name, si)
+ count, err := (&structPLS{v, st.substructCodec, nil}).save(propMap, name, si)
if err == nil {
idxCount += count
if idxCount > maxIndexedProperties {
« no previous file with comments | « service/datastore/pls.go ('k') | service/datastore/pls_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698