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

Side by Side Diff: service/datastore/pls_impl.go

Issue 1425283002: service/datastore: Call MGS GetAllMeta() in Save() (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: Add support/handling for invalid codec. Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | service/datastore/pls_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // HEAVILY adapted from github.com/golang/appengine/datastore 5 // HEAVILY adapted from github.com/golang/appengine/datastore
6 6
7 package datastore 7 package datastore
8 8
9 import ( 9 import (
10 "fmt" 10 "fmt"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 198 }
199 set(pVal) 199 set(pVal)
200 } 200 }
201 if slice.IsValid() { 201 if slice.IsValid() {
202 slice.Set(reflect.Append(slice, v)) 202 slice.Set(reflect.Append(slice, v))
203 } 203 }
204 return "" 204 return ""
205 } 205 }
206 206
207 func (p *structPLS) Save(withMeta bool) (PropertyMap, error) { 207 func (p *structPLS) Save(withMeta bool) (PropertyMap, error) {
208 if err := p.Problem(); err != nil {
209 return nil, err
210 }
211
208 ret := PropertyMap(nil) 212 ret := PropertyMap(nil)
209 if withMeta { 213 if withMeta {
210 » » ret = p.GetAllMeta() 214 » » ret = getMGS(p.o.Addr().Interface()).GetAllMeta()
211 } else { 215 } else {
212 ret = make(PropertyMap, len(p.c.byName)) 216 ret = make(PropertyMap, len(p.c.byName))
213 } 217 }
214 if _, err := p.save(ret, "", ShouldIndex); err != nil { 218 if _, err := p.save(ret, "", ShouldIndex); err != nil {
215 return nil, err 219 return nil, err
216 } 220 }
217 return ret, nil 221 return ret, nil
218 } 222 }
219 223
220 func (p *structPLS) getDefaultKind() string { 224 func (p *structPLS) getDefaultKind() string {
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 switch val { 584 switch val {
581 case "on", "On", "true": 585 case "on", "On", "true":
582 return true, nil 586 return true, nil
583 case "off", "Off", "false": 587 case "off", "Off", "false":
584 return false, nil 588 return false, nil
585 } 589 }
586 return nil, fmt.Errorf("Toggle field has bad/missing default, go t %q", val) 590 return nil, fmt.Errorf("Toggle field has bad/missing default, go t %q", val)
587 } 591 }
588 return nil, fmt.Errorf("helper: meta field with bad type/value %s/%q", t , val) 592 return nil, fmt.Errorf("helper: meta field with bad type/value %s/%q", t , val)
589 } 593 }
OLDNEW
« no previous file with comments | « no previous file | service/datastore/pls_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698