| Index: service/datastore/pls_impl.go
|
| diff --git a/service/datastore/pls_impl.go b/service/datastore/pls_impl.go
|
| index 2176b7e144ccd9e14c980ad22e7fdbe7dff4990d..0c850ea9ff3bf6170a803383356f8b3d68d5ca0c 100644
|
| --- a/service/datastore/pls_impl.go
|
| +++ b/service/datastore/pls_impl.go
|
| @@ -53,8 +53,8 @@ func typeMismatchReason(val interface{}, v reflect.Value) string {
|
| }
|
|
|
| func (p *structPLS) Load(propMap PropertyMap) error {
|
| - if err := p.Problem(); err != nil {
|
| - return err
|
| + if p.c.problem != nil {
|
| + panic(p.c.problem)
|
| }
|
|
|
| convFailures := errors.MultiError(nil)
|
| @@ -205,8 +205,8 @@ func loadInner(codec *structCodec, structValue reflect.Value, index int, name st
|
| }
|
|
|
| func (p *structPLS) Save(withMeta bool) (PropertyMap, error) {
|
| - if err := p.Problem(); err != nil {
|
| - return nil, err
|
| + if p.c.problem != nil {
|
| + panic(p.c.problem)
|
| }
|
|
|
| ret := PropertyMap(nil)
|
| @@ -229,8 +229,8 @@ func (p *structPLS) getDefaultKind() string {
|
| }
|
|
|
| func (p *structPLS) save(propMap PropertyMap, prefix string, is IndexSetting) (idxCount int, err error) {
|
| - if err = p.Problem(); err != nil {
|
| - return
|
| + if p.c.problem != nil {
|
| + panic(p.c.problem)
|
| }
|
|
|
| saveProp := func(name string, si IndexSetting, v reflect.Value, st *structTag) (err error) {
|
| @@ -292,19 +292,19 @@ func (p *structPLS) save(propMap PropertyMap, prefix string, is IndexSetting) (i
|
| return
|
| }
|
|
|
| -func (p *structPLS) GetMeta(key string) (interface{}, error) {
|
| - if err := p.Problem(); err != nil {
|
| - return nil, err
|
| +func (p *structPLS) GetMeta(key string) (interface{}, bool) {
|
| + if p.c.problem != nil {
|
| + panic(p.c.problem)
|
| }
|
|
|
| if idx, ok := p.c.byMeta[key]; ok {
|
| if val, ok := p.getMetaFor(idx); ok {
|
| - return val, nil
|
| + return val, true
|
| }
|
| } else if key == "kind" {
|
| - return p.getDefaultKind(), nil
|
| + return p.getDefaultKind(), true
|
| }
|
| - return nil, ErrMetaFieldUnset
|
| + return nil, false
|
| }
|
|
|
| func (p *structPLS) getMetaFor(idx int) (interface{}, bool) {
|
| @@ -352,25 +352,23 @@ func (p *structPLS) GetAllMeta() PropertyMap {
|
| return ret
|
| }
|
|
|
| -func (p *structPLS) GetMetaDefault(key string, def interface{}) interface{} {
|
| - return GetMetaDefaultImpl(p.GetMeta, key, def)
|
| -}
|
| -
|
| -func (p *structPLS) SetMeta(key string, val interface{}) (err error) {
|
| - if err = p.Problem(); err != nil {
|
| - return
|
| +func (p *structPLS) SetMeta(key string, val interface{}) bool {
|
| + if p.c.problem != nil {
|
| + panic(p.c.problem)
|
| }
|
| +
|
| idx, ok := p.c.byMeta[key]
|
| if !ok {
|
| - return ErrMetaFieldUnset
|
| + return false
|
| }
|
| st := p.c.byIndex[idx]
|
| if !st.canSet {
|
| - return fmt.Errorf("gae/helper: cannot set meta %q: unexported field", key)
|
| + return false
|
| }
|
| if st.convert {
|
| - return p.o.Field(idx).Addr().Interface().(PropertyConverter).FromProperty(
|
| + err := p.o.Field(idx).Addr().Interface().(PropertyConverter).FromProperty(
|
| MkPropertyNI(val))
|
| + return err == nil
|
| }
|
|
|
| // setting a BoolField
|
| @@ -388,11 +386,9 @@ func (p *structPLS) SetMeta(key string, val interface{}) (err error) {
|
| value := reflect.ValueOf(val)
|
| f.Set(value.Convert(f.Type()))
|
| }
|
| - return nil
|
| + return true
|
| }
|
|
|
| -func (p *structPLS) Problem() error { return p.c.problem }
|
| -
|
| var (
|
| // The RWMutex is chosen intentionally, as the majority of access to the
|
| // structCodecs map will be in parallel and will be to read an existing codec.
|
|
|