Skip to content

Commit

Permalink
[FAB-5978] Protolator support for Capabilities msg
Browse files Browse the repository at this point in the history
This CR defines the metadata necessary for the configtxlator /
protolator to understand the new Capabilities type.  It also adds an
additional check to the protolator to not try to deeply marshal beyond
non-string map fields which was discovered while attempting to support
this new message.

Change-Id: I34aecb30ad7bdf7a99f2e8db7e203be26a7488e8
Signed-off-by: Jason Yellick <[email protected]>
  • Loading branch information
Jason Yellick committed Aug 30, 2017
1 parent 5e3d22c commit 07d9bf8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common/tools/protolator/nested.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (nff nestedFieldFactory) NewProtoField(msg proto.Message, fieldName string,
type nestedMapFieldFactory struct{}

func (nmff nestedMapFieldFactory) Handles(msg proto.Message, fieldName string, fieldType reflect.Type, fieldValue reflect.Value) bool {
return fieldType.Kind() == reflect.Map && fieldType.Elem().AssignableTo(protoMsgType) && !fieldType.Elem().AssignableTo(timestampType)
return fieldType.Kind() == reflect.Map && fieldType.Elem().AssignableTo(protoMsgType) && !fieldType.Elem().AssignableTo(timestampType) && fieldType.Key().Kind() == reflect.String
}

func (nmff nestedMapFieldFactory) NewProtoField(msg proto.Message, fieldName string, fieldType reflect.Type, fieldValue reflect.Value) (protoField, error) {
Expand Down
2 changes: 2 additions & 0 deletions protos/peer/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ func (ccv *DynamicApplicationConfigValue) VariablyOpaqueFieldProto(name string)
return nil, fmt.Errorf("Not a marshaled field: %s", name)
}
switch ccv.name {
case "Capabilities":
return &common.Capabilities{}, nil
default:
return nil, fmt.Errorf("Unknown Application ConfigValue name: %s", ccv.name)
}
Expand Down

0 comments on commit 07d9bf8

Please sign in to comment.