Index: service/datastore/pls_impl.go |
diff --git a/service/datastore/pls_impl.go b/service/datastore/pls_impl.go |
index 535b8d524b1acb868bb3889f1111e45ccf259c11..0900f9106c51f032a5a15a2953e9953262f17d27 100644 |
--- a/service/datastore/pls_impl.go |
+++ b/service/datastore/pls_impl.go |
@@ -35,7 +35,6 @@ type structCodec struct { |
byName map[string]int |
byIndex []structTag |
hasSlice bool |
- mgs bool |
problem error |
} |
@@ -44,13 +43,6 @@ type structPLS struct { |
c *structCodec |
} |
-func (p *structPLS) getMGS() MetaGetterSetter { |
- if !p.c.mgs { |
- return nil |
- } |
- return p.o.Addr().Interface().(MetaGetterSetter) |
-} |
- |
var _ PropertyLoadSaver = (*structPLS)(nil) |
// typeMismatchReason returns a string explaining why the property p could not |
@@ -226,6 +218,9 @@ func (p *structPLS) Save(withMeta bool) (PropertyMap, error) { |
} |
func (p *structPLS) getDefaultKind() string { |
+ if !p.o.IsValid() { |
+ return "" |
+ } |
return p.o.Type().Name() |
} |
@@ -302,14 +297,6 @@ func (p *structPLS) GetMeta(key string) (interface{}, error) { |
return p.getMetaFor(idx), nil |
} |
- if p.c.mgs { |
- ret, err := p.getMGS().GetMeta(key) |
- if err == nil { |
- return ret, err |
- } else if err != ErrMetaFieldUnset { |
- return nil, err |
- } |
- } |
if key == "kind" { |
return p.getDefaultKind(), nil |
} |
@@ -332,15 +319,8 @@ func (p *structPLS) getMetaFor(idx int) interface{} { |
} |
func (p *structPLS) GetAllMeta() PropertyMap { |
- ret := PropertyMap(nil) |
needKind := true |
- if p.c.mgs { |
- ret = p.getMGS().GetAllMeta() |
- _, haveKind := ret["$kind"] |
- needKind = !haveKind |
- } else { |
- ret = make(PropertyMap, len(p.c.byMeta)+1) |
- } |
+ ret := make(PropertyMap, len(p.c.byMeta)+1) |
for k, idx := range p.c.byMeta { |
val := p.getMetaFor(idx) |
p := Property{} |
@@ -367,9 +347,6 @@ func (p *structPLS) SetMeta(key string, val interface{}) (err error) { |
} |
idx, ok := p.c.byMeta[key] |
if !ok { |
- if p.c.mgs { |
- return p.getMGS().SetMeta(key, val) |
- } |
return ErrMetaFieldUnset |
} |
if !p.c.byIndex[idx].canSet { |
@@ -448,7 +425,6 @@ func getStructCodecLocked(t reflect.Type) (c *structCodec) { |
byName: make(map[string]int, t.NumField()), |
byMeta: make(map[string]int, t.NumField()), |
problem: errRecursiveStruct, // we'll clear this later if it's not recursive |
- mgs: reflect.PtrTo(t).Implements(typeOfMGS), |
} |
defer func() { |
// If the codec has a problem, free up the indexes |