-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support passing the result of one task into other tasks (#1)
* Support passing data between tasks * Add a new Results type for intermediate results, change interface to use varargs for tasks * Update the docs to support passing parameters
- Loading branch information
Showing
6 changed files
with
83 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package workflow | ||
|
||
import "sync" | ||
|
||
// Results holds a reference to the intermediate results of a workflow | ||
// execution. It used to task the result of one function into its | ||
// dependencies. | ||
type Results struct { | ||
resMap *sync.Map | ||
} | ||
|
||
// Load retrieves the result for a particular task. | ||
func (r Results) Load(taskName string) (val interface{}, ok bool) { | ||
return r.resMap.Load(taskName) | ||
} | ||
|
||
func (r Results) store(taskName string, result interface{}) { | ||
r.resMap.Store(taskName, result) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters