Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Exchange working data between a flow and its activities #1

Open
wants to merge 2 commits into
base: working-data-between-flow-and-activities
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion action/flow/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (inst *Instance) Return(returnData map[string]*data.Attribute, err error) {
inst.returnError = err
}

func (inst *Instance) WorkingData() data.Scope {
func (inst *Instance) WorkingData() data.MutableScope {
return inst
}

Expand Down
4 changes: 4 additions & 0 deletions action/flow/instance/taskinst.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,7 @@ func (taskInst *TaskInst) appendErrorData(err error) {
// return ti.flowInst
//}
//

func (ti *TaskInst) FlowWorkingData() data.MutableScope {
return ti.flowInst.WorkingData()
}
4 changes: 4 additions & 0 deletions action/flow/model/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ type FlowContext interface {

// Status gets the state of the Flow instance
Status() FlowStatus

WorkingData() data.MutableScope
}

// TaskContext is the execution context of the Task when executing
Expand Down Expand Up @@ -55,6 +57,8 @@ type TaskContext interface {
UpdateWorkingData(key string, value interface{}) error

GetWorkingData(key string) (*data.Attribute, bool)

FlowWorkingData() data.MutableScope
}

// LinkInstance is the instance of a link
Expand Down
6 changes: 3 additions & 3 deletions action/flow/test/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func NewTestActivityContext(metadata *activity.Metadata) *TestActivityContext {
HostId: "1",
HostRef: "github.com/TIBCOSoftware/flogo-contrib/action/flow",
IoMetadata: &data.IOMetadata{Input: input, Output: output},
HostData: data.NewSimpleScope(nil, nil),
HostData: data.NewSimpleSyncScope(nil, nil),
}

return NewTestActivityContextWithAction(metadata, ac)
Expand Down Expand Up @@ -84,7 +84,7 @@ type TestActivityHost struct {
HostRef string

IoMetadata *data.IOMetadata
HostData data.Scope
HostData data.MutableScope
ReplyData map[string]interface{}
ReplyDataAttr map[string]*data.Attribute
ReplyErr error
Expand Down Expand Up @@ -118,7 +118,7 @@ func (ac *TestActivityHost) Return(data map[string]*data.Attribute, err error) {
ac.ReplyErr = err
}

func (ac *TestActivityHost) WorkingData() data.Scope {
func (ac *TestActivityHost) WorkingData() data.MutableScope {
return ac.HostData
}

Expand Down