diff --git a/hash/hash.go b/hash/hash.go index 20fdd0529..a7e212770 100644 --- a/hash/hash.go +++ b/hash/hash.go @@ -75,6 +75,19 @@ func Random() (Hash, error) { return hash, nil } +// Decode decodes the base58 encoded hash. It returns error +// when a hash isn't base58,encoded or hash length is invalid. +func Decode(h string) (Hash, error) { + hash, err := base58.Decode(h) + if err != nil { + return nil, fmt.Errorf("hash: %s", err) + } + if len(hash) != size { + return nil, fmt.Errorf("hash: invalid length string") + } + return Hash(hash), nil +} + // IsZero reports whethere h represents empty hash. func (h Hash) IsZero() bool { return len(h) == 0 @@ -126,6 +139,10 @@ func (h *Hash) UnmarshalJSON(data []byte) error { return err } + if str == "" { + return nil + } + h1, err := base58.Decode(str) if err != nil { return err diff --git a/hash/hash_test.go b/hash/hash_test.go index 3b5b52f01..fba0c2e97 100644 --- a/hash/hash_test.go +++ b/hash/hash_test.go @@ -51,6 +51,18 @@ func TestRandom(t *testing.T) { require.NoError(t, quick.Check(f, nil)) } +func TestDecode(t *testing.T) { + hash, err := Decode("4uQeVj5tqViQh7yWWGStvkEG1Zmhx6uasJtWCJziofM") + assert.NoError(t, err) + assert.Equal(t, hash, one) + + _, err = Decode("0") + assert.Equal(t, "hash: invalid base58 digit ('0')", err.Error()) + + _, err = Decode("1") + assert.Equal(t, "hash: invalid length string", err.Error()) +} + func TestIsZero(t *testing.T) { assert.True(t, Hash{}.IsZero()) } diff --git a/protobuf/types/workflow.pb.go b/protobuf/types/workflow.pb.go index 2afe78820..d5cacca56 100644 --- a/protobuf/types/workflow.pb.go +++ b/protobuf/types/workflow.pb.go @@ -20,42 +20,15 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package -// Type of condition available to compare the values. -type Workflow_Trigger_Filter_Predicate int32 - -const ( - Workflow_Trigger_Filter_Unknown Workflow_Trigger_Filter_Predicate = 0 - Workflow_Trigger_Filter_EQ Workflow_Trigger_Filter_Predicate = 1 -) - -var Workflow_Trigger_Filter_Predicate_name = map[int32]string{ - 0: "Unknown", - 1: "EQ", -} - -var Workflow_Trigger_Filter_Predicate_value = map[string]int32{ - "Unknown": 0, - "EQ": 1, -} - -func (x Workflow_Trigger_Filter_Predicate) String() string { - return proto.EnumName(Workflow_Trigger_Filter_Predicate_name, int32(x)) -} - -func (Workflow_Trigger_Filter_Predicate) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_980f671c228050a1, []int{0, 0, 0, 0} -} - // A workflow is a configuration to trigger a specific task when certains conditions of a trigger are valid. type Workflow struct { - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Trigger *Workflow_Trigger `protobuf:"bytes,3,opt,name=trigger,proto3" json:"trigger,omitempty"` - Nodes []*Workflow_Node `protobuf:"bytes,4,rep,name=nodes,proto3" json:"nodes,omitempty"` - Edges []*Workflow_Edge `protobuf:"bytes,5,rep,name=edges,proto3" json:"edges,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Nodes []*Workflow_Node `protobuf:"bytes,4,rep,name=nodes,proto3" json:"nodes,omitempty"` + Edges []*Workflow_Edge `protobuf:"bytes,5,rep,name=edges,proto3" json:"edges,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Workflow) Reset() { *m = Workflow{} } @@ -97,13 +70,6 @@ func (m *Workflow) GetKey() string { return "" } -func (m *Workflow) GetTrigger() *Workflow_Trigger { - if m != nil { - return m.Trigger - } - return nil -} - func (m *Workflow) GetNodes() []*Workflow_Node { if m != nil { return m.Nodes @@ -118,354 +84,403 @@ func (m *Workflow) GetEdges() []*Workflow_Edge { return nil } -// Trigger is the configuration that will trigger a workflow. -type Workflow_Trigger struct { - InstanceHash []byte `protobuf:"bytes,1,opt,name=instanceHash,proto3" json:"instanceHash,omitempty"` - // Workflow can be trigger by either an Event or a Task (not both). - // - // Types that are valid to be assigned to Key: - // *Workflow_Trigger_TaskKey - // *Workflow_Trigger_EventKey - Key isWorkflow_Trigger_Key `protobuf_oneof:"key"` - Filters []*Workflow_Trigger_Filter `protobuf:"bytes,4,rep,name=filters,proto3" json:"filters,omitempty"` - NodeKey string `protobuf:"bytes,5,opt,name=nodeKey,proto3" json:"nodeKey,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Workflow_Trigger) Reset() { *m = Workflow_Trigger{} } -func (m *Workflow_Trigger) String() string { return proto.CompactTextString(m) } -func (*Workflow_Trigger) ProtoMessage() {} -func (*Workflow_Trigger) Descriptor() ([]byte, []int) { +// Node of the workflow +type Workflow_Node struct { + // Types that are valid to be assigned to Type: + // *Workflow_Node_Result_ + // *Workflow_Node_Event_ + // *Workflow_Node_Task_ + // *Workflow_Node_Map_ + Type isWorkflow_Node_Type `protobuf_oneof:"type"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Workflow_Node) Reset() { *m = Workflow_Node{} } +func (m *Workflow_Node) String() string { return proto.CompactTextString(m) } +func (*Workflow_Node) ProtoMessage() {} +func (*Workflow_Node) Descriptor() ([]byte, []int) { return fileDescriptor_980f671c228050a1, []int{0, 0} } -func (m *Workflow_Trigger) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Workflow_Trigger.Unmarshal(m, b) +func (m *Workflow_Node) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Workflow_Node.Unmarshal(m, b) } -func (m *Workflow_Trigger) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Workflow_Trigger.Marshal(b, m, deterministic) +func (m *Workflow_Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Workflow_Node.Marshal(b, m, deterministic) } -func (m *Workflow_Trigger) XXX_Merge(src proto.Message) { - xxx_messageInfo_Workflow_Trigger.Merge(m, src) +func (m *Workflow_Node) XXX_Merge(src proto.Message) { + xxx_messageInfo_Workflow_Node.Merge(m, src) } -func (m *Workflow_Trigger) XXX_Size() int { - return xxx_messageInfo_Workflow_Trigger.Size(m) +func (m *Workflow_Node) XXX_Size() int { + return xxx_messageInfo_Workflow_Node.Size(m) } -func (m *Workflow_Trigger) XXX_DiscardUnknown() { - xxx_messageInfo_Workflow_Trigger.DiscardUnknown(m) +func (m *Workflow_Node) XXX_DiscardUnknown() { + xxx_messageInfo_Workflow_Node.DiscardUnknown(m) } -var xxx_messageInfo_Workflow_Trigger proto.InternalMessageInfo +var xxx_messageInfo_Workflow_Node proto.InternalMessageInfo -func (m *Workflow_Trigger) GetInstanceHash() []byte { - if m != nil { - return m.InstanceHash - } - return nil +type isWorkflow_Node_Type interface { + isWorkflow_Node_Type() } -type isWorkflow_Trigger_Key interface { - isWorkflow_Trigger_Key() +type Workflow_Node_Result_ struct { + Result *Workflow_Node_Result `protobuf:"bytes,1,opt,name=result,proto3,oneof"` } -type Workflow_Trigger_TaskKey struct { - TaskKey string `protobuf:"bytes,2,opt,name=taskKey,proto3,oneof"` +type Workflow_Node_Event_ struct { + Event *Workflow_Node_Event `protobuf:"bytes,2,opt,name=event,proto3,oneof"` } -type Workflow_Trigger_EventKey struct { - EventKey string `protobuf:"bytes,3,opt,name=eventKey,proto3,oneof"` +type Workflow_Node_Task_ struct { + Task *Workflow_Node_Task `protobuf:"bytes,3,opt,name=task,proto3,oneof"` } -func (*Workflow_Trigger_TaskKey) isWorkflow_Trigger_Key() {} +type Workflow_Node_Map_ struct { + Map *Workflow_Node_Map `protobuf:"bytes,4,opt,name=map,proto3,oneof"` +} + +func (*Workflow_Node_Result_) isWorkflow_Node_Type() {} + +func (*Workflow_Node_Event_) isWorkflow_Node_Type() {} -func (*Workflow_Trigger_EventKey) isWorkflow_Trigger_Key() {} +func (*Workflow_Node_Task_) isWorkflow_Node_Type() {} -func (m *Workflow_Trigger) GetKey() isWorkflow_Trigger_Key { +func (*Workflow_Node_Map_) isWorkflow_Node_Type() {} + +func (m *Workflow_Node) GetType() isWorkflow_Node_Type { if m != nil { - return m.Key + return m.Type } return nil } -func (m *Workflow_Trigger) GetTaskKey() string { - if x, ok := m.GetKey().(*Workflow_Trigger_TaskKey); ok { - return x.TaskKey +func (m *Workflow_Node) GetResult() *Workflow_Node_Result { + if x, ok := m.GetType().(*Workflow_Node_Result_); ok { + return x.Result } - return "" + return nil } -func (m *Workflow_Trigger) GetEventKey() string { - if x, ok := m.GetKey().(*Workflow_Trigger_EventKey); ok { - return x.EventKey +func (m *Workflow_Node) GetEvent() *Workflow_Node_Event { + if x, ok := m.GetType().(*Workflow_Node_Event_); ok { + return x.Event } - return "" + return nil } -func (m *Workflow_Trigger) GetFilters() []*Workflow_Trigger_Filter { - if m != nil { - return m.Filters +func (m *Workflow_Node) GetTask() *Workflow_Node_Task { + if x, ok := m.GetType().(*Workflow_Node_Task_); ok { + return x.Task } return nil } -func (m *Workflow_Trigger) GetNodeKey() string { - if m != nil { - return m.NodeKey +func (m *Workflow_Node) GetMap() *Workflow_Node_Map { + if x, ok := m.GetType().(*Workflow_Node_Map_); ok { + return x.Map } - return "" + return nil } // XXX_OneofWrappers is for the internal use of the proto package. -func (*Workflow_Trigger) XXX_OneofWrappers() []interface{} { +func (*Workflow_Node) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*Workflow_Trigger_TaskKey)(nil), - (*Workflow_Trigger_EventKey)(nil), + (*Workflow_Node_Result_)(nil), + (*Workflow_Node_Event_)(nil), + (*Workflow_Node_Task_)(nil), + (*Workflow_Node_Map_)(nil), } } -// Filter is applied on the data of the event/result. -type Workflow_Trigger_Filter struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Predicate Workflow_Trigger_Filter_Predicate `protobuf:"varint,2,opt,name=predicate,proto3,enum=types.Workflow_Trigger_Filter_Predicate" json:"predicate,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type Workflow_Node_Result struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + InstanceHash []byte `protobuf:"bytes,2,opt,name=instanceHash,proto3" json:"instanceHash,omitempty"` + TaskKey string `protobuf:"bytes,3,opt,name=taskKey,proto3" json:"taskKey,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Workflow_Trigger_Filter) Reset() { *m = Workflow_Trigger_Filter{} } -func (m *Workflow_Trigger_Filter) String() string { return proto.CompactTextString(m) } -func (*Workflow_Trigger_Filter) ProtoMessage() {} -func (*Workflow_Trigger_Filter) Descriptor() ([]byte, []int) { +func (m *Workflow_Node_Result) Reset() { *m = Workflow_Node_Result{} } +func (m *Workflow_Node_Result) String() string { return proto.CompactTextString(m) } +func (*Workflow_Node_Result) ProtoMessage() {} +func (*Workflow_Node_Result) Descriptor() ([]byte, []int) { return fileDescriptor_980f671c228050a1, []int{0, 0, 0} } -func (m *Workflow_Trigger_Filter) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Workflow_Trigger_Filter.Unmarshal(m, b) +func (m *Workflow_Node_Result) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Workflow_Node_Result.Unmarshal(m, b) } -func (m *Workflow_Trigger_Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Workflow_Trigger_Filter.Marshal(b, m, deterministic) +func (m *Workflow_Node_Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Workflow_Node_Result.Marshal(b, m, deterministic) } -func (m *Workflow_Trigger_Filter) XXX_Merge(src proto.Message) { - xxx_messageInfo_Workflow_Trigger_Filter.Merge(m, src) +func (m *Workflow_Node_Result) XXX_Merge(src proto.Message) { + xxx_messageInfo_Workflow_Node_Result.Merge(m, src) } -func (m *Workflow_Trigger_Filter) XXX_Size() int { - return xxx_messageInfo_Workflow_Trigger_Filter.Size(m) +func (m *Workflow_Node_Result) XXX_Size() int { + return xxx_messageInfo_Workflow_Node_Result.Size(m) } -func (m *Workflow_Trigger_Filter) XXX_DiscardUnknown() { - xxx_messageInfo_Workflow_Trigger_Filter.DiscardUnknown(m) +func (m *Workflow_Node_Result) XXX_DiscardUnknown() { + xxx_messageInfo_Workflow_Node_Result.DiscardUnknown(m) } -var xxx_messageInfo_Workflow_Trigger_Filter proto.InternalMessageInfo +var xxx_messageInfo_Workflow_Node_Result proto.InternalMessageInfo -func (m *Workflow_Trigger_Filter) GetKey() string { +func (m *Workflow_Node_Result) GetKey() string { if m != nil { return m.Key } return "" } -func (m *Workflow_Trigger_Filter) GetPredicate() Workflow_Trigger_Filter_Predicate { +func (m *Workflow_Node_Result) GetInstanceHash() []byte { if m != nil { - return m.Predicate + return m.InstanceHash } - return Workflow_Trigger_Filter_Unknown + return nil } -func (m *Workflow_Trigger_Filter) GetValue() string { +func (m *Workflow_Node_Result) GetTaskKey() string { if m != nil { - return m.Value + return m.TaskKey } return "" } -// Definition of the node to execute when the workflow is triggered. -type Workflow_Node struct { +type Workflow_Node_Event struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` InstanceHash []byte `protobuf:"bytes,2,opt,name=instanceHash,proto3" json:"instanceHash,omitempty"` - TaskKey string `protobuf:"bytes,3,opt,name=taskKey,proto3" json:"taskKey,omitempty"` + EventKey string `protobuf:"bytes,3,opt,name=eventKey,proto3" json:"eventKey,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *Workflow_Node) Reset() { *m = Workflow_Node{} } -func (m *Workflow_Node) String() string { return proto.CompactTextString(m) } -func (*Workflow_Node) ProtoMessage() {} -func (*Workflow_Node) Descriptor() ([]byte, []int) { - return fileDescriptor_980f671c228050a1, []int{0, 1} +func (m *Workflow_Node_Event) Reset() { *m = Workflow_Node_Event{} } +func (m *Workflow_Node_Event) String() string { return proto.CompactTextString(m) } +func (*Workflow_Node_Event) ProtoMessage() {} +func (*Workflow_Node_Event) Descriptor() ([]byte, []int) { + return fileDescriptor_980f671c228050a1, []int{0, 0, 1} } -func (m *Workflow_Node) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Workflow_Node.Unmarshal(m, b) +func (m *Workflow_Node_Event) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Workflow_Node_Event.Unmarshal(m, b) } -func (m *Workflow_Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Workflow_Node.Marshal(b, m, deterministic) +func (m *Workflow_Node_Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Workflow_Node_Event.Marshal(b, m, deterministic) } -func (m *Workflow_Node) XXX_Merge(src proto.Message) { - xxx_messageInfo_Workflow_Node.Merge(m, src) +func (m *Workflow_Node_Event) XXX_Merge(src proto.Message) { + xxx_messageInfo_Workflow_Node_Event.Merge(m, src) } -func (m *Workflow_Node) XXX_Size() int { - return xxx_messageInfo_Workflow_Node.Size(m) +func (m *Workflow_Node_Event) XXX_Size() int { + return xxx_messageInfo_Workflow_Node_Event.Size(m) } -func (m *Workflow_Node) XXX_DiscardUnknown() { - xxx_messageInfo_Workflow_Node.DiscardUnknown(m) +func (m *Workflow_Node_Event) XXX_DiscardUnknown() { + xxx_messageInfo_Workflow_Node_Event.DiscardUnknown(m) } -var xxx_messageInfo_Workflow_Node proto.InternalMessageInfo +var xxx_messageInfo_Workflow_Node_Event proto.InternalMessageInfo -func (m *Workflow_Node) GetKey() string { +func (m *Workflow_Node_Event) GetKey() string { if m != nil { return m.Key } return "" } -func (m *Workflow_Node) GetInstanceHash() []byte { +func (m *Workflow_Node_Event) GetInstanceHash() []byte { if m != nil { return m.InstanceHash } return nil } -func (m *Workflow_Node) GetTaskKey() string { +func (m *Workflow_Node_Event) GetEventKey() string { if m != nil { - return m.TaskKey + return m.EventKey } return "" } -type Workflow_Edge struct { - Src string `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"` - Dst string `protobuf:"bytes,2,opt,name=dst,proto3" json:"dst,omitempty"` - Inputs []*Workflow_Edge_Input `protobuf:"bytes,3,rep,name=inputs,proto3" json:"inputs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` +type Workflow_Node_Task struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + InstanceHash []byte `protobuf:"bytes,2,opt,name=instanceHash,proto3" json:"instanceHash,omitempty"` + TaskKey string `protobuf:"bytes,3,opt,name=taskKey,proto3" json:"taskKey,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Workflow_Edge) Reset() { *m = Workflow_Edge{} } -func (m *Workflow_Edge) String() string { return proto.CompactTextString(m) } -func (*Workflow_Edge) ProtoMessage() {} -func (*Workflow_Edge) Descriptor() ([]byte, []int) { - return fileDescriptor_980f671c228050a1, []int{0, 2} +func (m *Workflow_Node_Task) Reset() { *m = Workflow_Node_Task{} } +func (m *Workflow_Node_Task) String() string { return proto.CompactTextString(m) } +func (*Workflow_Node_Task) ProtoMessage() {} +func (*Workflow_Node_Task) Descriptor() ([]byte, []int) { + return fileDescriptor_980f671c228050a1, []int{0, 0, 2} } -func (m *Workflow_Edge) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Workflow_Edge.Unmarshal(m, b) +func (m *Workflow_Node_Task) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Workflow_Node_Task.Unmarshal(m, b) } -func (m *Workflow_Edge) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Workflow_Edge.Marshal(b, m, deterministic) +func (m *Workflow_Node_Task) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Workflow_Node_Task.Marshal(b, m, deterministic) } -func (m *Workflow_Edge) XXX_Merge(src proto.Message) { - xxx_messageInfo_Workflow_Edge.Merge(m, src) +func (m *Workflow_Node_Task) XXX_Merge(src proto.Message) { + xxx_messageInfo_Workflow_Node_Task.Merge(m, src) } -func (m *Workflow_Edge) XXX_Size() int { - return xxx_messageInfo_Workflow_Edge.Size(m) +func (m *Workflow_Node_Task) XXX_Size() int { + return xxx_messageInfo_Workflow_Node_Task.Size(m) } -func (m *Workflow_Edge) XXX_DiscardUnknown() { - xxx_messageInfo_Workflow_Edge.DiscardUnknown(m) +func (m *Workflow_Node_Task) XXX_DiscardUnknown() { + xxx_messageInfo_Workflow_Node_Task.DiscardUnknown(m) } -var xxx_messageInfo_Workflow_Edge proto.InternalMessageInfo +var xxx_messageInfo_Workflow_Node_Task proto.InternalMessageInfo -func (m *Workflow_Edge) GetSrc() string { +func (m *Workflow_Node_Task) GetKey() string { if m != nil { - return m.Src + return m.Key } return "" } -func (m *Workflow_Edge) GetDst() string { +func (m *Workflow_Node_Task) GetInstanceHash() []byte { if m != nil { - return m.Dst + return m.InstanceHash + } + return nil +} + +func (m *Workflow_Node_Task) GetTaskKey() string { + if m != nil { + return m.TaskKey } return "" } -func (m *Workflow_Edge) GetInputs() []*Workflow_Edge_Input { +type Workflow_Node_Map struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Outputs []*Workflow_Node_Map_Output `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Workflow_Node_Map) Reset() { *m = Workflow_Node_Map{} } +func (m *Workflow_Node_Map) String() string { return proto.CompactTextString(m) } +func (*Workflow_Node_Map) ProtoMessage() {} +func (*Workflow_Node_Map) Descriptor() ([]byte, []int) { + return fileDescriptor_980f671c228050a1, []int{0, 0, 3} +} + +func (m *Workflow_Node_Map) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Workflow_Node_Map.Unmarshal(m, b) +} +func (m *Workflow_Node_Map) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Workflow_Node_Map.Marshal(b, m, deterministic) +} +func (m *Workflow_Node_Map) XXX_Merge(src proto.Message) { + xxx_messageInfo_Workflow_Node_Map.Merge(m, src) +} +func (m *Workflow_Node_Map) XXX_Size() int { + return xxx_messageInfo_Workflow_Node_Map.Size(m) +} +func (m *Workflow_Node_Map) XXX_DiscardUnknown() { + xxx_messageInfo_Workflow_Node_Map.DiscardUnknown(m) +} + +var xxx_messageInfo_Workflow_Node_Map proto.InternalMessageInfo + +func (m *Workflow_Node_Map) GetKey() string { if m != nil { - return m.Inputs + return m.Key + } + return "" +} + +func (m *Workflow_Node_Map) GetOutputs() []*Workflow_Node_Map_Output { + if m != nil { + return m.Outputs } return nil } -type Workflow_Edge_Input struct { +type Workflow_Node_Map_Output struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // Types that are valid to be assigned to Value: - // *Workflow_Edge_Input_Ref - Value isWorkflow_Edge_Input_Value `protobuf_oneof:"value"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // *Workflow_Node_Map_Output_Ref + Value isWorkflow_Node_Map_Output_Value `protobuf_oneof:"value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Workflow_Edge_Input) Reset() { *m = Workflow_Edge_Input{} } -func (m *Workflow_Edge_Input) String() string { return proto.CompactTextString(m) } -func (*Workflow_Edge_Input) ProtoMessage() {} -func (*Workflow_Edge_Input) Descriptor() ([]byte, []int) { - return fileDescriptor_980f671c228050a1, []int{0, 2, 0} +func (m *Workflow_Node_Map_Output) Reset() { *m = Workflow_Node_Map_Output{} } +func (m *Workflow_Node_Map_Output) String() string { return proto.CompactTextString(m) } +func (*Workflow_Node_Map_Output) ProtoMessage() {} +func (*Workflow_Node_Map_Output) Descriptor() ([]byte, []int) { + return fileDescriptor_980f671c228050a1, []int{0, 0, 3, 0} } -func (m *Workflow_Edge_Input) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Workflow_Edge_Input.Unmarshal(m, b) +func (m *Workflow_Node_Map_Output) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Workflow_Node_Map_Output.Unmarshal(m, b) } -func (m *Workflow_Edge_Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Workflow_Edge_Input.Marshal(b, m, deterministic) +func (m *Workflow_Node_Map_Output) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Workflow_Node_Map_Output.Marshal(b, m, deterministic) } -func (m *Workflow_Edge_Input) XXX_Merge(src proto.Message) { - xxx_messageInfo_Workflow_Edge_Input.Merge(m, src) +func (m *Workflow_Node_Map_Output) XXX_Merge(src proto.Message) { + xxx_messageInfo_Workflow_Node_Map_Output.Merge(m, src) } -func (m *Workflow_Edge_Input) XXX_Size() int { - return xxx_messageInfo_Workflow_Edge_Input.Size(m) +func (m *Workflow_Node_Map_Output) XXX_Size() int { + return xxx_messageInfo_Workflow_Node_Map_Output.Size(m) } -func (m *Workflow_Edge_Input) XXX_DiscardUnknown() { - xxx_messageInfo_Workflow_Edge_Input.DiscardUnknown(m) +func (m *Workflow_Node_Map_Output) XXX_DiscardUnknown() { + xxx_messageInfo_Workflow_Node_Map_Output.DiscardUnknown(m) } -var xxx_messageInfo_Workflow_Edge_Input proto.InternalMessageInfo +var xxx_messageInfo_Workflow_Node_Map_Output proto.InternalMessageInfo -func (m *Workflow_Edge_Input) GetKey() string { +func (m *Workflow_Node_Map_Output) GetKey() string { if m != nil { return m.Key } return "" } -type isWorkflow_Edge_Input_Value interface { - isWorkflow_Edge_Input_Value() +type isWorkflow_Node_Map_Output_Value interface { + isWorkflow_Node_Map_Output_Value() } -type Workflow_Edge_Input_Ref struct { - Ref *Workflow_Edge_Input_Reference `protobuf:"bytes,2,opt,name=ref,proto3,oneof"` +type Workflow_Node_Map_Output_Ref struct { + Ref *Workflow_Node_Map_Output_Reference `protobuf:"bytes,2,opt,name=ref,proto3,oneof"` } -func (*Workflow_Edge_Input_Ref) isWorkflow_Edge_Input_Value() {} +func (*Workflow_Node_Map_Output_Ref) isWorkflow_Node_Map_Output_Value() {} -func (m *Workflow_Edge_Input) GetValue() isWorkflow_Edge_Input_Value { +func (m *Workflow_Node_Map_Output) GetValue() isWorkflow_Node_Map_Output_Value { if m != nil { return m.Value } return nil } -func (m *Workflow_Edge_Input) GetRef() *Workflow_Edge_Input_Reference { - if x, ok := m.GetValue().(*Workflow_Edge_Input_Ref); ok { +func (m *Workflow_Node_Map_Output) GetRef() *Workflow_Node_Map_Output_Reference { + if x, ok := m.GetValue().(*Workflow_Node_Map_Output_Ref); ok { return x.Ref } return nil } // XXX_OneofWrappers is for the internal use of the proto package. -func (*Workflow_Edge_Input) XXX_OneofWrappers() []interface{} { +func (*Workflow_Node_Map_Output) XXX_OneofWrappers() []interface{} { return []interface{}{ - (*Workflow_Edge_Input_Ref)(nil), + (*Workflow_Node_Map_Output_Ref)(nil), } } -type Workflow_Edge_Input_Reference struct { +type Workflow_Node_Map_Output_Reference struct { NodeKey string `protobuf:"bytes,1,opt,name=nodeKey,proto3" json:"nodeKey,omitempty"` Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -473,89 +488,136 @@ type Workflow_Edge_Input_Reference struct { XXX_sizecache int32 `json:"-"` } -func (m *Workflow_Edge_Input_Reference) Reset() { *m = Workflow_Edge_Input_Reference{} } -func (m *Workflow_Edge_Input_Reference) String() string { return proto.CompactTextString(m) } -func (*Workflow_Edge_Input_Reference) ProtoMessage() {} -func (*Workflow_Edge_Input_Reference) Descriptor() ([]byte, []int) { - return fileDescriptor_980f671c228050a1, []int{0, 2, 0, 0} +func (m *Workflow_Node_Map_Output_Reference) Reset() { *m = Workflow_Node_Map_Output_Reference{} } +func (m *Workflow_Node_Map_Output_Reference) String() string { return proto.CompactTextString(m) } +func (*Workflow_Node_Map_Output_Reference) ProtoMessage() {} +func (*Workflow_Node_Map_Output_Reference) Descriptor() ([]byte, []int) { + return fileDescriptor_980f671c228050a1, []int{0, 0, 3, 0, 0} } -func (m *Workflow_Edge_Input_Reference) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Workflow_Edge_Input_Reference.Unmarshal(m, b) +func (m *Workflow_Node_Map_Output_Reference) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Workflow_Node_Map_Output_Reference.Unmarshal(m, b) } -func (m *Workflow_Edge_Input_Reference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Workflow_Edge_Input_Reference.Marshal(b, m, deterministic) +func (m *Workflow_Node_Map_Output_Reference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Workflow_Node_Map_Output_Reference.Marshal(b, m, deterministic) } -func (m *Workflow_Edge_Input_Reference) XXX_Merge(src proto.Message) { - xxx_messageInfo_Workflow_Edge_Input_Reference.Merge(m, src) +func (m *Workflow_Node_Map_Output_Reference) XXX_Merge(src proto.Message) { + xxx_messageInfo_Workflow_Node_Map_Output_Reference.Merge(m, src) } -func (m *Workflow_Edge_Input_Reference) XXX_Size() int { - return xxx_messageInfo_Workflow_Edge_Input_Reference.Size(m) +func (m *Workflow_Node_Map_Output_Reference) XXX_Size() int { + return xxx_messageInfo_Workflow_Node_Map_Output_Reference.Size(m) } -func (m *Workflow_Edge_Input_Reference) XXX_DiscardUnknown() { - xxx_messageInfo_Workflow_Edge_Input_Reference.DiscardUnknown(m) +func (m *Workflow_Node_Map_Output_Reference) XXX_DiscardUnknown() { + xxx_messageInfo_Workflow_Node_Map_Output_Reference.DiscardUnknown(m) } -var xxx_messageInfo_Workflow_Edge_Input_Reference proto.InternalMessageInfo +var xxx_messageInfo_Workflow_Node_Map_Output_Reference proto.InternalMessageInfo -func (m *Workflow_Edge_Input_Reference) GetNodeKey() string { +func (m *Workflow_Node_Map_Output_Reference) GetNodeKey() string { if m != nil { return m.NodeKey } return "" } -func (m *Workflow_Edge_Input_Reference) GetKey() string { +func (m *Workflow_Node_Map_Output_Reference) GetKey() string { if m != nil { return m.Key } return "" } +type Workflow_Edge struct { + Src string `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"` + Dst string `protobuf:"bytes,2,opt,name=dst,proto3" json:"dst,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Workflow_Edge) Reset() { *m = Workflow_Edge{} } +func (m *Workflow_Edge) String() string { return proto.CompactTextString(m) } +func (*Workflow_Edge) ProtoMessage() {} +func (*Workflow_Edge) Descriptor() ([]byte, []int) { + return fileDescriptor_980f671c228050a1, []int{0, 1} +} + +func (m *Workflow_Edge) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Workflow_Edge.Unmarshal(m, b) +} +func (m *Workflow_Edge) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Workflow_Edge.Marshal(b, m, deterministic) +} +func (m *Workflow_Edge) XXX_Merge(src proto.Message) { + xxx_messageInfo_Workflow_Edge.Merge(m, src) +} +func (m *Workflow_Edge) XXX_Size() int { + return xxx_messageInfo_Workflow_Edge.Size(m) +} +func (m *Workflow_Edge) XXX_DiscardUnknown() { + xxx_messageInfo_Workflow_Edge.DiscardUnknown(m) +} + +var xxx_messageInfo_Workflow_Edge proto.InternalMessageInfo + +func (m *Workflow_Edge) GetSrc() string { + if m != nil { + return m.Src + } + return "" +} + +func (m *Workflow_Edge) GetDst() string { + if m != nil { + return m.Dst + } + return "" +} + func init() { - proto.RegisterEnum("types.Workflow_Trigger_Filter_Predicate", Workflow_Trigger_Filter_Predicate_name, Workflow_Trigger_Filter_Predicate_value) proto.RegisterType((*Workflow)(nil), "types.Workflow") - proto.RegisterType((*Workflow_Trigger)(nil), "types.Workflow.Trigger") - proto.RegisterType((*Workflow_Trigger_Filter)(nil), "types.Workflow.Trigger.Filter") proto.RegisterType((*Workflow_Node)(nil), "types.Workflow.Node") + proto.RegisterType((*Workflow_Node_Result)(nil), "types.Workflow.Node.Result") + proto.RegisterType((*Workflow_Node_Event)(nil), "types.Workflow.Node.Event") + proto.RegisterType((*Workflow_Node_Task)(nil), "types.Workflow.Node.Task") + proto.RegisterType((*Workflow_Node_Map)(nil), "types.Workflow.Node.Map") + proto.RegisterType((*Workflow_Node_Map_Output)(nil), "types.Workflow.Node.Map.Output") + proto.RegisterType((*Workflow_Node_Map_Output_Reference)(nil), "types.Workflow.Node.Map.Output.Reference") proto.RegisterType((*Workflow_Edge)(nil), "types.Workflow.Edge") - proto.RegisterType((*Workflow_Edge_Input)(nil), "types.Workflow.Edge.Input") - proto.RegisterType((*Workflow_Edge_Input_Reference)(nil), "types.Workflow.Edge.Input.Reference") } func init() { proto.RegisterFile("protobuf/types/workflow.proto", fileDescriptor_980f671c228050a1) } var fileDescriptor_980f671c228050a1 = []byte{ - // 487 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x4d, 0x8b, 0xdb, 0x30, - 0x10, 0x8d, 0xe2, 0x38, 0xde, 0x4c, 0x96, 0x12, 0xc4, 0x42, 0x8d, 0x69, 0x4b, 0x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7e, 0x10, 0xf0, 0x2d, 0xd2, 0x32, 0xfa, - 0x39, 0x78, 0x12, 0x73, 0xdb, 0x61, 0x98, 0x3c, 0xbf, 0xbf, 0x58, 0xcc, 0x30, 0x47, 0x89, 0x46, - 0x4d, 0x87, 0x99, 0x2b, 0xd1, 0x5b, 0x18, 0xec, 0xb1, 0x7f, 0x37, 0x4b, 0x8e, 0x36, 0xfb, 0xff, - 0xa7, 0x99, 0x07, 0xcd, 0x1a, 0xe6, 0xc9, 0xf7, 0x57, 0x45, 0xa9, 0x57, 0xd5, 0x22, 0x5e, 0x8a, - 0xeb, 0xd9, 0x35, 0xaa, 0xe2, 0x65, 0x2e, 0x2a, 0x9e, 0xa5, 0xba, 0x14, 0x7c, 0x86, 0xbc, 0x28, - 0x39, 0xce, 0x8e, 0xbf, 0xee, 0xa2, 0x6f, 0xe3, 0x37, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x36, - 0xd7, 0x3a, 0x33, 0xd3, 0x03, 0x00, 0x00, + // 465 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0xdd, 0x8a, 0xd3, 0x40, + 0x14, 0xc7, 0x93, 0xe6, 0xa3, 0xdb, 0xd3, 0xbd, 0x90, 0xc1, 0x8b, 0x71, 0x44, 0x2c, 0x7b, 0x55, + 0x17, 0x4d, 0x24, 0x22, 0xe2, 0x85, 0x37, 0x85, 0x85, 0xc0, 0xb2, 0x0a, 0x83, 0xf8, 0x75, 0x37, + 0x6d, 0x4e, 0xd2, 0x92, 0x36, 0x13, 0x32, 0x93, 0x5d, 0xfa, 0x14, 0x3e, 0x80, 0x2f, 0xe6, 0x63, + 0xf8, 0x08, 0x32, 0x93, 0xa6, 0xcb, 0x62, 0x44, 0x90, 0xbd, 0xcb, 0x39, 0xf9, 0x9d, 0xff, 0x39, + 0xe7, 0xcf, 0x19, 0x78, 0x52, 0x37, 0x52, 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0xfa, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x34, 0x42, 0x10, 0xf4, 0x03, 0x00, + 0x00, } diff --git a/protobuf/types/workflow.proto b/protobuf/types/workflow.proto index 440903cc0..7e6440652 100644 --- a/protobuf/types/workflow.proto +++ b/protobuf/types/workflow.proto @@ -5,60 +5,56 @@ option go_package = "github.com/mesg-foundation/engine/protobuf/types"; // A workflow is a configuration to trigger a specific task when certains conditions of a trigger are valid. message Workflow { + // Node of the workflow + message Node { + message Result { + string key = 1; // Key that identifies the node. + bytes instanceHash = 2; // Hash of the instance that triggers the workflow. + string taskKey = 3; // Key of the task that triggers the workflow. + } - // Trigger is the configuration that will trigger a workflow. - message Trigger { - // Filter is applied on the data of the event/result. - message Filter { - - // Type of condition available to compare the values. - enum Predicate { - Unknown = 0; // Predicate not defined. - EQ = 1; // Equal - } - - string key = 1; // Key to check. - Predicate predicate = 2; // Type of condition to apply. - string value = 3; // Value of the filter + message Event { + string key = 1; // Key that identifies the node. + bytes instanceHash = 2; // Hash of the instance that triggers the workflow. + string eventKey = 3; // Key of the event that triggers the workflow. } - bytes instanceHash = 1; // Hash of the instance that triggers the workflow. - // Workflow can be trigger by either an Event or a Task (not both). - oneof key { - string taskKey = 2; // Key of the task that triggers the workflow. - string eventKey = 3; // Key of the event that triggers the workflow. + message Task { + string key = 1; // Key that identifies the node. + bytes instanceHash = 2; // Hash of the instance to execute. + string taskKey = 3; // Task of the instance to execute. } - repeated Filter filters = 4; // List of filters to apply on the data of the event/result. - string nodeKey = 5; // First node to trigger when the workflow starts. - } - // Definition of the node to execute when the workflow is triggered. - message Node { - string key = 1; // Key that identifies the node. - bytes instanceHash = 2; // Hash of the instance to execute. - string taskKey = 3; // Task of the instance to execute. + message Map { + message Output { + message Reference { + string nodeKey = 1; // Key of the node in the graph. If empty, will be using the src of the edge. + string key = 2; // Key of a specific parameter of the referenced node's output data. + } + + string key = 1; // Key of the output. + oneof value { + Reference ref = 2; // Input defined as reference. + } + } + string key = 1; // Key of the mapping. + repeated Output outputs = 2; // Outputs of the mapping. + } + oneof type { + Result result = 1; // Result is a trigger that listens for a specific result. + Event event = 2; // Event is a trigger that listens for a specific event. + Task task = 3; // Task is a command to execute a specific task. + Map map = 4; // Map is a set of instructions to convert data. + } } message Edge { - message Input { - message Reference { - string nodeKey = 1; // Key of the node in the graph. If empty, will be using the src of the edge. - string key = 2; // Key of a specific parameter of the referenced node's output data. - } - - string key = 1; // Key of the input (as defined in the the service's task definition). - oneof value { - Reference ref = 2; // Input defined as reference. - } - } - string src = 1; // Source of the edge. - string dst = 2; // Destination of the edge. - repeated Input inputs = 3; // Inputs for the destination task. + string src = 1; // Source of the edge. + string dst = 2; // Destination of the edge. } - bytes hash = 1; // Workflow's hash + bytes hash = 1; // Workflow's hash string key = 2; // Workflow's key - Trigger trigger = 3; // Trigger for the workflow. repeated Node nodes = 4; // Nodes with information related to the execution to trigger. repeated Edge edges = 5; // Edges to create the link between the nodes. } diff --git a/server/grpc/api/workflow.go b/server/grpc/api/workflow.go index 6f3c6d2a7..2bbeb0ede 100644 --- a/server/grpc/api/workflow.go +++ b/server/grpc/api/workflow.go @@ -63,54 +63,16 @@ func (s *WorkflowServer) List(ctx context.Context, req *api.ListWorkflowRequest) }, nil } -<<<<<<< HEAD -func fromProtoFilters(filters []*types.Workflow_Trigger_Filter) []*workflow.TriggerFilter { - fs := make([]*workflow.TriggerFilter, len(filters)) - for i, filter := range filters { - var predicate workflow.Predicate - // switch filter.Predicate { - if filter.Predicate == types.Workflow_Trigger_Filter_EQ { - predicate = workflow.EQ - } - fs[i] = &workflow.TriggerFilter{ - Key: filter.Key, - Predicate: predicate, - Value: filter.Value, - } - } - return fs -} - -func fromProtoWorkflowNodes(nodes []*types.Workflow_Node) []workflow.Node { - res := make([]workflow.Node, len(nodes)) - for i, node := range nodes { - res[i] = workflow.Node{ - Key: node.Key, - InstanceHash: node.InstanceHash, - TaskKey: node.TaskKey, -======= func fromProtoWorkflowNodes(nodes []*types.Workflow_Node) ([]workflow.Node, error) { res := make([]workflow.Node, len(nodes)) for i, node := range nodes { switch n := node.Type.(type) { case *types.Workflow_Node_Event_: - hash, err := hash.Decode(n.Event.InstanceHash) - if err != nil { - return nil, err - } - res[i] = workflow.Event{Key: n.Event.Key, InstanceHash: hash, EventKey: n.Event.EventKey} + res[i] = workflow.Event{Key: n.Event.Key, InstanceHash: n.Event.InstanceHash, EventKey: n.Event.EventKey} case *types.Workflow_Node_Result_: - hash, err := hash.Decode(n.Result.InstanceHash) - if err != nil { - return nil, err - } - res[i] = workflow.Result{Key: n.Result.Key, InstanceHash: hash, TaskKey: n.Result.TaskKey} + res[i] = workflow.Result{Key: n.Result.Key, InstanceHash: n.Result.InstanceHash, TaskKey: n.Result.TaskKey} case *types.Workflow_Node_Task_: - hash, err := hash.Decode(n.Task.InstanceHash) - if err != nil { - return nil, err - } - res[i] = workflow.Task{InstanceHash: hash, TaskKey: n.Task.TaskKey, Key: n.Task.Key} + res[i] = workflow.Task{InstanceHash: n.Task.InstanceHash, TaskKey: n.Task.TaskKey, Key: n.Task.Key} case *types.Workflow_Node_Map_: outputs := make([]workflow.Output, len(n.Map.Outputs)) for j, output := range n.Map.Outputs { @@ -129,10 +91,9 @@ func fromProtoWorkflowNodes(nodes []*types.Workflow_Node) ([]workflow.Node, erro res[i] = workflow.Map{Key: n.Map.Key, Outputs: outputs} default: return nil, fmt.Errorf("node has unexpected type %T", n) ->>>>>>> dev } } - return res + return res, nil } func fromProtoWorkflowEdges(edges []*types.Workflow_Edge) []workflow.Edge { @@ -147,31 +108,10 @@ func fromProtoWorkflowEdges(edges []*types.Workflow_Edge) []workflow.Edge { } func fromProtoWorkflow(wf *types.Workflow) (*workflow.Workflow, error) { -<<<<<<< HEAD - nodes := fromProtoWorkflowNodes(wf.Nodes) - edges, err := fromProtoWorkflowEdges(wf.Edges) - if err != nil { - return nil, err - } - trigger := workflow.Trigger{ - InstanceHash: wf.Trigger.InstanceHash, - NodeKey: wf.Trigger.NodeKey, - Filters: fromProtoFilters(wf.Trigger.Filters), - } - switch x := wf.Trigger.Key.(type) { - case *types.Workflow_Trigger_EventKey: - trigger.EventKey = x.EventKey - case *types.Workflow_Trigger_TaskKey: - trigger.TaskKey = x.TaskKey - default: - return nil, fmt.Errorf("workflow trigger key has unexpected type %T", x) - } -======= nodes, err := fromProtoWorkflowNodes(wf.Nodes) if err != nil { return nil, err } ->>>>>>> dev return &workflow.Workflow{ Key: wf.Key, Graph: workflow.Graph{ @@ -184,19 +124,13 @@ func fromProtoWorkflow(wf *types.Workflow) (*workflow.Workflow, error) { func toProtoWorkflowNodes(nodes []workflow.Node) []*types.Workflow_Node { res := make([]*types.Workflow_Node, len(nodes)) for i, node := range nodes { -<<<<<<< HEAD - res[i] = &types.Workflow_Node{ - Key: node.Key, - InstanceHash: node.InstanceHash, - TaskKey: node.TaskKey, -======= protoNode := types.Workflow_Node{} switch n := node.(type) { case *workflow.Result: protoNode.Type = &types.Workflow_Node_Result_{ Result: &types.Workflow_Node_Result{ Key: n.Key, - InstanceHash: n.InstanceHash.String(), + InstanceHash: n.InstanceHash, TaskKey: n.TaskKey, }, } @@ -204,7 +138,7 @@ func toProtoWorkflowNodes(nodes []workflow.Node) []*types.Workflow_Node { protoNode.Type = &types.Workflow_Node_Event_{ Event: &types.Workflow_Node_Event{ Key: n.Key, - InstanceHash: n.InstanceHash.String(), + InstanceHash: n.InstanceHash, EventKey: n.EventKey, }, } @@ -212,7 +146,7 @@ func toProtoWorkflowNodes(nodes []workflow.Node) []*types.Workflow_Node { protoNode.Type = &types.Workflow_Node_Task_{ Task: &types.Workflow_Node_Task{ Key: n.Key, - InstanceHash: n.InstanceHash.String(), + InstanceHash: n.InstanceHash, TaskKey: n.TaskKey, }, } @@ -237,7 +171,6 @@ func toProtoWorkflowNodes(nodes []workflow.Node) []*types.Workflow_Node { Outputs: outputs, }, } ->>>>>>> dev } res[i] = &protoNode } @@ -256,31 +189,11 @@ func toProtoWorkflowEdges(edges []workflow.Edge) []*types.Workflow_Edge { } func toProtoWorkflow(wf *workflow.Workflow) *types.Workflow { -<<<<<<< HEAD - trigger := &types.Workflow_Trigger{ - InstanceHash: wf.Trigger.InstanceHash, - Filters: toProtoFilters(wf.Trigger.Filters), - NodeKey: wf.Trigger.NodeKey, - } - if wf.Trigger.TaskKey != "" { - trigger.Key = &types.Workflow_Trigger_TaskKey{TaskKey: wf.Trigger.TaskKey} - } - if wf.Trigger.EventKey != "" { - trigger.Key = &types.Workflow_Trigger_EventKey{EventKey: wf.Trigger.EventKey} - } - return &types.Workflow{ - Hash: wf.Hash, - Key: wf.Key, - Trigger: trigger, - Nodes: toProtoWorkflowNodes(wf.Nodes), - Edges: toProtoWorkflowEdges(wf.Edges), -======= return &types.Workflow{ - Hash: wf.Hash.String(), + Hash: wf.Hash, Key: wf.Key, Nodes: toProtoWorkflowNodes(wf.Nodes), Edges: toProtoWorkflowEdges(wf.Edges), ->>>>>>> dev } } diff --git a/workflow/marshal.go b/workflow/marshal.go index 324a00185..39b909e94 100644 --- a/workflow/marshal.go +++ b/workflow/marshal.go @@ -134,11 +134,11 @@ func (w *Workflow) preprocessUnmashalNode(nodeInfo map[string]interface{}) (map[ continue } if key == "instanceHash" { - instanceHash, err := hash.Decode(value.(string)) + h, err := hash.Decode(value.(string)) if err != nil { return nil, err } - data[key] = instanceHash + data[key] = h } else { data[key] = value }