Index: service/datastore/properties.go |
diff --git a/service/datastore/properties.go b/service/datastore/properties.go |
index d42c098b0ff4c618fe2e271f2e9ba39775b4b861..473269fc92dce5b7400f9a582590c9ef345a89ee 100644 |
--- a/service/datastore/properties.go |
+++ b/service/datastore/properties.go |
@@ -680,6 +680,11 @@ type PropertyLoadSaver interface { |
MetaGetter |
+ // GetAllMeta returns a PropertyMap with all of the metadata in this |
+ // PropertyLoadSaver. If a metadata field has an error during serialization, |
+ // it is skipped. |
+ GetAllMeta() PropertyMap |
+ |
// SetMeta allows you to set the current value of the meta-keyed field. |
SetMeta(key string, val interface{}) error |
@@ -753,6 +758,19 @@ func (pm PropertyMap) GetMeta(key string) (interface{}, error) { |
return v[0].Value(), nil |
} |
+// GetAllMeta implements PropertyLoadSaver.GetAllMeta. |
+func (pm PropertyMap) GetAllMeta() PropertyMap { |
+ ret := make(PropertyMap, 8) |
+ for k, v := range pm { |
+ if isMetaKey(k) { |
+ newV := make([]Property, len(v)) |
+ copy(newV, v) |
+ ret[k] = newV |
+ } |
+ } |
+ return ret |
+} |
+ |
// GetMetaDefault is the implementation of PropertyLoadSaver.GetMetaDefault. |
func (pm PropertyMap) GetMetaDefault(key string, dflt interface{}) interface{} { |
return GetMetaDefaultImpl(pm.GetMeta, key, dflt) |