From 8c6b914dd0ea9109b18975e870e25b44601eb57a Mon Sep 17 00:00:00 2001 From: krhubert Date: Fri, 29 Nov 2019 22:16:12 +0100 Subject: [PATCH 1/7] Add array and map data type to process map output --- orchestrator/orchestrator.go | 70 +++-- process/process.pb.go | 508 +++++++++++++++++++++++++++++------ process/process_test.go | 10 +- protobuf/types/process.proto | 59 +++- 4 files changed, 531 insertions(+), 116 deletions(-) diff --git a/orchestrator/orchestrator.go b/orchestrator/orchestrator.go index 2d71ce82b..612957aee 100644 --- a/orchestrator/orchestrator.go +++ b/orchestrator/orchestrator.go @@ -2,6 +2,7 @@ package orchestrator import ( "context" + "errors" "fmt" "math/rand" @@ -129,7 +130,7 @@ func (s *Orchestrator) executeNode(wf *process.Process, n *process.Process_Node, return s.processTask(n.Key, task, wf, exec, event, data) } else if m := n.GetMap(); m != nil { var err error - data, err = s.processMap(m, wf, exec, data) + data, err = s.processMap(m.Outputs, wf, exec, data) if err != nil { return err } @@ -153,30 +154,65 @@ func (s *Orchestrator) executeNode(wf *process.Process, n *process.Process_Node, return nil } -func (s *Orchestrator) processMap(mapping *process.Process_Node_Map, wf *process.Process, exec *execution.Execution, data *types.Struct) (*types.Struct, error) { +func (s *Orchestrator) processMap(outputs map[string]*process.Process_Node_Map_Output, wf *process.Process, exec *execution.Execution, data *types.Struct) (*types.Struct, error) { result := &types.Struct{ Fields: make(map[string]*types.Value), } - for _, output := range mapping.Outputs { - if ref := output.GetRef(); ref != nil { - node, err := wf.FindNode(ref.NodeKey) + for key, output := range outputs { + value, err := s.outputToValue(output, wf, exec, data) + if err != nil { + return nil, err + } + result.Fields[key] = value + } + return result, nil +} + +func (s *Orchestrator) outputToValue(output *process.Process_Node_Map_Output, wf *process.Process, exec *execution.Execution, data *types.Struct) (*types.Value, error) { + switch v := output.GetValue().(type) { + case *process.Process_Node_Map_Output_Null_: + return &types.Value{Kind: &types.Value_NullValue{NullValue: types.NullValue_NULL_VALUE}}, nil + case *process.Process_Node_Map_Output_StringConst: + return &types.Value{Kind: &types.Value_StringValue{StringValue: v.StringConst}}, nil + case *process.Process_Node_Map_Output_DoubleConst: + return &types.Value{Kind: &types.Value_NumberValue{NumberValue: v.DoubleConst}}, nil + case *process.Process_Node_Map_Output_BoolConst: + return &types.Value{Kind: &types.Value_BoolValue{BoolValue: v.BoolConst}}, nil + case *process.Process_Node_Map_Output_Map_: + out, err := s.processMap(v.Map.Outputs, wf, exec, data) + if err != nil { + return nil, err + } + return &types.Value{Kind: &types.Value_StructValue{StructValue: out}}, nil + case *process.Process_Node_Map_Output_List_: + var values []*types.Value + for i := range v.List.Outputs { + value, err := s.outputToValue(v.List.Outputs[i], wf, exec, data) if err != nil { return nil, err } - if node.GetTask() != nil { - value, err := s.resolveInput(wf.Hash, exec, ref.NodeKey, ref.Key) - if err != nil { - return nil, err - } - result.Fields[output.Key] = value - } else { - result.Fields[output.Key] = data.Fields[ref.Key] - } - } else if constant := output.GetConstant(); constant != nil { - result.Fields[output.Key] = constant + + values = append(values, value) + } + return &types.Value{ + Kind: &types.Value_ListValue{ + ListValue: &types.ListValue{ + Values: values, + }, + }, + }, nil + case *process.Process_Node_Map_Output_Ref: + node, err := wf.FindNode(v.Ref.NodeKey) + if err != nil { + return nil, err } + if node.GetTask() != nil { + return s.resolveInput(wf.Hash, exec, v.Ref.NodeKey, v.Ref.Key) + } + return data.Fields[v.Ref.Key], nil + default: + return nil, errors.New("unknown output") } - return result, nil } func (s *Orchestrator) resolveInput(wfHash hash.Hash, exec *execution.Execution, nodeKey string, outputKey string) (*types.Value, error) { diff --git a/process/process.pb.go b/process/process.pb.go index 33d093ff1..5dd695521 100644 --- a/process/process.pb.go +++ b/process/process.pb.go @@ -9,7 +9,6 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_mesg_foundation_engine_hash "github.com/mesg-foundation/engine/hash" - types "github.com/mesg-foundation/engine/protobuf/types" math "math" ) @@ -24,6 +23,28 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type Process_Node_Map_Output_Null int32 + +const ( + Process_Node_Map_Output_NULL_VALUE Process_Node_Map_Output_Null = 0 +) + +var Process_Node_Map_Output_Null_name = map[int32]string{ + 0: "NULL_VALUE", +} + +var Process_Node_Map_Output_Null_value = map[string]int32{ + "NULL_VALUE": 0, +} + +func (x Process_Node_Map_Output_Null) String() string { + return proto.EnumName(Process_Node_Map_Output_Null_name, int32(x)) +} + +func (Process_Node_Map_Output_Null) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_54c4d0e8c0aaf5c3, []int{0, 0, 3, 0, 0} +} + // Type of condition available to compare the values. type Process_Node_Filter_Condition_Predicate int32 @@ -315,10 +336,10 @@ var xxx_messageInfo_Process_Node_Task proto.InternalMessageInfo type Process_Node_Map struct { // Outputs of the mapping. - Outputs []*Process_Node_Map_Output `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs,omitempty" hash:"name:2" validate:"dive,required"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Outputs map[string]*Process_Node_Map_Output `protobuf:"bytes,1,rep,name=outputs,proto3" json:"outputs,omitempty" hash:"name:1" validate:"dive,required" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Process_Node_Map) Reset() { *m = Process_Node_Map{} } @@ -346,11 +367,14 @@ func (m *Process_Node_Map) XXX_DiscardUnknown() { var xxx_messageInfo_Process_Node_Map proto.InternalMessageInfo type Process_Node_Map_Output struct { - // Key of the output. - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty" hash:"name:1" validate:"required"` // Types that are valid to be assigned to Value: + // *Process_Node_Map_Output_Null_ + // *Process_Node_Map_Output_StringConst + // *Process_Node_Map_Output_DoubleConst + // *Process_Node_Map_Output_BoolConst // *Process_Node_Map_Output_Ref - // *Process_Node_Map_Output_Constant + // *Process_Node_Map_Output_List_ + // *Process_Node_Map_Output_Map_ Value isProcess_Node_Map_Output_Value `protobuf_oneof:"value"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -386,15 +410,35 @@ type isProcess_Node_Map_Output_Value interface { Equal(interface{}) bool } +type Process_Node_Map_Output_Null_ struct { + Null Process_Node_Map_Output_Null `protobuf:"varint,1,opt,name=null,proto3,enum=mesg.types.Process_Node_Map_Output_Null,oneof" json:"null,omitempty" hash:"name:1" validate:"required_without=Ref Constant List Map"` +} +type Process_Node_Map_Output_StringConst struct { + StringConst string `protobuf:"bytes,2,opt,name=string_const,json=stringConst,proto3,oneof" json:"string_const,omitempty" hash:"name:2"` +} +type Process_Node_Map_Output_DoubleConst struct { + DoubleConst float64 `protobuf:"fixed64,3,opt,name=double_const,json=doubleConst,proto3,oneof" json:"double_const,omitempty" hash:"name:3"` +} +type Process_Node_Map_Output_BoolConst struct { + BoolConst bool `protobuf:"varint,4,opt,name=bool_const,json=boolConst,proto3,oneof" json:"bool_const,omitempty" hash:"name:4"` +} type Process_Node_Map_Output_Ref struct { - Ref *Process_Node_Map_Output_Reference `protobuf:"bytes,2,opt,name=ref,proto3,oneof" json:"ref,omitempty" hash:"name:2" validate:"required_without=Constant"` + Ref *Process_Node_Map_Output_Reference `protobuf:"bytes,5,opt,name=ref,proto3,oneof" json:"ref,omitempty" hash:"name:5" validate:"required_without=Null Constant List Map"` +} +type Process_Node_Map_Output_List_ struct { + List *Process_Node_Map_Output_List `protobuf:"bytes,6,opt,name=list,proto3,oneof" json:"list,omitempty" hash:"name:6" validate:"required_without=Null Ref Constant Map"` } -type Process_Node_Map_Output_Constant struct { - Constant *types.Value `protobuf:"bytes,3,opt,name=constant,proto3,oneof" json:"constant,omitempty" hash:"name:3" validate:"required_without=Ref"` +type Process_Node_Map_Output_Map_ struct { + Map *Process_Node_Map_Output_Map `protobuf:"bytes,7,opt,name=map,proto3,oneof" json:"map,omitempty" hash:"name:6" validate:"required_without=Null Ref Constant List"` } -func (*Process_Node_Map_Output_Ref) isProcess_Node_Map_Output_Value() {} -func (*Process_Node_Map_Output_Constant) isProcess_Node_Map_Output_Value() {} +func (*Process_Node_Map_Output_Null_) isProcess_Node_Map_Output_Value() {} +func (*Process_Node_Map_Output_StringConst) isProcess_Node_Map_Output_Value() {} +func (*Process_Node_Map_Output_DoubleConst) isProcess_Node_Map_Output_Value() {} +func (*Process_Node_Map_Output_BoolConst) isProcess_Node_Map_Output_Value() {} +func (*Process_Node_Map_Output_Ref) isProcess_Node_Map_Output_Value() {} +func (*Process_Node_Map_Output_List_) isProcess_Node_Map_Output_Value() {} +func (*Process_Node_Map_Output_Map_) isProcess_Node_Map_Output_Value() {} func (m *Process_Node_Map_Output) GetValue() isProcess_Node_Map_Output_Value { if m != nil { @@ -403,6 +447,34 @@ func (m *Process_Node_Map_Output) GetValue() isProcess_Node_Map_Output_Value { return nil } +func (m *Process_Node_Map_Output) GetNull() Process_Node_Map_Output_Null { + if x, ok := m.GetValue().(*Process_Node_Map_Output_Null_); ok { + return x.Null + } + return Process_Node_Map_Output_NULL_VALUE +} + +func (m *Process_Node_Map_Output) GetStringConst() string { + if x, ok := m.GetValue().(*Process_Node_Map_Output_StringConst); ok { + return x.StringConst + } + return "" +} + +func (m *Process_Node_Map_Output) GetDoubleConst() float64 { + if x, ok := m.GetValue().(*Process_Node_Map_Output_DoubleConst); ok { + return x.DoubleConst + } + return 0 +} + +func (m *Process_Node_Map_Output) GetBoolConst() bool { + if x, ok := m.GetValue().(*Process_Node_Map_Output_BoolConst); ok { + return x.BoolConst + } + return false +} + func (m *Process_Node_Map_Output) GetRef() *Process_Node_Map_Output_Reference { if x, ok := m.GetValue().(*Process_Node_Map_Output_Ref); ok { return x.Ref @@ -410,9 +482,16 @@ func (m *Process_Node_Map_Output) GetRef() *Process_Node_Map_Output_Reference { return nil } -func (m *Process_Node_Map_Output) GetConstant() *types.Value { - if x, ok := m.GetValue().(*Process_Node_Map_Output_Constant); ok { - return x.Constant +func (m *Process_Node_Map_Output) GetList() *Process_Node_Map_Output_List { + if x, ok := m.GetValue().(*Process_Node_Map_Output_List_); ok { + return x.List + } + return nil +} + +func (m *Process_Node_Map_Output) GetMap() *Process_Node_Map_Output_Map { + if x, ok := m.GetValue().(*Process_Node_Map_Output_Map_); ok { + return x.Map } return nil } @@ -420,11 +499,80 @@ func (m *Process_Node_Map_Output) GetConstant() *types.Value { // XXX_OneofWrappers is for the internal use of the proto package. func (*Process_Node_Map_Output) XXX_OneofWrappers() []interface{} { return []interface{}{ + (*Process_Node_Map_Output_Null_)(nil), + (*Process_Node_Map_Output_StringConst)(nil), + (*Process_Node_Map_Output_DoubleConst)(nil), + (*Process_Node_Map_Output_BoolConst)(nil), (*Process_Node_Map_Output_Ref)(nil), - (*Process_Node_Map_Output_Constant)(nil), + (*Process_Node_Map_Output_List_)(nil), + (*Process_Node_Map_Output_Map_)(nil), } } +// ListOutput is a list of output as message, so it can be used in oneof. +type Process_Node_Map_Output_List struct { + Outputs []*Process_Node_Map_Output `protobuf:"bytes,1,rep,name=outputs,proto3" json:"outputs,omitempty" hash:"name:1" validate:"dive,required"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Process_Node_Map_Output_List) Reset() { *m = Process_Node_Map_Output_List{} } +func (m *Process_Node_Map_Output_List) String() string { return proto.CompactTextString(m) } +func (*Process_Node_Map_Output_List) ProtoMessage() {} +func (*Process_Node_Map_Output_List) Descriptor() ([]byte, []int) { + return fileDescriptor_54c4d0e8c0aaf5c3, []int{0, 0, 3, 0, 0} +} +func (m *Process_Node_Map_Output_List) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Process_Node_Map_Output_List.Unmarshal(m, b) +} +func (m *Process_Node_Map_Output_List) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Process_Node_Map_Output_List.Marshal(b, m, deterministic) +} +func (m *Process_Node_Map_Output_List) XXX_Merge(src proto.Message) { + xxx_messageInfo_Process_Node_Map_Output_List.Merge(m, src) +} +func (m *Process_Node_Map_Output_List) XXX_Size() int { + return xxx_messageInfo_Process_Node_Map_Output_List.Size(m) +} +func (m *Process_Node_Map_Output_List) XXX_DiscardUnknown() { + xxx_messageInfo_Process_Node_Map_Output_List.DiscardUnknown(m) +} + +var xxx_messageInfo_Process_Node_Map_Output_List proto.InternalMessageInfo + +// ListOutput is a list of output as message, so it can be used in oneof. +type Process_Node_Map_Output_Map struct { + Outputs map[string]*Process_Node_Map_Output `protobuf:"bytes,1,rep,name=outputs,proto3" json:"outputs,omitempty" hash:"name:1" validate:"dive,required" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Process_Node_Map_Output_Map) Reset() { *m = Process_Node_Map_Output_Map{} } +func (m *Process_Node_Map_Output_Map) String() string { return proto.CompactTextString(m) } +func (*Process_Node_Map_Output_Map) ProtoMessage() {} +func (*Process_Node_Map_Output_Map) Descriptor() ([]byte, []int) { + return fileDescriptor_54c4d0e8c0aaf5c3, []int{0, 0, 3, 0, 1} +} +func (m *Process_Node_Map_Output_Map) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Process_Node_Map_Output_Map.Unmarshal(m, b) +} +func (m *Process_Node_Map_Output_Map) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Process_Node_Map_Output_Map.Marshal(b, m, deterministic) +} +func (m *Process_Node_Map_Output_Map) XXX_Merge(src proto.Message) { + xxx_messageInfo_Process_Node_Map_Output_Map.Merge(m, src) +} +func (m *Process_Node_Map_Output_Map) XXX_Size() int { + return xxx_messageInfo_Process_Node_Map_Output_Map.Size(m) +} +func (m *Process_Node_Map_Output_Map) XXX_DiscardUnknown() { + xxx_messageInfo_Process_Node_Map_Output_Map.DiscardUnknown(m) +} + +var xxx_messageInfo_Process_Node_Map_Output_Map proto.InternalMessageInfo + type Process_Node_Map_Output_Reference struct { // Key of the node in the graph. If empty, will be using the src of the edge. NodeKey string `protobuf:"bytes,1,opt,name=nodeKey,proto3" json:"nodeKey,omitempty" hash:"name:1" validate:"required"` @@ -439,7 +587,7 @@ func (m *Process_Node_Map_Output_Reference) Reset() { *m = Process_Node_ func (m *Process_Node_Map_Output_Reference) String() string { return proto.CompactTextString(m) } func (*Process_Node_Map_Output_Reference) ProtoMessage() {} func (*Process_Node_Map_Output_Reference) Descriptor() ([]byte, []int) { - return fileDescriptor_54c4d0e8c0aaf5c3, []int{0, 0, 3, 0, 0} + return fileDescriptor_54c4d0e8c0aaf5c3, []int{0, 0, 3, 0, 2} } func (m *Process_Node_Map_Output_Reference) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Process_Node_Map_Output_Reference.Unmarshal(m, b) @@ -562,6 +710,7 @@ func (m *Process_Edge) XXX_DiscardUnknown() { var xxx_messageInfo_Process_Edge proto.InternalMessageInfo func init() { + proto.RegisterEnum("mesg.types.Process_Node_Map_Output_Null", Process_Node_Map_Output_Null_name, Process_Node_Map_Output_Null_value) proto.RegisterEnum("mesg.types.Process_Node_Filter_Condition_Predicate", Process_Node_Filter_Condition_Predicate_name, Process_Node_Filter_Condition_Predicate_value) proto.RegisterType((*Process)(nil), "mesg.types.Process") proto.RegisterType((*Process_Node)(nil), "mesg.types.Process.Node") @@ -569,7 +718,11 @@ func init() { proto.RegisterType((*Process_Node_Event)(nil), "mesg.types.Process.Node.Event") proto.RegisterType((*Process_Node_Task)(nil), "mesg.types.Process.Node.Task") proto.RegisterType((*Process_Node_Map)(nil), "mesg.types.Process.Node.Map") + proto.RegisterMapType((map[string]*Process_Node_Map_Output)(nil), "mesg.types.Process.Node.Map.OutputsEntry") proto.RegisterType((*Process_Node_Map_Output)(nil), "mesg.types.Process.Node.Map.Output") + proto.RegisterType((*Process_Node_Map_Output_List)(nil), "mesg.types.Process.Node.Map.Output.List") + proto.RegisterType((*Process_Node_Map_Output_Map)(nil), "mesg.types.Process.Node.Map.Output.Map") + proto.RegisterMapType((map[string]*Process_Node_Map_Output)(nil), "mesg.types.Process.Node.Map.Output.Map.OutputsEntry") proto.RegisterType((*Process_Node_Map_Output_Reference)(nil), "mesg.types.Process.Node.Map.Output.Reference") proto.RegisterType((*Process_Node_Filter)(nil), "mesg.types.Process.Node.Filter") proto.RegisterType((*Process_Node_Filter_Condition)(nil), "mesg.types.Process.Node.Filter.Condition") @@ -579,62 +732,74 @@ func init() { func init() { proto.RegisterFile("process.proto", fileDescriptor_54c4d0e8c0aaf5c3) } var fileDescriptor_54c4d0e8c0aaf5c3 = []byte{ - // 869 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x96, 0xcf, 0x6e, 0xeb, 0x44, - 0x14, 0xc6, 0xe3, 0xd8, 0x71, 0x6e, 0x4e, 0x7b, 0xe1, 0x32, 0x80, 0x64, 0x99, 0x4b, 0x1d, 0x82, - 0x80, 0x5e, 0x68, 0x1c, 0x6e, 0x72, 0x5b, 0x44, 0x25, 0x84, 0xe4, 0xaa, 0x55, 0xa1, 0x2d, 0x94, - 0xf0, 0x47, 0xa8, 0x1b, 0x70, 0xed, 0x89, 0x63, 0x25, 0xb1, 0x8d, 0x67, 0x9c, 0x36, 0x12, 0x1b, - 0x16, 0xbc, 0x01, 0xef, 0x00, 0x0f, 0xc0, 0x43, 0x94, 0x1d, 0x82, 0x1d, 0x0b, 0x4b, 0xb0, 0x61, - 0x9f, 0x27, 0x40, 0x33, 0xb6, 0x93, 0x14, 0x37, 0x4d, 0x52, 0x16, 0x48, 0x77, 0x67, 0x7b, 0xe6, - 0xfb, 0x9d, 0x39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13, 0xda, 0x84, 0xae, 0x58, 0x0e, 0x36, 0xa1, - 0x46, 0xeb, 0xea, 0xcf, 0x8d, 0xc2, 0x4f, 0x7f, 0x6d, 0x08, 0x67, 0x8f, 0x16, 0x77, 0xb9, 0xf4, - 0x9f, 0xf2, 0x5c, 0xe6, 0x47, 0xa3, 0xf5, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x37, 0xbd, - 0xdf, 0x65, 0x0a, 0x00, 0x00, + // 1059 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0x51, 0x6f, 0xdb, 0x54, + 0x14, 0xae, 0x1b, 0x27, 0x59, 0x4e, 0xba, 0xa9, 0x5c, 0x09, 0x64, 0x59, 0xa3, 0x0e, 0x41, 0xb0, + 0x0e, 0x5a, 0x97, 0xa5, 0x5d, 0x61, 0x95, 0xd0, 0xc0, 0xa5, 0xd3, 0x60, 0x69, 0x19, 0x81, 0x22, + 0xb4, 0x97, 0xe2, 0xda, 0x37, 0x89, 0x55, 0xd7, 0xf6, 0x7c, 0xaf, 0xbb, 0x15, 0xf1, 0x32, 0x21, + 0xc4, 0x1f, 0xe0, 0x0f, 0xf0, 0xc6, 0xff, 0xe0, 0x81, 0x3d, 0x22, 0x78, 0xe3, 0x21, 0xd2, 0xf6, + 0x13, 0xf2, 0x0b, 0xd0, 0xb9, 0xd7, 0x49, 0xd3, 0x3a, 0x69, 0xdc, 0x01, 0x42, 0xe2, 0xad, 0x37, + 0xbd, 0xdf, 0x77, 0xce, 0xf9, 0xce, 0xbd, 0xdf, 0x3d, 0x86, 0xcb, 0x51, 0x1c, 0x3a, 0x94, 0x31, + 0x33, 0x8a, 0x43, 0x1e, 0x12, 0x38, 0xa4, 0xac, 0x63, 0xf2, 0xe3, 0x88, 0x32, 0xbd, 0xde, 0x09, + 0x3b, 0xe1, 0x8a, 0xf8, 0x7d, 0x3f, 0x69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0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xbe, 0xe8, 0x7a, 0xc2, + 0x0d, 0x00, 0x00, } func (this *Process) Equal(that interface{}) bool { @@ -980,9 +1145,6 @@ func (this *Process_Node_Map_Output) Equal(that interface{}) bool { } else if this == nil { return false } - if this.Key != that1.Key { - return false - } if that1.Value == nil { if this.Value != nil { return false @@ -997,6 +1159,102 @@ func (this *Process_Node_Map_Output) Equal(that interface{}) bool { } return true } +func (this *Process_Node_Map_Output_Null_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Process_Node_Map_Output_Null_) + if !ok { + that2, ok := that.(Process_Node_Map_Output_Null_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Null != that1.Null { + return false + } + return true +} +func (this *Process_Node_Map_Output_StringConst) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Process_Node_Map_Output_StringConst) + if !ok { + that2, ok := that.(Process_Node_Map_Output_StringConst) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.StringConst != that1.StringConst { + return false + } + return true +} +func (this *Process_Node_Map_Output_DoubleConst) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Process_Node_Map_Output_DoubleConst) + if !ok { + that2, ok := that.(Process_Node_Map_Output_DoubleConst) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.DoubleConst != that1.DoubleConst { + return false + } + return true +} +func (this *Process_Node_Map_Output_BoolConst) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Process_Node_Map_Output_BoolConst) + if !ok { + that2, ok := that.(Process_Node_Map_Output_BoolConst) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.BoolConst != that1.BoolConst { + return false + } + return true +} func (this *Process_Node_Map_Output_Ref) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1021,14 +1279,38 @@ func (this *Process_Node_Map_Output_Ref) Equal(that interface{}) bool { } return true } -func (this *Process_Node_Map_Output_Constant) Equal(that interface{}) bool { +func (this *Process_Node_Map_Output_List_) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Process_Node_Map_Output_List_) + if !ok { + that2, ok := that.(Process_Node_Map_Output_List_) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.List.Equal(that1.List) { + return false + } + return true +} +func (this *Process_Node_Map_Output_Map_) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*Process_Node_Map_Output_Constant) + that1, ok := that.(*Process_Node_Map_Output_Map_) if !ok { - that2, ok := that.(Process_Node_Map_Output_Constant) + that2, ok := that.(Process_Node_Map_Output_Map_) if ok { that1 = &that2 } else { @@ -1040,7 +1322,71 @@ func (this *Process_Node_Map_Output_Constant) Equal(that interface{}) bool { } else if this == nil { return false } - if !this.Constant.Equal(that1.Constant) { + if !this.Map.Equal(that1.Map) { + return false + } + return true +} +func (this *Process_Node_Map_Output_List) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Process_Node_Map_Output_List) + if !ok { + that2, ok := that.(Process_Node_Map_Output_List) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Outputs) != len(that1.Outputs) { + return false + } + for i := range this.Outputs { + if !this.Outputs[i].Equal(that1.Outputs[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { + return false + } + return true +} +func (this *Process_Node_Map_Output_Map) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Process_Node_Map_Output_Map) + if !ok { + that2, ok := that.(Process_Node_Map_Output_Map) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Outputs) != len(that1.Outputs) { + return false + } + for i := range this.Outputs { + if !this.Outputs[i].Equal(that1.Outputs[i]) { + return false + } + } + if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true diff --git a/process/process_test.go b/process/process_test.go index e6687f712..0bb62ce7e 100644 --- a/process/process_test.go +++ b/process/process_test.go @@ -172,9 +172,8 @@ func TestValidateProcess(t *testing.T) { Nodes: append(nodes, &Process_Node{ Key: "mapping", Type: &Process_Node_Map_{&Process_Node_Map{ - Outputs: []*Process_Node_Map_Output{ - { - Key: "-", + Outputs: map[string]*Process_Node_Map_Output{ + "key": { Value: &Process_Node_Map_Output_Ref{ Ref: &Process_Node_Map_Output_Reference{Key: "-", NodeKey: "invalid"}, }, @@ -189,9 +188,8 @@ func TestValidateProcess(t *testing.T) { Nodes: append(nodes, &Process_Node{ Key: "mapping", Type: &Process_Node_Map_{&Process_Node_Map{ - Outputs: []*Process_Node_Map_Output{ - { - Key: "-", + Outputs: map[string]*Process_Node_Map_Output{ + "key": { Value: &Process_Node_Map_Output_Ref{ Ref: &Process_Node_Map_Output_Reference{Key: "-", NodeKey: "nodeKey1"}, }, diff --git a/protobuf/types/process.proto b/protobuf/types/process.proto index 878fc5188..793a7b84d 100644 --- a/protobuf/types/process.proto +++ b/protobuf/types/process.proto @@ -1,7 +1,6 @@ syntax = "proto3"; import "gogo/protobuf/gogoproto/gogo.proto"; -import "protobuf/types/struct.proto"; package mesg.types; option go_package = "github.com/mesg-foundation/engine/process"; @@ -57,6 +56,24 @@ message Process { message Map { message Output { + enum Null { + NULL_VALUE = 0; + } + + // ListOutput is a list of output as message, so it can be used in oneof. + message List { + repeated Output outputs = 1 [ + (gogoproto.moretags) = 'hash:"name:1" validate:"dive,required"' + ]; + } + + // ListOutput is a list of output as message, so it can be used in oneof. + message Map { + map outputs = 1 [ + (gogoproto.moretags) = 'hash:"name:1" validate:"dive,required"' + ]; + } + message Reference { // Key of the node in the graph. If empty, will be using the src of the edge. string nodeKey = 1 [ @@ -69,25 +86,43 @@ message Process { ]; } - // Key of the output. - string key = 1 [ - (gogoproto.moretags) = 'hash:"name:1" validate:"required"' - ]; - oneof value { + Null null = 1 [ + (gogoproto.moretags) = 'hash:"name:1" validate:"required_without=Ref Constant List Map"' + ]; + + string string_const = 2 [ + (gogoproto.moretags) = 'hash:"name:2"' + ]; + + double double_const = 3 [ + (gogoproto.moretags) = 'hash:"name:3"' + ]; + + bool bool_const = 4 [ + (gogoproto.moretags) = 'hash:"name:4"' + ]; + // Input defined as reference. - Reference ref = 2 [ - (gogoproto.moretags) = 'hash:"name:2" validate:"required_without=Constant"' + Reference ref = 5 [ + (gogoproto.moretags) = 'hash:"name:5" validate:"required_without=Null Constant List Map"' ]; - mesg.protobuf.Value constant = 3 [ - (gogoproto.moretags) = 'hash:"name:3" validate:"required_without=Ref"' + + // Outputs represent array. + List list = 6 [ + (gogoproto.moretags) = 'hash:"name:6" validate:"required_without=Null Ref Constant Map"' + ]; + + // Outputs represent a field. + Map map = 7 [ + (gogoproto.moretags) = 'hash:"name:6" validate:"required_without=Null Ref Constant List"' ]; } } // Outputs of the mapping. - repeated Output outputs = 2 [ - (gogoproto.moretags) = 'hash:"name:2" validate:"dive,required"' + map outputs = 1 [ + (gogoproto.moretags) = 'hash:"name:1" validate:"dive,required"' ]; } From 4a0c049a0a480fafb50452197ad7ac25d3643a51 Mon Sep 17 00:00:00 2001 From: krhubert Date: Thu, 5 Dec 2019 00:08:38 +0100 Subject: [PATCH 2/7] Fix orchestrator e2e tests --- e2e/orchestrator_event_map_task_map_task_test.go | 14 ++++++-------- e2e/orchestrator_event_map_task_test.go | 9 ++++----- e2e/orchestrator_result_map_task_map_task_test.go | 14 ++++++-------- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/e2e/orchestrator_event_map_task_map_task_test.go b/e2e/orchestrator_event_map_task_map_task_test.go index abe4eb35d..2baeea770 100644 --- a/e2e/orchestrator_event_map_task_map_task_test.go +++ b/e2e/orchestrator_event_map_task_map_task_test.go @@ -34,11 +34,10 @@ func testOrchestratorEventMapTaskMapTask(executionStream pb.Execution_StreamClie Key: "n1", Type: &process.Process_Node_Map_{ Map: &process.Process_Node_Map{ - Outputs: []*process.Process_Node_Map_Output{ - { - Key: "msg", - Value: &process.Process_Node_Map_Output_Constant{ - Constant: &types.Value{Kind: &types.Value_StringValue{StringValue: "itsAConstant"}}, + Outputs: map[string]*process.Process_Node_Map_Output{ + "msg": { + Value: &process.Process_Node_Map_Output_StringConst{ + StringConst: "itsAConstant", }, }, }, @@ -58,9 +57,8 @@ func testOrchestratorEventMapTaskMapTask(executionStream pb.Execution_StreamClie Key: "n3", Type: &process.Process_Node_Map_{ Map: &process.Process_Node_Map{ - Outputs: []*process.Process_Node_Map_Output{ - { - Key: "msg", + Outputs: map[string]*process.Process_Node_Map_Output{ + "msg": { Value: &process.Process_Node_Map_Output_Ref{ Ref: &process.Process_Node_Map_Output_Reference{ NodeKey: "n0", diff --git a/e2e/orchestrator_event_map_task_test.go b/e2e/orchestrator_event_map_task_test.go index d67e24dc3..31035791e 100644 --- a/e2e/orchestrator_event_map_task_test.go +++ b/e2e/orchestrator_event_map_task_test.go @@ -34,11 +34,10 @@ func testOrchestratorEventMapTask(executionStream pb.Execution_StreamClient, ins Key: "n1", Type: &process.Process_Node_Map_{ Map: &process.Process_Node_Map{ - Outputs: []*process.Process_Node_Map_Output{ - { - Key: "msg", - Value: &process.Process_Node_Map_Output_Constant{ - Constant: &types.Value{Kind: &types.Value_StringValue{StringValue: "itsAConstant"}}, + Outputs: map[string]*process.Process_Node_Map_Output{ + "msg": { + Value: &process.Process_Node_Map_Output_StringConst{ + StringConst: "itsAConstant", }, }, }, diff --git a/e2e/orchestrator_result_map_task_map_task_test.go b/e2e/orchestrator_result_map_task_map_task_test.go index 28c8deed1..716127582 100644 --- a/e2e/orchestrator_result_map_task_map_task_test.go +++ b/e2e/orchestrator_result_map_task_map_task_test.go @@ -33,11 +33,10 @@ func testOrchestratorResultMapTaskMapTask(executionStream pb.Execution_StreamCli Key: "n1", Type: &process.Process_Node_Map_{ Map: &process.Process_Node_Map{ - Outputs: []*process.Process_Node_Map_Output{ - { - Key: "msg", - Value: &process.Process_Node_Map_Output_Constant{ - Constant: &types.Value{Kind: &types.Value_StringValue{StringValue: "itsAConstant"}}, + Outputs: map[string]*process.Process_Node_Map_Output{ + "msg": { + Value: &process.Process_Node_Map_Output_StringConst{ + StringConst: "itsAConstant", }, }, }, @@ -57,9 +56,8 @@ func testOrchestratorResultMapTaskMapTask(executionStream pb.Execution_StreamCli Key: "n3", Type: &process.Process_Node_Map_{ Map: &process.Process_Node_Map{ - Outputs: []*process.Process_Node_Map_Output{ - { - Key: "msg", + Outputs: map[string]*process.Process_Node_Map_Output{ + "msg": { Value: &process.Process_Node_Map_Output_Ref{ Ref: &process.Process_Node_Map_Output_Reference{ NodeKey: "n0", From 4c32aa951c601bbcb23ec93be737ee8549a8fdbb Mon Sep 17 00:00:00 2001 From: Nicolas Mahe Date: Thu, 5 Dec 2019 11:13:25 +0700 Subject: [PATCH 3/7] add e2e test with nested map --- e2e/orchestrator_event_filter_task_test.go | 2 + ...vent_map_task_map_task_omplex_data_test.go | 152 ++++++++++++++++++ e2e/orchestrator_event_map_task_test.go | 2 + ...chestrator_event_task_complex_data_test.go | 2 + e2e/orchestrator_event_task_test.go | 2 + ...hestrator_result_map_task_map_task_test.go | 2 + e2e/orchestrator_result_task_test.go | 4 + e2e/orchestrator_test.go | 3 + 8 files changed, 169 insertions(+) create mode 100644 e2e/orchestrator_event_map_task_map_task_omplex_data_test.go diff --git a/e2e/orchestrator_event_filter_task_test.go b/e2e/orchestrator_event_filter_task_test.go index 7ce1ef6e9..e96e6e711 100644 --- a/e2e/orchestrator_event_filter_task_test.go +++ b/e2e/orchestrator_event_filter_task_test.go @@ -89,6 +89,7 @@ func testOrchestratorEventFilterTask(executionStream pb.Execution_StreamClient, exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task1", exec.TaskKey) + require.Equal(t, "n2", exec.NodeKey) require.True(t, processHash.Equal(exec.ProcessHash)) require.Equal(t, execution.Status_InProgress, exec.Status) require.Equal(t, "shouldMatch", exec.Inputs.Fields["msg"].GetStringValue()) @@ -97,6 +98,7 @@ func testOrchestratorEventFilterTask(executionStream pb.Execution_StreamClient, exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task1", exec.TaskKey) + require.Equal(t, "n2", exec.NodeKey) require.True(t, processHash.Equal(exec.ProcessHash)) require.Equal(t, execution.Status_Completed, exec.Status) require.Equal(t, "shouldMatch", exec.Outputs.Fields["msg"].GetStringValue()) diff --git a/e2e/orchestrator_event_map_task_map_task_omplex_data_test.go b/e2e/orchestrator_event_map_task_map_task_omplex_data_test.go new file mode 100644 index 000000000..4097fafd7 --- /dev/null +++ b/e2e/orchestrator_event_map_task_map_task_omplex_data_test.go @@ -0,0 +1,152 @@ +package main + +import ( + "context" + "testing" + + "github.com/mesg-foundation/engine/execution" + "github.com/mesg-foundation/engine/hash" + "github.com/mesg-foundation/engine/process" + pb "github.com/mesg-foundation/engine/protobuf/api" + "github.com/mesg-foundation/engine/protobuf/types" + "github.com/stretchr/testify/require" +) + +func testOrchestratorEventMapTaskMapTaskComplexData(executionStream pb.Execution_StreamClient, instanceHash hash.Hash) func(t *testing.T) { + return func(t *testing.T) { + var ( + processHash hash.Hash + dataEvent = &types.Struct{ + Fields: map[string]*types.Value{ + "msg": { + Kind: &types.Value_StructValue{ + StructValue: &types.Struct{ + Fields: map[string]*types.Value{ + "msg": { + Kind: &types.Value_StringValue{ + StringValue: "complex", + }, + }, + "timestamp": { + Kind: &types.Value_NumberValue{ + NumberValue: 101, + }, + }, + "array": { + Kind: &types.Value_ListValue{ + ListValue: &types.ListValue{Values: []*types.Value{ + {Kind: &types.Value_StringValue{StringValue: "first"}}, + {Kind: &types.Value_StringValue{StringValue: "second"}}, + {Kind: &types.Value_StringValue{StringValue: "third"}}, + }}, + }, + }, + }, + }, + }, + }, + }, + } + ) + t.Run("create process", func(t *testing.T) { + respProc, err := client.ProcessClient.Create(context.Background(), &pb.CreateProcessRequest{ + Name: "event-map-task-map-task-complex-data-process", + Nodes: []*process.Process_Node{ + { + Key: "n0", + Type: &process.Process_Node_Event_{ + Event: &process.Process_Node_Event{ + InstanceHash: instanceHash, + EventKey: "test_event_complex", + }, + }, + }, + { + Key: "n1", + Type: &process.Process_Node_Map_{ + Map: &process.Process_Node_Map{ + Outputs: map[string]*process.Process_Node_Map_Output{ + "msg": { + Value: &process.Process_Node_Map_Output_Map_{ + Map: &process.Process_Node_Map_Output_Map{Outputs: map[string]*process.Process_Node_Map_Output{ + "msg": {Value: &process.Process_Node_Map_Output_StringConst{ + StringConst: "isAConstant", + }}, + "array": {Value: &process.Process_Node_Map_Output_List_{ + List: &process.Process_Node_Map_Output_List{Outputs: []*process.Process_Node_Map_Output{ + {Value: &process.Process_Node_Map_Output_StringConst{StringConst: "first-constant"}}, + {Value: &process.Process_Node_Map_Output_StringConst{StringConst: "second-constant"}}, + {Value: &process.Process_Node_Map_Output_StringConst{StringConst: "third-constant"}}, + {Value: &process.Process_Node_Map_Output_StringConst{StringConst: "fourth-constant"}}, + }}, + }}, + }}, + }, + }, + }, + }, + }, + }, + { + Key: "n2", + Type: &process.Process_Node_Task_{ + Task: &process.Process_Node_Task{ + InstanceHash: instanceHash, + TaskKey: "task_complex", + }, + }, + }, + }, + Edges: []*process.Process_Edge{ + {Src: "n0", Dst: "n1"}, + {Src: "n1", Dst: "n2"}, + }, + }) + require.NoError(t, err) + processHash = respProc.Hash + }) + t.Run("trigger process", func(t *testing.T) { + _, err := client.EventClient.Create(context.Background(), &pb.CreateEventRequest{ + InstanceHash: instanceHash, + Key: "test_event_complex", + Data: dataEvent, + }) + require.NoError(t, err) + }) + t.Run("first task", func(t *testing.T) { + t.Run("check in progress execution", func(t *testing.T) { + exec, err := executionStream.Recv() + require.NoError(t, err) + require.Equal(t, "task_complex", exec.TaskKey) + require.Equal(t, "n2", exec.NodeKey) + require.True(t, processHash.Equal(exec.ProcessHash)) + require.Equal(t, execution.Status_InProgress, exec.Status) + require.Equal(t, "isAConstant", exec.Inputs.Fields["msg"].GetStructValue().Fields["msg"].GetStringValue()) + require.Len(t, exec.Inputs.Fields["msg"].GetStructValue().Fields["array"].GetListValue().Values, 4) + require.Equal(t, "first-constant", exec.Inputs.Fields["msg"].GetStructValue().Fields["array"].GetListValue().Values[0].GetStringValue()) + require.Equal(t, "second-constant", exec.Inputs.Fields["msg"].GetStructValue().Fields["array"].GetListValue().Values[1].GetStringValue()) + require.Equal(t, "third-constant", exec.Inputs.Fields["msg"].GetStructValue().Fields["array"].GetListValue().Values[2].GetStringValue()) + require.Equal(t, "fourth-constant", exec.Inputs.Fields["msg"].GetStructValue().Fields["array"].GetListValue().Values[3].GetStringValue()) + }) + t.Run("check completed execution", func(t *testing.T) { + exec, err := executionStream.Recv() + require.NoError(t, err) + require.Equal(t, "task_complex", exec.TaskKey) + require.Equal(t, "n2", exec.NodeKey) + require.True(t, processHash.Equal(exec.ProcessHash)) + require.Equal(t, execution.Status_Completed, exec.Status) + require.Equal(t, "isAConstant", exec.Outputs.Fields["msg"].GetStructValue().Fields["msg"].GetStringValue()) + require.Len(t, exec.Outputs.Fields["msg"].GetStructValue().Fields["array"].GetListValue().Values, 4) + require.Equal(t, "first-constant", exec.Outputs.Fields["msg"].GetStructValue().Fields["array"].GetListValue().Values[0].GetStringValue()) + require.Equal(t, "second-constant", exec.Outputs.Fields["msg"].GetStructValue().Fields["array"].GetListValue().Values[1].GetStringValue()) + require.Equal(t, "third-constant", exec.Outputs.Fields["msg"].GetStructValue().Fields["array"].GetListValue().Values[2].GetStringValue()) + require.Equal(t, "fourth-constant", exec.Outputs.Fields["msg"].GetStructValue().Fields["array"].GetListValue().Values[3].GetStringValue()) + require.NotEmpty(t, exec.Outputs.Fields["msg"].GetStructValue().Fields["timestamp"].GetNumberValue()) + }) + }) + t.Run("delete process", func(t *testing.T) { + _, err := client.ProcessClient.Delete(context.Background(), &pb.DeleteProcessRequest{Hash: processHash}) + require.NoError(t, err) + }) + } +} diff --git a/e2e/orchestrator_event_map_task_test.go b/e2e/orchestrator_event_map_task_test.go index 31035791e..c4a02a36c 100644 --- a/e2e/orchestrator_event_map_task_test.go +++ b/e2e/orchestrator_event_map_task_test.go @@ -87,6 +87,7 @@ func testOrchestratorEventMapTask(executionStream pb.Execution_StreamClient, ins exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task1", exec.TaskKey) + require.Equal(t, "n2", exec.NodeKey) require.True(t, processHash.Equal(exec.ProcessHash)) require.Equal(t, execution.Status_InProgress, exec.Status) require.Equal(t, "itsAConstant", exec.Inputs.Fields["msg"].GetStringValue()) @@ -95,6 +96,7 @@ func testOrchestratorEventMapTask(executionStream pb.Execution_StreamClient, ins exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task1", exec.TaskKey) + require.Equal(t, "n2", exec.NodeKey) require.True(t, processHash.Equal(exec.ProcessHash)) require.Equal(t, execution.Status_Completed, exec.Status) require.Equal(t, "itsAConstant", exec.Outputs.Fields["msg"].GetStringValue()) diff --git a/e2e/orchestrator_event_task_complex_data_test.go b/e2e/orchestrator_event_task_complex_data_test.go index e4ef66cdc..d613415c1 100644 --- a/e2e/orchestrator_event_task_complex_data_test.go +++ b/e2e/orchestrator_event_task_complex_data_test.go @@ -90,6 +90,7 @@ func testOrchestratorEventTaskComplexData(executionStream pb.Execution_StreamCli exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task_complex", exec.TaskKey) + require.Equal(t, "n1", exec.NodeKey) require.True(t, processHash.Equal(exec.ProcessHash)) require.Equal(t, execution.Status_InProgress, exec.Status) require.True(t, data.Equal(exec.Inputs)) @@ -98,6 +99,7 @@ func testOrchestratorEventTaskComplexData(executionStream pb.Execution_StreamCli exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task_complex", exec.TaskKey) + require.Equal(t, "n1", exec.NodeKey) require.True(t, processHash.Equal(exec.ProcessHash)) require.Equal(t, execution.Status_Completed, exec.Status) require.True(t, data.Equal(exec.Inputs)) diff --git a/e2e/orchestrator_event_task_test.go b/e2e/orchestrator_event_task_test.go index e155a2ca5..2b5246004 100644 --- a/e2e/orchestrator_event_task_test.go +++ b/e2e/orchestrator_event_task_test.go @@ -72,6 +72,7 @@ func testOrchestratorEventTask(executionStream pb.Execution_StreamClient, instan exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task1", exec.TaskKey) + require.Equal(t, "n1", exec.NodeKey) require.True(t, processHash.Equal(exec.ProcessHash)) require.Equal(t, execution.Status_InProgress, exec.Status) require.Equal(t, "foo_1", exec.Inputs.Fields["msg"].GetStringValue()) @@ -80,6 +81,7 @@ func testOrchestratorEventTask(executionStream pb.Execution_StreamClient, instan exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task1", exec.TaskKey) + require.Equal(t, "n1", exec.NodeKey) require.True(t, processHash.Equal(exec.ProcessHash)) require.Equal(t, execution.Status_Completed, exec.Status) require.Equal(t, "foo_1", exec.Outputs.Fields["msg"].GetStringValue()) diff --git a/e2e/orchestrator_result_map_task_map_task_test.go b/e2e/orchestrator_result_map_task_map_task_test.go index 716127582..e535768ae 100644 --- a/e2e/orchestrator_result_map_task_map_task_test.go +++ b/e2e/orchestrator_result_map_task_map_task_test.go @@ -111,6 +111,7 @@ func testOrchestratorResultMapTaskMapTask(executionStream pb.Execution_StreamCli exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task2", exec.TaskKey) + require.Equal(t, "", exec.NodeKey) require.True(t, hash.Int(11010101011).Equal(exec.EventHash)) require.Equal(t, execution.Status_InProgress, exec.Status) require.True(t, exec.Inputs.Equal(&types.Struct{ @@ -127,6 +128,7 @@ func testOrchestratorResultMapTaskMapTask(executionStream pb.Execution_StreamCli exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task2", exec.TaskKey) + require.Equal(t, "", exec.NodeKey) require.True(t, hash.Int(11010101011).Equal(exec.EventHash)) require.Equal(t, execution.Status_Completed, exec.Status) require.Equal(t, "foo_result", exec.Outputs.Fields["msg"].GetStringValue()) diff --git a/e2e/orchestrator_result_task_test.go b/e2e/orchestrator_result_task_test.go index b07ca64a8..65eb4b06c 100644 --- a/e2e/orchestrator_result_task_test.go +++ b/e2e/orchestrator_result_task_test.go @@ -68,6 +68,7 @@ func testOrchestratorResultTask(executionStream pb.Execution_StreamClient, runne exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task1", exec.TaskKey) + require.Equal(t, "", exec.NodeKey) require.True(t, hash.Int(11010101011).Equal(exec.EventHash)) require.Equal(t, execution.Status_InProgress, exec.Status) require.True(t, exec.Inputs.Equal(&types.Struct{ @@ -84,6 +85,7 @@ func testOrchestratorResultTask(executionStream pb.Execution_StreamClient, runne exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task1", exec.TaskKey) + require.Equal(t, "", exec.NodeKey) require.True(t, hash.Int(11010101011).Equal(exec.EventHash)) require.Equal(t, execution.Status_Completed, exec.Status) require.Equal(t, "foo_2", exec.Outputs.Fields["msg"].GetStringValue()) @@ -94,6 +96,7 @@ func testOrchestratorResultTask(executionStream pb.Execution_StreamClient, runne exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task2", exec.TaskKey) + require.Equal(t, "n1", exec.NodeKey) require.Equal(t, processHash, exec.ProcessHash) require.Equal(t, execution.Status_InProgress, exec.Status) require.Equal(t, "foo_2", exec.Inputs.Fields["msg"].GetStringValue()) @@ -102,6 +105,7 @@ func testOrchestratorResultTask(executionStream pb.Execution_StreamClient, runne exec, err := executionStream.Recv() require.NoError(t, err) require.Equal(t, "task2", exec.TaskKey) + require.Equal(t, "n1", exec.NodeKey) require.Equal(t, processHash, exec.ProcessHash) require.Equal(t, execution.Status_Completed, exec.Status) require.Equal(t, "foo_2", exec.Outputs.Fields["msg"].GetStringValue()) diff --git a/e2e/orchestrator_test.go b/e2e/orchestrator_test.go index ea051a1d4..68a99e8f0 100644 --- a/e2e/orchestrator_test.go +++ b/e2e/orchestrator_test.go @@ -21,5 +21,8 @@ func testOrchestrator(t *testing.T) { t.Run("result map task map task", testOrchestratorResultMapTaskMapTask(executionStream, testRunnerHash, testInstanceHash)) t.Run("event map task map task", testOrchestratorEventMapTaskMapTask(executionStream, testInstanceHash)) t.Run("event task complex data", testOrchestratorEventTaskComplexData(executionStream, testInstanceHash)) + t.Run("event map task map task complex data", testOrchestratorEventMapTaskMapTaskComplexData(executionStream, testInstanceHash)) + + // to execute last because of go routine leak. See fixme in following function t.Run("event filter task", testOrchestratorEventFilterTask(executionStream, testInstanceHash)) } From a16812573d2b511f425aa1d347423683fea6f047 Mon Sep 17 00:00:00 2001 From: krhubert Date: Wed, 11 Dec 2019 10:16:16 +0100 Subject: [PATCH 4/7] Remove required_without for oneof process value --- process/process.pb.go | 140 +++++++++++++++++------------------ protobuf/types/process.proto | 8 +- 2 files changed, 72 insertions(+), 76 deletions(-) diff --git a/process/process.pb.go b/process/process.pb.go index 5dd695521..a9a2cdc57 100644 --- a/process/process.pb.go +++ b/process/process.pb.go @@ -411,7 +411,7 @@ type isProcess_Node_Map_Output_Value interface { } type Process_Node_Map_Output_Null_ struct { - Null Process_Node_Map_Output_Null `protobuf:"varint,1,opt,name=null,proto3,enum=mesg.types.Process_Node_Map_Output_Null,oneof" json:"null,omitempty" hash:"name:1" validate:"required_without=Ref Constant List Map"` + Null Process_Node_Map_Output_Null `protobuf:"varint,1,opt,name=null,proto3,enum=mesg.types.Process_Node_Map_Output_Null,oneof" json:"null,omitempty" hash:"name:1"` } type Process_Node_Map_Output_StringConst struct { StringConst string `protobuf:"bytes,2,opt,name=string_const,json=stringConst,proto3,oneof" json:"string_const,omitempty" hash:"name:2"` @@ -423,13 +423,13 @@ type Process_Node_Map_Output_BoolConst struct { BoolConst bool `protobuf:"varint,4,opt,name=bool_const,json=boolConst,proto3,oneof" json:"bool_const,omitempty" hash:"name:4"` } type Process_Node_Map_Output_Ref struct { - Ref *Process_Node_Map_Output_Reference `protobuf:"bytes,5,opt,name=ref,proto3,oneof" json:"ref,omitempty" hash:"name:5" validate:"required_without=Null Constant List Map"` + Ref *Process_Node_Map_Output_Reference `protobuf:"bytes,5,opt,name=ref,proto3,oneof" json:"ref,omitempty" hash:"name:5"` } type Process_Node_Map_Output_List_ struct { - List *Process_Node_Map_Output_List `protobuf:"bytes,6,opt,name=list,proto3,oneof" json:"list,omitempty" hash:"name:6" validate:"required_without=Null Ref Constant Map"` + List *Process_Node_Map_Output_List `protobuf:"bytes,6,opt,name=list,proto3,oneof" json:"list,omitempty" hash:"name:6"` } type Process_Node_Map_Output_Map_ struct { - Map *Process_Node_Map_Output_Map `protobuf:"bytes,7,opt,name=map,proto3,oneof" json:"map,omitempty" hash:"name:6" validate:"required_without=Null Ref Constant List"` + Map *Process_Node_Map_Output_Map `protobuf:"bytes,7,opt,name=map,proto3,oneof" json:"map,omitempty" hash:"name:7"` } func (*Process_Node_Map_Output_Null_) isProcess_Node_Map_Output_Value() {} @@ -732,74 +732,70 @@ func init() { func init() { proto.RegisterFile("process.proto", fileDescriptor_54c4d0e8c0aaf5c3) } var fileDescriptor_54c4d0e8c0aaf5c3 = []byte{ - // 1059 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0x51, 0x6f, 0xdb, 0x54, - 0x14, 0xae, 0x1b, 0x27, 0x59, 0x4e, 0xba, 0xa9, 0x5c, 0x09, 0x64, 0x59, 0xa3, 0x0e, 0x41, 0xb0, - 0x0e, 0x5a, 0x97, 0xa5, 0x5d, 0x61, 0x95, 0xd0, 0xc0, 0xa5, 0xd3, 0x60, 0x69, 0x19, 0x81, 0x22, - 0xb4, 0x97, 0xe2, 0xda, 0x37, 0x89, 0x55, 0xd7, 0xf6, 0x7c, 0xaf, 0xbb, 0x15, 0xf1, 0x32, 0x21, - 0xc4,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0x55, - 0x28, 0xef, 0x06, 0x07, 0x41, 0xf8, 0x28, 0x98, 0x9f, 0x21, 0x25, 0x98, 0xdd, 0xfa, 0x6c, 0x5e, - 0xb1, 0x4a, 0xa0, 0x62, 0xb6, 0xfa, 0x63, 0x50, 0x71, 0x3c, 0xc7, 0xe3, 0xc4, 0x62, 0xe7, 0x82, - 0x23, 0x36, 0x8b, 0x1d, 0x04, 0xba, 0xc3, 0xd7, 0x25, 0xef, 0x39, 0x74, 0x19, 0xb7, 0x56, 0x9f, - 0x3e, 0x5b, 0x98, 0xf9, 0xf9, 0xf9, 0x82, 0xf2, 0xe0, 0xfa, 0xf4, 0xf9, 0x22, 0xfd, 0x60, 0xdb, - 0x2f, 0x89, 0x2f, 0xb0, 0xd5, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xbe, 0xe8, 0x7a, 0xc2, - 0x0d, 0x00, 0x00, + // 1000 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x97, 0xc1, 0x6e, 0x1b, 0x45, + 0x18, 0xc7, 0xbd, 0xf6, 0xda, 0xae, 0x3f, 0xbb, 0x51, 0x18, 0xa9, 0x68, 0xb5, 0x2a, 0xb1, 0x31, + 0x82, 0xa6, 0x90, 0xac, 0x89, 0x9d, 0xb6, 0x34, 0x17, 0xc4, 0x46, 0xae, 0x0a, 0x75, 0x43, 0x6b, + 0x1a, 0x84, 0x7a, 0x09, 0xeb, 0xdd, 0xb1, 0xb3, 0xca, 0x66, 0xc6, 0xdd, 0x99, 0x0d, 0x0d, 0xe2, + 0xc2, 0x81, 0x27, 0x80, 0x87, 0xe0, 0x51, 0x7a, 0x44, 0x70, 0xe3, 0x60, 0x89, 0x3e, 0x82, 0x25, + 0x0e, 0xdc, 0xd0, 0xcc, 0xac, 0x1d, 0x27, 0x6b, 0x27, 0x9b, 0x02, 0x42, 0xea, 0x2d, 0xeb, 0x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7, 0xa0, 0xa0, 0xce, 0x5e, 0xf4, 0x35, 0x80, 0x4b, 0x89, + 0xe7, 0x8b, 0xf4, 0x65, 0x46, 0xf6, 0x82, 0x6c, 0x53, 0x22, 0x6b, 0x7b, 0xa2, 0xb0, 0xaf, 0x89, + 0x4c, 0x4f, 0xc4, 0x46, 0x77, 0x86, 0x69, 0xfe, 0x94, 0x85, 0xd2, 0x54, 0x80, 0xec, 0xd9, 0xbb, + 0xd7, 0xd9, 0x60, 0x9e, 0x6b, 0xf9, 0xda, 0x49, 0x42, 0xc7, 0xd7, 0xb0, 0xe7, 0x50, 0x1a, 0x86, + 0xd8, 0xf3, 0x5d, 0x87, 0x2b, 0x07, 0x96, 0x9a, 0xad, 0xd4, 0xaf, 0x6c, 0x3d, 0x9a, 0x48, 0xd3, + 0x2e, 0xda, 0xc9, 0x64, 0xe8, 0xc6, 0xc4, 0xf7, 0xdc, 0xdc, 0xc0, 0x6c, 0xd5, 0x63, 0x97, 0xeb, + 0x35, 0x28, 0x4d, 0xe7, 0x41, 0x65, 0x28, 0xee, 0x92, 0x03, 0x42, 0xbf, 0x21, 0xcb, 0x19, 0x54, + 0x80, 0x6c, 0xfb, 0xf1, 0xb2, 0x66, 0x17, 0x40, 0x17, 0x6f, 0x6b, 0x3e, 0x07, 0x5d, 0x5c, 0x68, + 0x45, 0x3b, 0xb1, 0xd0, 0xbd, 0xe4, 0xa5, 0x94, 0x85, 0xae, 0x10, 0x7a, 0xd3, 0x08, 0x4f, 0xdb, + 0x87, 0x1e, 0xe3, 0x76, 0xeb, 0xc5, 0x1f, 0x2b, 0x99, 0x9f, 0x5f, 0xae, 0x68, 0x4f, 0x6f, 0x5e, + 0x7c, 0x22, 0xc7, 0x9f, 0x38, 0xbd, 0x82, 0xfc, 0x66, 0x69, 0xfd, 0x1d, 0x00, 0x00, 0xff, 0xff, + 0x32, 0xeb, 0x3b, 0x5c, 0xf4, 0x0c, 0x00, 0x00, } func (this *Process) Equal(that interface{}) bool { diff --git a/protobuf/types/process.proto b/protobuf/types/process.proto index 793a7b84d..eaa631ab8 100644 --- a/protobuf/types/process.proto +++ b/protobuf/types/process.proto @@ -88,7 +88,7 @@ message Process { oneof value { Null null = 1 [ - (gogoproto.moretags) = 'hash:"name:1" validate:"required_without=Ref Constant List Map"' + (gogoproto.moretags) = 'hash:"name:1"' ]; string string_const = 2 [ @@ -105,17 +105,17 @@ message Process { // Input defined as reference. Reference ref = 5 [ - (gogoproto.moretags) = 'hash:"name:5" validate:"required_without=Null Constant List Map"' + (gogoproto.moretags) = 'hash:"name:5"' ]; // Outputs represent array. List list = 6 [ - (gogoproto.moretags) = 'hash:"name:6" validate:"required_without=Null Ref Constant Map"' + (gogoproto.moretags) = 'hash:"name:6"' ]; // Outputs represent a field. Map map = 7 [ - (gogoproto.moretags) = 'hash:"name:6" validate:"required_without=Null Ref Constant List"' + (gogoproto.moretags) = 'hash:"name:7"' ]; } } From bb2b5b3a093393410c80c0901ce22a72fa0ab8d6 Mon Sep 17 00:00:00 2001 From: Nicolas Mahe Date: Wed, 11 Dec 2019 17:24:04 +0700 Subject: [PATCH 5/7] Register Process_Node_Map_Output to the codec. Add (Un)MarshalAmino function to Process_Node_Map to convert map to key value. Add amino unsafe flag to map's double_const parameter. --- process/codec.go | 45 +++++++++++- process/process.pb.go | 131 ++++++++++++++++++----------------- protobuf/types/process.proto | 2 +- 3 files changed, 111 insertions(+), 67 deletions(-) diff --git a/process/codec.go b/process/codec.go index 5065ad90b..cbd8aff80 100644 --- a/process/codec.go +++ b/process/codec.go @@ -2,12 +2,21 @@ package process import ( "github.com/mesg-foundation/engine/codec" + "sort" ) func init() { codec.RegisterInterface((*isProcess_Node_Map_Output_Value)(nil), nil) codec.RegisterConcrete(&Process_Node_Map_Output_Ref{}, "mesg.types.Process_Node_Map_Output_Ref", nil) - codec.RegisterConcrete(&Process_Node_Map_Output_Constant{}, "mesg.types.Process_Node_Map_Output_Constant", nil) + codec.RegisterConcrete(&Process_Node_Map_Output_Reference{}, "mesg.types.Process_Node_Map_Output_Reference", nil) + codec.RegisterConcrete(&Process_Node_Map_Output_Null_{}, "mesg.types.Process_Node_Map_Output_Null_", nil) + codec.RegisterConcrete(&Process_Node_Map_Output_StringConst{}, "mesg.types.Process_Node_Map_Output_StringConst", nil) + codec.RegisterConcrete(&Process_Node_Map_Output_DoubleConst{}, "mesg.types.Process_Node_Map_Output_DoubleConst", nil) + codec.RegisterConcrete(&Process_Node_Map_Output_BoolConst{}, "mesg.types.Process_Node_Map_Output_BoolConst", nil) + codec.RegisterConcrete(&Process_Node_Map_Output_List_{}, "mesg.types.Process_Node_Map_Output_List_", nil) + codec.RegisterConcrete(&Process_Node_Map_Output_List{}, "mesg.types.Process_Node_Map_Output_List", nil) + codec.RegisterConcrete(&Process_Node_Map_Output_Map_{}, "mesg.types.Process_Node_Map_Output_Map_", nil) + codec.RegisterConcrete(&Process_Node_Map_Output_Map{}, "mesg.types.Process_Node_Map_Output_Map", nil) codec.RegisterInterface((*isProcess_Node_Type)(nil), nil) codec.RegisterConcrete(&Process_Node_Result_{}, "mesg.types.Process_Node_Result_", nil) codec.RegisterConcrete(&Process_Node_Result{}, "mesg.types.Process_Node_Result", nil) @@ -20,3 +29,37 @@ func init() { codec.RegisterConcrete(&Process_Node_Filter_{}, "mesg.types.Process_Node_Filter_", nil) codec.RegisterConcrete(&Process_Node_Filter{}, "mesg.types.Process_Node_Filter", nil) } + +// KeyOutput is a simple key/value representation of one output of a Process_Node_Map. +type KeyOutput struct { + Key string + Value *Process_Node_Map_Output +} + +// MarshalAmino transforms the Process_Node_Map to an array of key/value. +func (m Process_Node_Map) MarshalAmino() ([]KeyOutput, error) { + p := make([]KeyOutput, len(m.Outputs)) + outputKeys := make([]string, len(m.Outputs)) + i := 0 + for key := range m.Outputs { + outputKeys[i] = key + i++ + } + sort.Stable(sort.StringSlice(outputKeys)) + for i, key := range outputKeys { + p[i] = KeyOutput{ + Key: key, + Value: m.Outputs[key], + } + } + return p, nil +} + +// UnmarshalAmino transforms the key/value array to a Process_Node_Map. +func (m *Process_Node_Map) UnmarshalAmino(keyValues []KeyOutput) error { + m.Outputs = make(map[string]*Process_Node_Map_Output, len(keyValues)) + for _, p := range keyValues { + m.Outputs[p.Key] = p.Value + } + return nil +} diff --git a/process/process.pb.go b/process/process.pb.go index a9a2cdc57..df22b55b1 100644 --- a/process/process.pb.go +++ b/process/process.pb.go @@ -417,7 +417,7 @@ type Process_Node_Map_Output_StringConst struct { StringConst string `protobuf:"bytes,2,opt,name=string_const,json=stringConst,proto3,oneof" json:"string_const,omitempty" hash:"name:2"` } type Process_Node_Map_Output_DoubleConst struct { - DoubleConst float64 `protobuf:"fixed64,3,opt,name=double_const,json=doubleConst,proto3,oneof" json:"double_const,omitempty" hash:"name:3"` + DoubleConst float64 `protobuf:"fixed64,3,opt,name=double_const,json=doubleConst,proto3,oneof" json:"double_const,omitempty" hash:"name:3" amino:"unsafe"` } type Process_Node_Map_Output_BoolConst struct { BoolConst bool `protobuf:"varint,4,opt,name=bool_const,json=boolConst,proto3,oneof" json:"bool_const,omitempty" hash:"name:4"` @@ -732,70 +732,71 @@ func init() { func init() { proto.RegisterFile("process.proto", fileDescriptor_54c4d0e8c0aaf5c3) } var fileDescriptor_54c4d0e8c0aaf5c3 = []byte{ - // 1000 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x97, 0xc1, 0x6e, 0x1b, 0x45, - 0x18, 0xc7, 0xbd, 0xf6, 0xda, 0xae, 0x3f, 0xbb, 0x51, 0x18, 0xa9, 0x68, 0xb5, 0x2a, 0xb1, 0x31, - 0x82, 0xa6, 0x90, 0xac, 0x89, 0x9d, 0xb6, 0x34, 0x17, 0xc4, 0x46, 0xae, 0x0a, 0x75, 0x43, 0x6b, - 0x1a, 0x84, 0x7a, 0x09, 0xeb, 0xdd, 0xb1, 0xb3, 0xca, 0x66, 0xc6, 0xdd, 0x99, 0x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f, 0xae, 0x68, 0x4f, 0x6f, 0x5e, - 0x7c, 0x22, 0xc7, 0x9f, 0x38, 0xbd, 0x82, 0xfc, 0x66, 0x69, 0xfd, 0x1d, 0x00, 0x00, 0xff, 0xff, - 0x32, 0xeb, 0x3b, 0x5c, 0xf4, 0x0c, 0x00, 0x00, + // 1018 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x97, 0x4f, 0x6f, 0x1b, 0x45, + 0x18, 0xc6, 0xb3, 0xf1, 0xda, 0x8e, 0xdf, 0xb8, 0x51, 0x18, 0xa9, 0x68, 0x59, 0x95, 0xd8, 0x2c, + 0x82, 0xa6, 0x90, 0x6c, 0x88, 0x9d, 0xb6, 0xd4, 0x17, 0xc4, 0x46, 0xae, 0x0a, 0x75, 0x43, 0x6b, + 0x1a, 0x84, 0x7a, 0x09, 0xeb, 0xdd, 0xb1, 0xb3, 0xca, 0x7a, 0xc6, 0xdd, 0x99, 0x0d, 0x0d, 0xe2, + 0x82, 0x04, 0x12, 0x1f, 0x80, 0x4f, 0xc0, 0x89, 0x8f, 0xd2, 0x23, 0x82, 0x1b, 0x07, 0x4b, 0xe4, + 0x23, 0xf8, 0x13, 0xa0, 0x99, 0x59, 0xff, 0x49, 0x6c, 0x27, 0x9b, 0x02, 0x42, 0xe2, 0x96, 0x75, + 0xe6, 0xf9, 0xcd, 0xbe, 0xcf, 0xbc, 0xf3, 0xcc, 0x2c, 0x5c, 0xeb, 0x45, 0xd4, 0xc3, 0x8c, 0xd9, + 0xbd, 0x88, 0x72, 0x8a, 0xa0, 0x8b, 0x59, 0xc7, 0xe6, 0x27, 0x3d, 0xcc, 0x4c, 0xab, 0x43, 0x3b, + 0x74, 0x4b, 0xfe, 0xde, 0x8a, 0xdb, 0x5b, 0xe2, 0x49, 0x3e, 0xc8, 0xbf, 0xd4, 0x78, 0xeb, 0xfb, + 0x37, 0x20, 0xff, 0x58, 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, 0xce, + 0xe4, 0x55, 0xec, 0x7c, 0x4e, 0xcf, 0xb4, 0x7c, 0x63, 0x1c, 0xd8, 0xc9, 0xad, 0xec, 0x05, 0x14, + 0x7a, 0x11, 0xf6, 0x03, 0xcf, 0xe5, 0xca, 0x81, 0x95, 0x4a, 0x35, 0xf5, 0x2b, 0xdb, 0x8f, 0x87, + 0xd2, 0xb4, 0x8b, 0x36, 0x9e, 0x0c, 0xdd, 0x1c, 0xfa, 0x9e, 0x99, 0x99, 0x9f, 0x55, 0x2b, 0x71, + 0xd9, 0x2a, 0x43, 0x61, 0x34, 0x0f, 0x5a, 0x86, 0xfc, 0x3e, 0x39, 0x22, 0xf4, 0x6b, 0xb2, 0xba, + 0x80, 0x72, 0xb0, 0x58, 0x7f, 0xb2, 0xaa, 0x39, 0x39, 0xd0, 0xc5, 0xdb, 0x9a, 0x2f, 0x40, 0x17, + 0xf7, 0x5b, 0xd1, 0x4e, 0x2c, 0xf2, 0xae, 0x78, 0x47, 0x65, 0x91, 0x27, 0x84, 0xfe, 0x28, 0xd1, + 0xd3, 0xf6, 0xa1, 0xcf, 0xb8, 0x53, 0x7d, 0xf9, 0xe7, 0xda, 0xc2, 0x2f, 0xa7, 0x6b, 0xda, 0xb3, + 0x5b, 0x97, 0x1f, 0xd0, 0xc9, 0x17, 0x4f, 0x2b, 0x27, 0x3f, 0x61, 0xaa, 0x7f, 0x05, 0x00, 0x00, + 0xff, 0xff, 0x73, 0x7a, 0xfc, 0x27, 0x03, 0x0d, 0x00, 0x00, } func (this *Process) Equal(that interface{}) bool { diff --git a/protobuf/types/process.proto b/protobuf/types/process.proto index eaa631ab8..a7d533f7d 100644 --- a/protobuf/types/process.proto +++ b/protobuf/types/process.proto @@ -96,7 +96,7 @@ message Process { ]; double double_const = 3 [ - (gogoproto.moretags) = 'hash:"name:3"' + (gogoproto.moretags) = 'hash:"name:3" amino:"unsafe"' ]; bool bool_const = 4 [ From 68ea8c97a9f04764a2370ec7eda9bd5bfdc17d37 Mon Sep 17 00:00:00 2001 From: Nicolas Mahe Date: Wed, 11 Dec 2019 17:26:06 +0700 Subject: [PATCH 6/7] fix lint --- process/codec.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/process/codec.go b/process/codec.go index cbd8aff80..4fe29141b 100644 --- a/process/codec.go +++ b/process/codec.go @@ -1,8 +1,9 @@ package process import ( - "github.com/mesg-foundation/engine/codec" "sort" + + "github.com/mesg-foundation/engine/codec" ) func init() { From 6dd3f298c2e9511ea5d93c5cbb7a4a223e366a04 Mon Sep 17 00:00:00 2001 From: Nicolas Mahe Date: Wed, 11 Dec 2019 17:29:16 +0700 Subject: [PATCH 7/7] Add (Un)MarshalAmino function to Process_Node_Map_Output_Map to convert map to key value. --- process/codec.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/process/codec.go b/process/codec.go index 4fe29141b..b171b3eb8 100644 --- a/process/codec.go +++ b/process/codec.go @@ -64,3 +64,31 @@ func (m *Process_Node_Map) UnmarshalAmino(keyValues []KeyOutput) error { } return nil } + +// MarshalAmino transforms the Process_Node_Map_Output_Map to an array of key/value. +func (m Process_Node_Map_Output_Map) MarshalAmino() ([]KeyOutput, error) { + p := make([]KeyOutput, len(m.Outputs)) + outputKeys := make([]string, len(m.Outputs)) + i := 0 + for key := range m.Outputs { + outputKeys[i] = key + i++ + } + sort.Stable(sort.StringSlice(outputKeys)) + for i, key := range outputKeys { + p[i] = KeyOutput{ + Key: key, + Value: m.Outputs[key], + } + } + return p, nil +} + +// UnmarshalAmino transforms the key/value array to a Process_Node_Map_Output_Map. +func (m *Process_Node_Map_Output_Map) UnmarshalAmino(keyValues []KeyOutput) error { + m.Outputs = make(map[string]*Process_Node_Map_Output, len(keyValues)) + for _, p := range keyValues { + m.Outputs[p.Key] = p.Value + } + return nil +}