Skip to content

Commit

Permalink
Converted encoded.Value and encoded.Values to interface (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfateev committed Dec 13, 2017
1 parent cb70c86 commit 060aa91
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions encoded/encoded.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
// Package encoded contains wrappers that are used for binary payloads deserialization.
package encoded

import (
"go.uber.org/cadence/internal"
)

type (

// Value is type alias used to encapsulate/extract encoded value from workflow/activity.
Value = internal.EncodedValue
// Value is used to encapsulate/extract encoded value from workflow/activity.
Value interface {
Get(valuePtr interface{}) error
}

// Values is type alias used to encapsulate/extract encoded values from workflow/activity.
Values = internal.EncodedValues
Values interface {
Get(valuePtr ...interface{}) error
}
)
2 changes: 1 addition & 1 deletion internal/internal_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type (
}

// Workflow is an interface that any workflow should implement.
// Code of a workflow must be deterministic. It must use cadence.Channel, cadence.Selector, and cadence.Go instead of
// Code of a workflow must be deterministic. It must use cadence.Channel, cadence.Selector, and workflow.Go instead of
// native channels, select and go. It also must not use range operation over map as it is randomized by go runtime.
// All time manipulation should use current time returned by GetTime(ctx) method.
// Note that workflow.Context is used instead of context.Context to avoid use of raw channels.
Expand Down
8 changes: 4 additions & 4 deletions workflow/deterministic_wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type (
Channel = internal.Channel

// Selector must be used instead of native go select by workflow code.
// Use cadence.NewSelector(ctx) method to create a Selector instance.
// Use workflow.NewSelector(ctx) method to create a Selector instance.
Selector = internal.Selector

// Future represents the result of an asynchronous computation.
Expand Down Expand Up @@ -102,7 +102,7 @@ func Now(ctx Context) time.Time {

// NewTimer returns immediately and the future becomes ready after the specified duration d. The workflow needs to use
// this NewTimer() to get the timer instead of the Go lang library one(timer.NewTimer()). You can cancel the pending
// timer by cancel the Context (using context from cadence.WithCancel(ctx)) and that will cancel the timer. After timer
// timer by cancel the Context (using context from workflow.WithCancel(ctx)) and that will cancel the timer. After timer
// is canceled, the returned Future become ready, and Future.Get() will return *CanceledError.
// The current timer resolution implementation is in seconds but is subjected to change.
func NewTimer(ctx Context, d time.Duration) Future {
Expand All @@ -111,9 +111,9 @@ func NewTimer(ctx Context, d time.Duration) Future {

// Sleep pauses the current workflow for at least the duration d. A negative or zero duration causes Sleep to return
// immediately. Workflow code needs to use this Sleep() to sleep instead of the Go lang library one(timer.Sleep()).
// You can cancel the pending sleep by cancel the Context (using context from cadence.WithCancel(ctx)).
// You can cancel the pending sleep by cancel the Context (using context from workflow.WithCancel(ctx)).
// Sleep() returns nil if the duration d is passed, or it returns *CanceledError if the ctx is canceled. There are 2
// reasons the ctx could be canceled: 1) your workflow code cancel the ctx (with cadence.WithCancel(ctx));
// reasons the ctx could be canceled: 1) your workflow code cancel the ctx (with workflow.WithCancel(ctx));
// 2) your workflow itself is canceled by external request.
// The current timer resolution implementation is in seconds but is subjected to change.
func Sleep(ctx Context, d time.Duration) (err error) {
Expand Down
4 changes: 2 additions & 2 deletions workflow/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func RegisterWithOptions(workflowFunc interface{}, opts RegisterOptions) {
//
// If the activity failed to complete then the future get error would indicate the failure, and it can be one of
// CustomError, TimeoutError, CanceledError, PanicError, GenericError.
// You can cancel the pending activity using context(cadence.WithCancel(ctx)) and that will fail the activity with
// You can cancel the pending activity using context(workflow.WithCancel(ctx)) and that will fail the activity with
// error CanceledError.
//
// ExecuteActivity returns Future with activity result or failure.
Expand All @@ -136,7 +136,7 @@ func ExecuteActivity(ctx Context, activity interface{}, args ...interface{}) Fut
// Input args are the arguments that need to be passed to the child workflow function represented by childWorkflow.
// If the child workflow failed to complete then the future get error would indicate the failure and it can be one of
// CustomError, TimeoutError, CanceledError, GenericError.
// You can cancel the pending child workflow using context(cadence.WithCancel(ctx)) and that will fail the workflow with
// You can cancel the pending child workflow using context(workflow.WithCancel(ctx)) and that will fail the workflow with
// error CanceledError.
// ExecuteChildWorkflow returns ChildWorkflowFuture.
func ExecuteChildWorkflow(ctx Context, childWorkflow interface{}, args ...interface{}) ChildWorkflowFuture {
Expand Down

0 comments on commit 060aa91

Please sign in to comment.