VOL-1283: Fixed callback execution consistency for all proxy levels
- Callbacks are executed at any proxy levels
- Uncovered some issues with the base children fields structure
- cleaned up the root/node structures
- Ensure that a get command returns a clone.
Change-Id: Ic2cd5420c29332bd9b5d6f303a7fd9d0d0ccaf06
diff --git a/db/model/child_type.go b/db/model/child_type.go
index d503b8d..a96883c 100644
--- a/db/model/child_type.go
+++ b/db/model/child_type.go
@@ -74,12 +74,12 @@
if proto.HasExtension(options, common.E_ChildNode) {
isContainer := *field.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED
meta, _ := proto.GetExtension(options, common.E_ChildNode)
- var keyFromStr func(string) interface{}
- if meta.(*common.ChildNode).GetKey() == "" {
- //log.Debugf("Child key is empty ... moving on")
- } else {
- parentType := FindOwnerType(reflect.ValueOf(cls), field.GetName(), 0, false)
+ var keyFromStr func(string) interface{}
+ var ct ChildType
+
+ parentType := FindOwnerType(reflect.ValueOf(cls), field.GetName(), 0, false)
+ if meta.(*common.ChildNode).GetKey() != "" {
keyType := FindKeyOwner(reflect.New(parentType).Elem().Interface(), meta.(*common.ChildNode).GetKey(), 0)
switch keyType.(reflect.Type).Name() {
@@ -110,18 +110,17 @@
default:
log.Errorf("Key type not implemented - type: %s\n", keyType.(reflect.Type))
}
-
- ct := ChildType{
- ClassModule: parentType.String(),
- ClassType: parentType,
- IsContainer: isContainer,
- Key: meta.(*common.ChildNode).GetKey(),
- KeyFromStr: keyFromStr,
- }
-
- names[field.GetName()] = &ct
-
}
+
+ ct = ChildType{
+ ClassModule: parentType.String(),
+ ClassType: parentType,
+ IsContainer: isContainer,
+ Key: meta.(*common.ChildNode).GetKey(),
+ KeyFromStr: keyFromStr,
+ }
+
+ names[field.GetName()] = &ct
}
}
}