Skip to content

Commit

Permalink
Expose update interceptor input (#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
Quinn-With-Two-Ns authored Jul 18, 2023
1 parent 023af0e commit 57d29ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions interceptor/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ type HandleSignalInput = internal.HandleSignalInput
// HandleQueryInput is input for WorkflowInboundInterceptor.HandleQuery.
type HandleQueryInput = internal.HandleQueryInput

// UpdateInput is input for WorkflowInboundInterceptor.ExecuteUpdate
// and WorkflowInboundInterceptor.ValidateUpdate.
//
// NOTE: Experimental
type UpdateInput = internal.UpdateInput

// WorkflowOutboundInterceptor is an interface for all workflow calls
// originating from the SDK.
//
Expand Down
4 changes: 4 additions & 0 deletions internal/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,16 @@ type WorkflowInboundInterceptor interface {
// as part of its optional configuration. The same prohibition against
// mutating workflow state that is demanded of UpdateOptions.Validator
// functions also applies to this function.
//
// NOTE: Experimental
ValidateUpdate(ctx Context, in *UpdateInput) error

// ExecuteUpdate is called after ValidateUpdate if and only if the latter
// returns nil. interceptor.WorkflowHeader will return a non-nil map for
// this context. ExecuteUpdate is allowed to mutate workflow state and
// perform workflow actions such as scheduling activities, timers, etc.
//
// NOTE: Experimental
ExecuteUpdate(ctx Context, in *UpdateInput) (interface{}, error)

mustEmbedWorkflowInboundInterceptorBase()
Expand Down

0 comments on commit 57d29ee

Please sign in to comment.