From b6c1ce9317b999029f19a38cc8da0ef1cc32f379 Mon Sep 17 00:00:00 2001 From: Shreyas Srivatsan Date: Thu, 25 Apr 2019 15:31:02 -0700 Subject: [PATCH 01/11] start adding header logic --- .gen/go/shared/idl.go | 4 +- .gen/go/shared/types.go | 454 ++++++++++++++++++++-- idl/github.com/uber/cadence/shared.thrift | 16 + internal/activity.go | 2 +- internal/context.go | 4 + internal/internal_event_handlers.go | 2 +- internal/internal_worker_base.go | 2 +- internal/internal_workflow.go | 5 +- internal/internal_workflow_client.go | 1 + internal/internal_workflow_testsuite.go | 2 +- 10 files changed, 459 insertions(+), 33 deletions(-) diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index e44d5fe8c..85b3c1ffb 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "go.uber.org/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "07317858e003d0c1924bbc2b85abf8e3318c57e4", + SHA1: "9f07faff7803679e708717b189aa377670ec4760", Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nexception DomainNotActiveError {\n 1: required string message\n 2: required string domainName\n 3: required string currentCluster\n 4: required string activeCluster\n}\n\nexception LimitExceededError {\n 1: required string message\n}\n\nexception AccessDeniedError {\n 1: required string message\n}\n\nexception RetryTaskError {\n 1: required string message\n 2: optional string domainId\n 3: optional string workflowId\n 4: optional string runId\n 5: optional i64 (js.type = \"Long\") nextEventId\n}\n\nenum WorkflowIdReusePolicy {\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running, and the last execution close state is in\n * [terminated, cancelled, timeouted, failed].\n */\n AllowDuplicateFailedOnly,\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running.\n */\n AllowDuplicate,\n /*\n * do not allow start a workflow execution using the same workflow ID at all\n */\n RejectDuplicate,\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\n// whenever this list of decision is changed\n// do change the mutableStateBuilder.go\n// function shouldBufferEvent\n// to make sure wo do the correct event ordering\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n SignalExternalWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n SignalExternalWorkflowExecutionInitiated,\n SignalExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionSignaled,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE,\n BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_START_CHILD_EXECUTION_ATTRIBUTES,\n FORCE_CLOSE_DECISION,\n FAILOVER_CLOSE_DECISION,\n BAD_SIGNAL_INPUT_SIZE,\n RESET_WORKFLOW,\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum SignalExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nenum PendingActivityState {\n SCHEDULED,\n STARTED,\n CANCEL_REQUESTED,\n}\n\nenum HistoryEventFilterType {\n ALL_EVENT,\n CLOSE_EVENT,\n}\n\nenum TaskListKind {\n NORMAL,\n STICKY,\n}\n\nenum ArchivalStatus {\n DISABLED,\n ENABLED,\n}\n\nstruct Header {\n 10: optional map fields\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n 20: optional TaskListKind kind\n}\n\nenum EncodingType {\n ThriftRW,\n}\n\nstruct DataBlob {\n 10: optional EncodingType EncodingType\n 20: optional binary Data\n}\n\nstruct ReplicationInfo {\n 10: optional i64 (js.type = \"Long\") version\n 20: optional i64 (js.type = \"Long\") lastEventId\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct Memo {\n 10: optional map fields\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n 70: optional string parentDomainId\n 80: optional WorkflowExecution parentExecution\n 90: optional i64 (js.type = \"Long\") executionTime\n 100: optional Memo memo\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 70: optional RetryPolicy retryPolicy\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional string signalName\n 40: optional binary input\n 50: optional binary control\n 60: optional bool childWorkflowOnly\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional Header header\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional i32 backoffStartIntervalInSeconds\n 70: optional RetryPolicy retryPolicy\n 80: optional ContinueAsNewInitiator initiator\n 90: optional string failureReason\n 100: optional binary failureDetails\n 110: optional binary lastCompletionResult\n 120: optional string cronSchedule\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional RetryPolicy retryPolicy\n 120: optional string cronSchedule\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n 110: optional SignalExternalWorkflowExecutionDecisionAttributes signalExternalWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 12: optional string parentWorkflowDomain\n 14: optional WorkflowExecution parentWorkflowExecution\n 16: optional i64 (js.type = \"Long\") parentInitiatedEventId\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 52: optional ChildPolicy childPolicy\n 54: optional string continuedExecutionRunId\n 55: optional ContinueAsNewInitiator initiator\n 56: optional string continuedFailureReason\n 57: optional binary continuedFailureDetails\n 58: optional binary lastCompletionResult\n 60: optional string identity\n 70: optional RetryPolicy retryPolicy\n 80: optional i32 attempt\n 90: optional i64 (js.type = \"Long\") expirationTimestamp\n 100: optional string cronSchedule\n 110: optional i32 firstDecisionTaskBackoffSeconds\n 120: optional Memo memo\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nenum ContinueAsNewInitiator {\n Decider,\n RetryPolicy,\n CronSchedule,\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 80: optional i32 backoffStartIntervalInSeconds\n 90: optional ContinueAsNewInitiator initiator\n 100: optional string failureReason\n 110: optional binary failureDetails\n 120: optional binary lastCompletionResult\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n 50: optional string binaryChecksum\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n 50: optional string reason\n // for reset workflow\n 60: optional string baseRunId\n 70: optional string newRunId\n 80: optional i64 (js.type = \"Long\") forkEventVersion\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional RetryPolicy retryPolicy\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n 40: optional i32 attempt\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional Header header\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct SignalExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional string signalName\n 50: optional binary input\n 60: optional binary control\n 70: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionFailedEventAttributes {\n 10: optional SignalExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionSignaledEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 120: optional RetryPolicy retryPolicy\n 130: optional string cronSchedule\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 35: optional i64 (js.type = \"Long\") version\n 36: optional i64 (js.type = \"Long\") taskId\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n 420: optional SignalExternalWorkflowExecutionInitiatedEventAttributes signalExternalWorkflowExecutionInitiatedEventAttributes\n 430: optional SignalExternalWorkflowExecutionFailedEventAttributes signalExternalWorkflowExecutionFailedEventAttributes\n 440: optional ExternalWorkflowExecutionSignaledEventAttributes externalWorkflowExecutionSignaledEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n // A key-value map for any customized purpose\n 50: optional map data\n 60: optional string uuid\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n 30: optional string archivalBucketName\n 40: optional i32 archivalRetentionPeriodInDays\n 50: optional ArchivalStatus archivalStatus\n 60: optional string archivalBucketOwner\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n // A key-value map for any customized purpose\n 30: optional map data\n}\n\nstruct ClusterReplicationConfiguration {\n 10: optional string clusterName\n}\n\nstruct DomainReplicationConfiguration {\n 10: optional string activeClusterName\n 20: optional list clusters\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n 60: optional list clusters\n 70: optional string activeClusterName\n // A key-value map for any customized purpose\n 80: optional map data\n 90: optional string securityToken\n 100: optional ArchivalStatus archivalStatus\n 110: optional string archivalBucketName\n}\n\nstruct ListDomainsRequest {\n 10: optional i32 pageSize\n 20: optional binary nextPageToken\n}\n\nstruct ListDomainsResponse {\n 10: optional list domains\n 20: optional binary nextPageToken\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n 20: optional string uuid\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n 40: optional DomainReplicationConfiguration replicationConfiguration\n 50: optional string securityToken\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n 20: optional string securityToken\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional ChildPolicy childPolicy\n 120: optional RetryPolicy retryPolicy\n 130: optional string cronSchedule\n 140: optional Memo memo\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 51: optional i64 (js.type = 'Long') attempt\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n 90: optional TaskList WorkflowExecutionTaskList\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n 60: optional bool returnNewDecisionTask\n 70: optional bool forceCreateNewDecisionTask\n 80: optional string binaryChecksum\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n 10: optional PollForDecisionTaskResponse decisionTask\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n 120: optional i32 attempt\n 130: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n 140: optional binary heartbeatDetails\n 150: optional WorkflowType workflowType\n 160: optional string workflowDomain\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n 60: optional HistoryEventFilterType HistoryEventFilterType\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n 30: optional bool archived\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n 60: optional string requestId\n 70: optional binary control\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional string signalName\n 120: optional binary signalInput\n 130: optional binary control\n 140: optional RetryPolicy retryPolicy\n 150: optional string cronSchedule\n 160: optional Memo memo\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ResetWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional i64 (js.type = \"Long\") decisionFinishEventId\n 50: optional string requestId\n}\n\nstruct ResetWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct ResetStickyTaskListRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n // The reason to keep this response is to allow returning\n // information in the future.\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct PendingActivityInfo {\n 10: optional string activityID\n 20: optional ActivityType activityType\n 30: optional PendingActivityState state\n 40: optional binary heartbeatDetails\n 50: optional i64 (js.type = \"Long\") lastHeartbeatTimestamp\n 60: optional i64 (js.type = \"Long\") lastStartedTimestamp\n 70: optional i32 attempt\n 80: optional i32 maximumAttempts\n 90: optional i64 (js.type = \"Long\") scheduledTimestamp\n 100: optional i64 (js.type = \"Long\") expirationTimestamp\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n 30: optional list pendingActivities\n}\n\nstruct DescribeTaskListRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n 40: optional bool includeTaskListStatus\n}\n\nstruct DescribeTaskListResponse {\n 10: optional list pollers\n 20: optional TaskListStatus taskListStatus\n}\n\nstruct TaskListStatus {\n 10: optional i64 (js.type = \"Long\") backlogCountHint\n 20: optional i64 (js.type = \"Long\") readLevel\n 30: optional i64 (js.type = \"Long\") ackLevel\n 35: optional double ratePerSecond\n 40: optional TaskIDBlock taskIDBlock\n}\n\nstruct TaskIDBlock {\n 10: optional i64 (js.type = \"Long\") startID\n 20: optional i64 (js.type = \"Long\") endID\n}\n\n//At least one of the parameters needs to be provided\nstruct DescribeHistoryHostRequest {\n 10: optional string hostAddress //ip:port\n 20: optional i32 shardIdForHost\n 30: optional WorkflowExecution executionForHost\n}\n\nstruct DescribeHistoryHostResponse{\n 10: optional i32 numberOfShards\n 20: optional list shardIDs\n 30: optional DomainCacheInfo domainCache\n 40: optional string shardControllerStatus\n 50: optional string address\n}\n\nstruct DomainCacheInfo{\n 10: optional i64 numOfItemsInCacheByID\n 20: optional i64 numOfItemsInCacheByName\n}\n\nenum TaskListType {\n /*\n * Decision type of tasklist\n */\n Decision,\n /*\n * Activity type of tasklist\n */\n Activity,\n}\n\nstruct PollerInfo {\n // Unix Nano\n 10: optional i64 (js.type = \"Long\") lastAccessTime\n 20: optional string identity\n 30: optional double ratePerSecond\n}\n\nstruct RetryPolicy {\n // Interval of the first retry. If coefficient is 1.0 then it is used for all retries.\n 10: optional i32 initialIntervalInSeconds\n\n // Coefficient used to calculate the next retry interval.\n // The next retry interval is previous interval multiplied by the coefficient.\n // Must be 1 or larger.\n 20: optional double backoffCoefficient\n\n // Maximum interval between retries. Exponential backoff leads to interval increase.\n // This value is the cap of the increase. Default is 100x of initial interval.\n 30: optional i32 maximumIntervalInSeconds\n\n // Maximum number of attempts. When exceeded the retries stop even if not expired yet.\n // Must be 1 or bigger. Default is unlimited.\n 40: optional i32 maximumAttempts\n\n // Non-Retriable errors. Will stop retrying if error matches this list.\n 50: optional list nonRetriableErrorReasons\n\n // Expiration time for the whole retry process.\n 60: optional i32 expirationIntervalInSeconds\n}\n\n// HistoryBranchRange represents a piece of range for a branch.\nstruct HistoryBranchRange{\n // branchID of original branch forked from\n 10: optional string branchID\n // beinning node for the range, inclusive\n 20: optional i64 beginNodeID\n // ending node for the range, exclusive\n 30: optional i64 endNodeID\n}\n\n// For history persistence to serialize/deserialize branch details\nstruct HistoryBranch{\n 10: optional string treeID\n 20: optional string branchID\n 30: optional list ancestors\n}\n" +const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nexception DomainNotActiveError {\n 1: required string message\n 2: required string domainName\n 3: required string currentCluster\n 4: required string activeCluster\n}\n\nexception LimitExceededError {\n 1: required string message\n}\n\nexception AccessDeniedError {\n 1: required string message\n}\n\nexception RetryTaskError {\n 1: required string message\n 2: optional string domainId\n 3: optional string workflowId\n 4: optional string runId\n 5: optional i64 (js.type = \"Long\") nextEventId\n}\n\nexception ClientVersionNotSupportedError {\n 1: required string featureVersion\n 2: required string clientImpl\n 3: required string supportedVersions\n}\n\nenum WorkflowIdReusePolicy {\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running, and the last execution close state is in\n * [terminated, cancelled, timeouted, failed].\n */\n AllowDuplicateFailedOnly,\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running.\n */\n AllowDuplicate,\n /*\n * do not allow start a workflow execution using the same workflow ID at all\n */\n RejectDuplicate,\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\n// whenever this list of decision is changed\n// do change the mutableStateBuilder.go\n// function shouldBufferEvent\n// to make sure wo do the correct event ordering\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n SignalExternalWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n SignalExternalWorkflowExecutionInitiated,\n SignalExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionSignaled,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE,\n BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_START_CHILD_EXECUTION_ATTRIBUTES,\n FORCE_CLOSE_DECISION,\n FAILOVER_CLOSE_DECISION,\n BAD_SIGNAL_INPUT_SIZE,\n RESET_WORKFLOW,\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum SignalExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nenum PendingActivityState {\n SCHEDULED,\n STARTED,\n CANCEL_REQUESTED,\n}\n\nenum HistoryEventFilterType {\n ALL_EVENT,\n CLOSE_EVENT,\n}\n\nenum TaskListKind {\n NORMAL,\n STICKY,\n}\n\nenum ArchivalStatus {\n DISABLED,\n ENABLED,\n}\n\nstruct Header {\n 10: optional map fields\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n 20: optional TaskListKind kind\n}\n\nenum EncodingType {\n ThriftRW,\n}\n\nstruct DataBlob {\n 10: optional EncodingType EncodingType\n 20: optional binary Data\n}\n\nstruct ReplicationInfo {\n 10: optional i64 (js.type = \"Long\") version\n 20: optional i64 (js.type = \"Long\") lastEventId\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct Memo {\n 10: optional map fields\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n 70: optional string parentDomainId\n 80: optional WorkflowExecution parentExecution\n 90: optional i64 (js.type = \"Long\") executionTime\n 100: optional Memo memo\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 70: optional RetryPolicy retryPolicy\n 80: optional Header header\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional string signalName\n 40: optional binary input\n 50: optional binary control\n 60: optional bool childWorkflowOnly\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional Header header\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional i32 backoffStartIntervalInSeconds\n 70: optional RetryPolicy retryPolicy\n 80: optional ContinueAsNewInitiator initiator\n 90: optional string failureReason\n 100: optional binary failureDetails\n 110: optional binary lastCompletionResult\n 120: optional string cronSchedule\n 130: optional Header header\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional RetryPolicy retryPolicy\n 120: optional string cronSchedule\n 130: optional Header header\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n 110: optional SignalExternalWorkflowExecutionDecisionAttributes signalExternalWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 12: optional string parentWorkflowDomain\n 14: optional WorkflowExecution parentWorkflowExecution\n 16: optional i64 (js.type = \"Long\") parentInitiatedEventId\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 52: optional ChildPolicy childPolicy\n 54: optional string continuedExecutionRunId\n 55: optional ContinueAsNewInitiator initiator\n 56: optional string continuedFailureReason\n 57: optional binary continuedFailureDetails\n 58: optional binary lastCompletionResult\n 60: optional string identity\n 70: optional RetryPolicy retryPolicy\n 80: optional i32 attempt\n 90: optional i64 (js.type = \"Long\") expirationTimestamp\n 100: optional string cronSchedule\n 110: optional i32 firstDecisionTaskBackoffSeconds\n 120: optional Memo memo\n 130: optional Header header\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nenum ContinueAsNewInitiator {\n Decider,\n RetryPolicy,\n CronSchedule,\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 80: optional i32 backoffStartIntervalInSeconds\n 90: optional ContinueAsNewInitiator initiator\n 100: optional string failureReason\n 110: optional binary failureDetails\n 120: optional binary lastCompletionResult\n 130: optional Header header\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n 50: optional string binaryChecksum\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n 50: optional string reason\n // for reset workflow\n 60: optional string baseRunId\n 70: optional string newRunId\n 80: optional i64 (js.type = \"Long\") forkEventVersion\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional RetryPolicy retryPolicy\n 120: optional Header header\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n 40: optional i32 attempt\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional Header header\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct SignalExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional string signalName\n 50: optional binary input\n 60: optional binary control\n 70: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionFailedEventAttributes {\n 10: optional SignalExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionSignaledEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 120: optional RetryPolicy retryPolicy\n 130: optional string cronSchedule\n 140: optional Header header\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional Header header\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 35: optional i64 (js.type = \"Long\") version\n 36: optional i64 (js.type = \"Long\") taskId\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n 420: optional SignalExternalWorkflowExecutionInitiatedEventAttributes signalExternalWorkflowExecutionInitiatedEventAttributes\n 430: optional SignalExternalWorkflowExecutionFailedEventAttributes signalExternalWorkflowExecutionFailedEventAttributes\n 440: optional ExternalWorkflowExecutionSignaledEventAttributes externalWorkflowExecutionSignaledEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n // A key-value map for any customized purpose\n 50: optional map data\n 60: optional string uuid\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n 30: optional string archivalBucketName\n 40: optional i32 archivalRetentionPeriodInDays\n 50: optional ArchivalStatus archivalStatus\n 60: optional string archivalBucketOwner\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n // A key-value map for any customized purpose\n 30: optional map data\n}\n\nstruct ClusterReplicationConfiguration {\n 10: optional string clusterName\n}\n\nstruct DomainReplicationConfiguration {\n 10: optional string activeClusterName\n 20: optional list clusters\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n 60: optional list clusters\n 70: optional string activeClusterName\n // A key-value map for any customized purpose\n 80: optional map data\n 90: optional string securityToken\n 100: optional ArchivalStatus archivalStatus\n 110: optional string archivalBucketName\n}\n\nstruct ListDomainsRequest {\n 10: optional i32 pageSize\n 20: optional binary nextPageToken\n}\n\nstruct ListDomainsResponse {\n 10: optional list domains\n 20: optional binary nextPageToken\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n 20: optional string uuid\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n 40: optional DomainReplicationConfiguration replicationConfiguration\n 50: optional string securityToken\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n 20: optional string securityToken\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional ChildPolicy childPolicy\n 120: optional RetryPolicy retryPolicy\n 130: optional string cronSchedule\n 140: optional Memo memo\n 150: optional Header header\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 51: optional i64 (js.type = 'Long') attempt\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n 90: optional TaskList WorkflowExecutionTaskList\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n 60: optional bool returnNewDecisionTask\n 70: optional bool forceCreateNewDecisionTask\n 80: optional string binaryChecksum\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n 10: optional PollForDecisionTaskResponse decisionTask\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n 120: optional i32 attempt\n 130: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n 140: optional binary heartbeatDetails\n 150: optional WorkflowType workflowType\n 160: optional string workflowDomain\n 170: optional Header header\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n 60: optional HistoryEventFilterType HistoryEventFilterType\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n 30: optional bool archived\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n 60: optional string requestId\n 70: optional binary control\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional string signalName\n 120: optional binary signalInput\n 130: optional binary control\n 140: optional RetryPolicy retryPolicy\n 150: optional string cronSchedule\n 160: optional Memo memo\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ResetWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional i64 (js.type = \"Long\") decisionFinishEventId\n 50: optional string requestId\n}\n\nstruct ResetWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct ResetStickyTaskListRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n // The reason to keep this response is to allow returning\n // information in the future.\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct PendingActivityInfo {\n 10: optional string activityID\n 20: optional ActivityType activityType\n 30: optional PendingActivityState state\n 40: optional binary heartbeatDetails\n 50: optional i64 (js.type = \"Long\") lastHeartbeatTimestamp\n 60: optional i64 (js.type = \"Long\") lastStartedTimestamp\n 70: optional i32 attempt\n 80: optional i32 maximumAttempts\n 90: optional i64 (js.type = \"Long\") scheduledTimestamp\n 100: optional i64 (js.type = \"Long\") expirationTimestamp\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n 30: optional list pendingActivities\n}\n\nstruct DescribeTaskListRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n 40: optional bool includeTaskListStatus\n}\n\nstruct DescribeTaskListResponse {\n 10: optional list pollers\n 20: optional TaskListStatus taskListStatus\n}\n\nstruct TaskListStatus {\n 10: optional i64 (js.type = \"Long\") backlogCountHint\n 20: optional i64 (js.type = \"Long\") readLevel\n 30: optional i64 (js.type = \"Long\") ackLevel\n 35: optional double ratePerSecond\n 40: optional TaskIDBlock taskIDBlock\n}\n\nstruct TaskIDBlock {\n 10: optional i64 (js.type = \"Long\") startID\n 20: optional i64 (js.type = \"Long\") endID\n}\n\n//At least one of the parameters needs to be provided\nstruct DescribeHistoryHostRequest {\n 10: optional string hostAddress //ip:port\n 20: optional i32 shardIdForHost\n 30: optional WorkflowExecution executionForHost\n}\n\nstruct DescribeHistoryHostResponse{\n 10: optional i32 numberOfShards\n 20: optional list shardIDs\n 30: optional DomainCacheInfo domainCache\n 40: optional string shardControllerStatus\n 50: optional string address\n}\n\nstruct DomainCacheInfo{\n 10: optional i64 numOfItemsInCacheByID\n 20: optional i64 numOfItemsInCacheByName\n}\n\nenum TaskListType {\n /*\n * Decision type of tasklist\n */\n Decision,\n /*\n * Activity type of tasklist\n */\n Activity,\n}\n\nstruct PollerInfo {\n // Unix Nano\n 10: optional i64 (js.type = \"Long\") lastAccessTime\n 20: optional string identity\n 30: optional double ratePerSecond\n}\n\nstruct RetryPolicy {\n // Interval of the first retry. If coefficient is 1.0 then it is used for all retries.\n 10: optional i32 initialIntervalInSeconds\n\n // Coefficient used to calculate the next retry interval.\n // The next retry interval is previous interval multiplied by the coefficient.\n // Must be 1 or larger.\n 20: optional double backoffCoefficient\n\n // Maximum interval between retries. Exponential backoff leads to interval increase.\n // This value is the cap of the increase. Default is 100x of initial interval.\n 30: optional i32 maximumIntervalInSeconds\n\n // Maximum number of attempts. When exceeded the retries stop even if not expired yet.\n // Must be 1 or bigger. Default is unlimited.\n 40: optional i32 maximumAttempts\n\n // Non-Retriable errors. Will stop retrying if error matches this list.\n 50: optional list nonRetriableErrorReasons\n\n // Expiration time for the whole retry process.\n 60: optional i32 expirationIntervalInSeconds\n}\n\n// HistoryBranchRange represents a piece of range for a branch.\nstruct HistoryBranchRange{\n // branchID of original branch forked from\n 10: optional string branchID\n // beinning node for the range, inclusive\n 20: optional i64 beginNodeID\n // ending node for the range, exclusive\n 30: optional i64 endNodeID\n}\n\n// For history persistence to serialize/deserialize branch details\nstruct HistoryBranch{\n 10: optional string treeID\n 20: optional string branchID\n 30: optional list ancestors\n}\n" diff --git a/.gen/go/shared/types.go b/.gen/go/shared/types.go index 2390807a9..be69e1273 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -1036,6 +1036,7 @@ type ActivityTaskScheduledEventAttributes struct { HeartbeatTimeoutSeconds *int32 `json:"heartbeatTimeoutSeconds,omitempty"` DecisionTaskCompletedEventId *int64 `json:"decisionTaskCompletedEventId,omitempty"` RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` + Header *Header `json:"header,omitempty"` } // ToWire translates a ActivityTaskScheduledEventAttributes struct into a Thrift-level intermediate @@ -1055,7 +1056,7 @@ type ActivityTaskScheduledEventAttributes struct { // } func (v *ActivityTaskScheduledEventAttributes) ToWire() (wire.Value, error) { var ( - fields [11]wire.Field + fields [12]wire.Field i int = 0 w wire.Value err error @@ -1149,6 +1150,14 @@ func (v *ActivityTaskScheduledEventAttributes) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 110, Value: w} i++ } + if v.Header != nil { + w, err = v.Header.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 120, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -1171,6 +1180,12 @@ func _RetryPolicy_Read(w wire.Value) (*RetryPolicy, error) { return &v, err } +func _Header_Read(w wire.Value) (*Header, error) { + var v Header + err := v.FromWire(w) + return &v, err +} + // FromWire deserializes a ActivityTaskScheduledEventAttributes struct from its Thrift-level // representation. The Thrift-level representation may be obtained // from a ThriftRW protocol implementation. @@ -1294,6 +1309,14 @@ func (v *ActivityTaskScheduledEventAttributes) FromWire(w wire.Value) error { return err } + } + case 120: + if field.Value.Type() == wire.TStruct { + v.Header, err = _Header_Read(field.Value) + if err != nil { + return err + } + } } } @@ -1308,7 +1331,7 @@ func (v *ActivityTaskScheduledEventAttributes) String() string { return "" } - var fields [11]string + var fields [12]string i := 0 if v.ActivityId != nil { fields[i] = fmt.Sprintf("ActivityId: %v", *(v.ActivityId)) @@ -1354,6 +1377,10 @@ func (v *ActivityTaskScheduledEventAttributes) String() string { fields[i] = fmt.Sprintf("RetryPolicy: %v", v.RetryPolicy) i++ } + if v.Header != nil { + fields[i] = fmt.Sprintf("Header: %v", v.Header) + i++ + } return fmt.Sprintf("ActivityTaskScheduledEventAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -1406,6 +1433,9 @@ func (v *ActivityTaskScheduledEventAttributes) Equals(rhs *ActivityTaskScheduled if !((v.RetryPolicy == nil && rhs.RetryPolicy == nil) || (v.RetryPolicy != nil && rhs.RetryPolicy != nil && v.RetryPolicy.Equals(rhs.RetryPolicy))) { return false } + if !((v.Header == nil && rhs.Header == nil) || (v.Header != nil && rhs.Header != nil && v.Header.Equals(rhs.Header))) { + return false + } return true } @@ -4076,6 +4106,7 @@ type ChildWorkflowExecutionStartedEventAttributes struct { InitiatedEventId *int64 `json:"initiatedEventId,omitempty"` WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"` WorkflowType *WorkflowType `json:"workflowType,omitempty"` + Header *Header `json:"header,omitempty"` } // ToWire translates a ChildWorkflowExecutionStartedEventAttributes struct into a Thrift-level intermediate @@ -4095,7 +4126,7 @@ type ChildWorkflowExecutionStartedEventAttributes struct { // } func (v *ChildWorkflowExecutionStartedEventAttributes) ToWire() (wire.Value, error) { var ( - fields [4]wire.Field + fields [5]wire.Field i int = 0 w wire.Value err error @@ -4133,6 +4164,14 @@ func (v *ChildWorkflowExecutionStartedEventAttributes) ToWire() (wire.Value, err fields[i] = wire.Field{ID: 40, Value: w} i++ } + if v.Header != nil { + w, err = v.Header.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 50, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -4194,6 +4233,14 @@ func (v *ChildWorkflowExecutionStartedEventAttributes) FromWire(w wire.Value) er return err } + } + case 50: + if field.Value.Type() == wire.TStruct { + v.Header, err = _Header_Read(field.Value) + if err != nil { + return err + } + } } } @@ -4208,7 +4255,7 @@ func (v *ChildWorkflowExecutionStartedEventAttributes) String() string { return "" } - var fields [4]string + var fields [5]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -4226,6 +4273,10 @@ func (v *ChildWorkflowExecutionStartedEventAttributes) String() string { fields[i] = fmt.Sprintf("WorkflowType: %v", v.WorkflowType) i++ } + if v.Header != nil { + fields[i] = fmt.Sprintf("Header: %v", v.Header) + i++ + } return fmt.Sprintf("ChildWorkflowExecutionStartedEventAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -4247,6 +4298,9 @@ func (v *ChildWorkflowExecutionStartedEventAttributes) Equals(rhs *ChildWorkflow if !((v.WorkflowType == nil && rhs.WorkflowType == nil) || (v.WorkflowType != nil && rhs.WorkflowType != nil && v.WorkflowType.Equals(rhs.WorkflowType))) { return false } + if !((v.Header == nil && rhs.Header == nil) || (v.Header != nil && rhs.Header != nil && v.Header.Equals(rhs.Header))) { + return false + } return true } @@ -4779,6 +4833,168 @@ func (v *ChildWorkflowExecutionTimedOutEventAttributes) GetStartedEventId() (o i return } +type ClientVersionNotSupportedError struct { + FeatureVersion string `json:"featureVersion,required"` + ClientImpl string `json:"clientImpl,required"` + SupportedVersions string `json:"supportedVersions,required"` +} + +// ToWire translates a ClientVersionNotSupportedError struct into a Thrift-level intermediate +// representation. This intermediate representation may be serialized +// into bytes using a ThriftRW protocol implementation. +// +// An error is returned if the struct or any of its fields failed to +// validate. +// +// x, err := v.ToWire() +// if err != nil { +// return err +// } +// +// if err := binaryProtocol.Encode(x, writer); err != nil { +// return err +// } +func (v *ClientVersionNotSupportedError) ToWire() (wire.Value, error) { + var ( + fields [3]wire.Field + i int = 0 + w wire.Value + err error + ) + + w, err = wire.NewValueString(v.FeatureVersion), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 1, Value: w} + i++ + + w, err = wire.NewValueString(v.ClientImpl), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 2, Value: w} + i++ + + w, err = wire.NewValueString(v.SupportedVersions), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 3, Value: w} + i++ + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +// FromWire deserializes a ClientVersionNotSupportedError struct from its Thrift-level +// representation. The Thrift-level representation may be obtained +// from a ThriftRW protocol implementation. +// +// An error is returned if we were unable to build a ClientVersionNotSupportedError struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v ClientVersionNotSupportedError +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *ClientVersionNotSupportedError) FromWire(w wire.Value) error { + var err error + + featureVersionIsSet := false + clientImplIsSet := false + supportedVersionsIsSet := false + + for _, field := range w.GetStruct().Fields { + switch field.ID { + case 1: + if field.Value.Type() == wire.TBinary { + v.FeatureVersion, err = field.Value.GetString(), error(nil) + if err != nil { + return err + } + featureVersionIsSet = true + } + case 2: + if field.Value.Type() == wire.TBinary { + v.ClientImpl, err = field.Value.GetString(), error(nil) + if err != nil { + return err + } + clientImplIsSet = true + } + case 3: + if field.Value.Type() == wire.TBinary { + v.SupportedVersions, err = field.Value.GetString(), error(nil) + if err != nil { + return err + } + supportedVersionsIsSet = true + } + } + } + + if !featureVersionIsSet { + return errors.New("field FeatureVersion of ClientVersionNotSupportedError is required") + } + + if !clientImplIsSet { + return errors.New("field ClientImpl of ClientVersionNotSupportedError is required") + } + + if !supportedVersionsIsSet { + return errors.New("field SupportedVersions of ClientVersionNotSupportedError is required") + } + + return nil +} + +// String returns a readable string representation of a ClientVersionNotSupportedError +// struct. +func (v *ClientVersionNotSupportedError) String() string { + if v == nil { + return "" + } + + var fields [3]string + i := 0 + fields[i] = fmt.Sprintf("FeatureVersion: %v", v.FeatureVersion) + i++ + fields[i] = fmt.Sprintf("ClientImpl: %v", v.ClientImpl) + i++ + fields[i] = fmt.Sprintf("SupportedVersions: %v", v.SupportedVersions) + i++ + + return fmt.Sprintf("ClientVersionNotSupportedError{%v}", strings.Join(fields[:i], ", ")) +} + +// Equals returns true if all the fields of this ClientVersionNotSupportedError match the +// provided ClientVersionNotSupportedError. +// +// This function performs a deep comparison. +func (v *ClientVersionNotSupportedError) Equals(rhs *ClientVersionNotSupportedError) bool { + if !(v.FeatureVersion == rhs.FeatureVersion) { + return false + } + if !(v.ClientImpl == rhs.ClientImpl) { + return false + } + if !(v.SupportedVersions == rhs.SupportedVersions) { + return false + } + + return true +} + +func (v *ClientVersionNotSupportedError) Error() string { + return v.String() +} + type ClusterReplicationConfiguration struct { ClusterName *string `json:"clusterName,omitempty"` } @@ -5156,6 +5372,7 @@ type ContinueAsNewWorkflowExecutionDecisionAttributes struct { FailureDetails []byte `json:"failureDetails,omitempty"` LastCompletionResult []byte `json:"lastCompletionResult,omitempty"` CronSchedule *string `json:"cronSchedule,omitempty"` + Header *Header `json:"header,omitempty"` } // ToWire translates a ContinueAsNewWorkflowExecutionDecisionAttributes struct into a Thrift-level intermediate @@ -5175,7 +5392,7 @@ type ContinueAsNewWorkflowExecutionDecisionAttributes struct { // } func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) ToWire() (wire.Value, error) { var ( - fields [12]wire.Field + fields [13]wire.Field i int = 0 w wire.Value err error @@ -5277,6 +5494,14 @@ func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) ToWire() (wire.Value, fields[i] = wire.Field{ID: 120, Value: w} i++ } + if v.Header != nil { + w, err = v.Header.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 130, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -5416,6 +5641,14 @@ func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) FromWire(w wire.Value return err } + } + case 130: + if field.Value.Type() == wire.TStruct { + v.Header, err = _Header_Read(field.Value) + if err != nil { + return err + } + } } } @@ -5430,7 +5663,7 @@ func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) String() string { return "" } - var fields [12]string + var fields [13]string i := 0 if v.WorkflowType != nil { fields[i] = fmt.Sprintf("WorkflowType: %v", v.WorkflowType) @@ -5480,6 +5713,10 @@ func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) String() string { fields[i] = fmt.Sprintf("CronSchedule: %v", *(v.CronSchedule)) i++ } + if v.Header != nil { + fields[i] = fmt.Sprintf("Header: %v", v.Header) + i++ + } return fmt.Sprintf("ContinueAsNewWorkflowExecutionDecisionAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -5535,6 +5772,9 @@ func (v *ContinueAsNewWorkflowExecutionDecisionAttributes) Equals(rhs *ContinueA if !_String_EqualsPtr(v.CronSchedule, rhs.CronSchedule) { return false } + if !((v.Header == nil && rhs.Header == nil) || (v.Header != nil && rhs.Header != nil && v.Header.Equals(rhs.Header))) { + return false + } return true } @@ -16940,12 +17180,6 @@ func (v *MarkerRecordedEventAttributes) ToWire() (wire.Value, error) { return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -func _Header_Read(w wire.Value) (*Header, error) { - var v Header - err := v.FromWire(w) - return &v, err -} - // FromWire deserializes a MarkerRecordedEventAttributes struct from its Thrift-level // representation. The Thrift-level representation may be obtained // from a ThriftRW protocol implementation. @@ -17982,6 +18216,7 @@ type PollForActivityTaskResponse struct { HeartbeatDetails []byte `json:"heartbeatDetails,omitempty"` WorkflowType *WorkflowType `json:"workflowType,omitempty"` WorkflowDomain *string `json:"workflowDomain,omitempty"` + Header *Header `json:"header,omitempty"` } // ToWire translates a PollForActivityTaskResponse struct into a Thrift-level intermediate @@ -18001,7 +18236,7 @@ type PollForActivityTaskResponse struct { // } func (v *PollForActivityTaskResponse) ToWire() (wire.Value, error) { var ( - fields [15]wire.Field + fields [16]wire.Field i int = 0 w wire.Value err error @@ -18127,6 +18362,14 @@ func (v *PollForActivityTaskResponse) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 160, Value: w} i++ } + if v.Header != nil { + w, err = v.Header.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 170, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -18290,6 +18533,14 @@ func (v *PollForActivityTaskResponse) FromWire(w wire.Value) error { return err } + } + case 170: + if field.Value.Type() == wire.TStruct { + v.Header, err = _Header_Read(field.Value) + if err != nil { + return err + } + } } } @@ -18304,7 +18555,7 @@ func (v *PollForActivityTaskResponse) String() string { return "" } - var fields [15]string + var fields [16]string i := 0 if v.TaskToken != nil { fields[i] = fmt.Sprintf("TaskToken: %v", v.TaskToken) @@ -18366,6 +18617,10 @@ func (v *PollForActivityTaskResponse) String() string { fields[i] = fmt.Sprintf("WorkflowDomain: %v", *(v.WorkflowDomain)) i++ } + if v.Header != nil { + fields[i] = fmt.Sprintf("Header: %v", v.Header) + i++ + } return fmt.Sprintf("PollForActivityTaskResponse{%v}", strings.Join(fields[:i], ", ")) } @@ -18420,6 +18675,9 @@ func (v *PollForActivityTaskResponse) Equals(rhs *PollForActivityTaskResponse) b if !_String_EqualsPtr(v.WorkflowDomain, rhs.WorkflowDomain) { return false } + if !((v.Header == nil && rhs.Header == nil) || (v.Header != nil && rhs.Header != nil && v.Header.Equals(rhs.Header))) { + return false + } return true } @@ -25943,6 +26201,7 @@ type ScheduleActivityTaskDecisionAttributes struct { StartToCloseTimeoutSeconds *int32 `json:"startToCloseTimeoutSeconds,omitempty"` HeartbeatTimeoutSeconds *int32 `json:"heartbeatTimeoutSeconds,omitempty"` RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` + Header *Header `json:"header,omitempty"` } // ToWire translates a ScheduleActivityTaskDecisionAttributes struct into a Thrift-level intermediate @@ -25962,7 +26221,7 @@ type ScheduleActivityTaskDecisionAttributes struct { // } func (v *ScheduleActivityTaskDecisionAttributes) ToWire() (wire.Value, error) { var ( - fields [10]wire.Field + fields [11]wire.Field i int = 0 w wire.Value err error @@ -26048,6 +26307,14 @@ func (v *ScheduleActivityTaskDecisionAttributes) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 70, Value: w} i++ } + if v.Header != nil { + w, err = v.Header.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 80, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -26165,6 +26432,14 @@ func (v *ScheduleActivityTaskDecisionAttributes) FromWire(w wire.Value) error { return err } + } + case 80: + if field.Value.Type() == wire.TStruct { + v.Header, err = _Header_Read(field.Value) + if err != nil { + return err + } + } } } @@ -26179,7 +26454,7 @@ func (v *ScheduleActivityTaskDecisionAttributes) String() string { return "" } - var fields [10]string + var fields [11]string i := 0 if v.ActivityId != nil { fields[i] = fmt.Sprintf("ActivityId: %v", *(v.ActivityId)) @@ -26221,6 +26496,10 @@ func (v *ScheduleActivityTaskDecisionAttributes) String() string { fields[i] = fmt.Sprintf("RetryPolicy: %v", v.RetryPolicy) i++ } + if v.Header != nil { + fields[i] = fmt.Sprintf("Header: %v", v.Header) + i++ + } return fmt.Sprintf("ScheduleActivityTaskDecisionAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -26260,6 +26539,9 @@ func (v *ScheduleActivityTaskDecisionAttributes) Equals(rhs *ScheduleActivityTas if !((v.RetryPolicy == nil && rhs.RetryPolicy == nil) || (v.RetryPolicy != nil && rhs.RetryPolicy != nil && v.RetryPolicy.Equals(rhs.RetryPolicy))) { return false } + if !((v.Header == nil && rhs.Header == nil) || (v.Header != nil && rhs.Header != nil && v.Header.Equals(rhs.Header))) { + return false + } return true } @@ -28307,6 +28589,7 @@ type StartChildWorkflowExecutionDecisionAttributes struct { WorkflowIdReusePolicy *WorkflowIdReusePolicy `json:"workflowIdReusePolicy,omitempty"` RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` CronSchedule *string `json:"cronSchedule,omitempty"` + Header *Header `json:"header,omitempty"` } // ToWire translates a StartChildWorkflowExecutionDecisionAttributes struct into a Thrift-level intermediate @@ -28326,7 +28609,7 @@ type StartChildWorkflowExecutionDecisionAttributes struct { // } func (v *StartChildWorkflowExecutionDecisionAttributes) ToWire() (wire.Value, error) { var ( - fields [12]wire.Field + fields [13]wire.Field i int = 0 w wire.Value err error @@ -28428,6 +28711,14 @@ func (v *StartChildWorkflowExecutionDecisionAttributes) ToWire() (wire.Value, er fields[i] = wire.Field{ID: 120, Value: w} i++ } + if v.Header != nil { + w, err = v.Header.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 130, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -28569,6 +28860,14 @@ func (v *StartChildWorkflowExecutionDecisionAttributes) FromWire(w wire.Value) e return err } + } + case 130: + if field.Value.Type() == wire.TStruct { + v.Header, err = _Header_Read(field.Value) + if err != nil { + return err + } + } } } @@ -28583,7 +28882,7 @@ func (v *StartChildWorkflowExecutionDecisionAttributes) String() string { return "" } - var fields [12]string + var fields [13]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -28633,6 +28932,10 @@ func (v *StartChildWorkflowExecutionDecisionAttributes) String() string { fields[i] = fmt.Sprintf("CronSchedule: %v", *(v.CronSchedule)) i++ } + if v.Header != nil { + fields[i] = fmt.Sprintf("Header: %v", v.Header) + i++ + } return fmt.Sprintf("StartChildWorkflowExecutionDecisionAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -28688,6 +28991,9 @@ func (v *StartChildWorkflowExecutionDecisionAttributes) Equals(rhs *StartChildWo if !_String_EqualsPtr(v.CronSchedule, rhs.CronSchedule) { return false } + if !((v.Header == nil && rhs.Header == nil) || (v.Header != nil && rhs.Header != nil && v.Header.Equals(rhs.Header))) { + return false + } return true } @@ -29100,6 +29406,7 @@ type StartChildWorkflowExecutionInitiatedEventAttributes struct { WorkflowIdReusePolicy *WorkflowIdReusePolicy `json:"workflowIdReusePolicy,omitempty"` RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` CronSchedule *string `json:"cronSchedule,omitempty"` + Header *Header `json:"header,omitempty"` } // ToWire translates a StartChildWorkflowExecutionInitiatedEventAttributes struct into a Thrift-level intermediate @@ -29119,7 +29426,7 @@ type StartChildWorkflowExecutionInitiatedEventAttributes struct { // } func (v *StartChildWorkflowExecutionInitiatedEventAttributes) ToWire() (wire.Value, error) { var ( - fields [13]wire.Field + fields [14]wire.Field i int = 0 w wire.Value err error @@ -29229,6 +29536,14 @@ func (v *StartChildWorkflowExecutionInitiatedEventAttributes) ToWire() (wire.Val fields[i] = wire.Field{ID: 130, Value: w} i++ } + if v.Header != nil { + w, err = v.Header.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 140, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -29374,6 +29689,14 @@ func (v *StartChildWorkflowExecutionInitiatedEventAttributes) FromWire(w wire.Va return err } + } + case 140: + if field.Value.Type() == wire.TStruct { + v.Header, err = _Header_Read(field.Value) + if err != nil { + return err + } + } } } @@ -29388,7 +29711,7 @@ func (v *StartChildWorkflowExecutionInitiatedEventAttributes) String() string { return "" } - var fields [13]string + var fields [14]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -29442,6 +29765,10 @@ func (v *StartChildWorkflowExecutionInitiatedEventAttributes) String() string { fields[i] = fmt.Sprintf("CronSchedule: %v", *(v.CronSchedule)) i++ } + if v.Header != nil { + fields[i] = fmt.Sprintf("Header: %v", v.Header) + i++ + } return fmt.Sprintf("StartChildWorkflowExecutionInitiatedEventAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -29490,6 +29817,9 @@ func (v *StartChildWorkflowExecutionInitiatedEventAttributes) Equals(rhs *StartC if !_String_EqualsPtr(v.CronSchedule, rhs.CronSchedule) { return false } + if !((v.Header == nil && rhs.Header == nil) || (v.Header != nil && rhs.Header != nil && v.Header.Equals(rhs.Header))) { + return false + } return true } @@ -29893,6 +30223,7 @@ type StartWorkflowExecutionRequest struct { RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` CronSchedule *string `json:"cronSchedule,omitempty"` Memo *Memo `json:"memo,omitempty"` + Header *Header `json:"header,omitempty"` } // ToWire translates a StartWorkflowExecutionRequest struct into a Thrift-level intermediate @@ -29912,7 +30243,7 @@ type StartWorkflowExecutionRequest struct { // } func (v *StartWorkflowExecutionRequest) ToWire() (wire.Value, error) { var ( - fields [14]wire.Field + fields [15]wire.Field i int = 0 w wire.Value err error @@ -30030,6 +30361,14 @@ func (v *StartWorkflowExecutionRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 140, Value: w} i++ } + if v.Header != nil { + w, err = v.Header.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 150, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -30185,6 +30524,14 @@ func (v *StartWorkflowExecutionRequest) FromWire(w wire.Value) error { return err } + } + case 150: + if field.Value.Type() == wire.TStruct { + v.Header, err = _Header_Read(field.Value) + if err != nil { + return err + } + } } } @@ -30199,7 +30546,7 @@ func (v *StartWorkflowExecutionRequest) String() string { return "" } - var fields [14]string + var fields [15]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) @@ -30257,6 +30604,10 @@ func (v *StartWorkflowExecutionRequest) String() string { fields[i] = fmt.Sprintf("Memo: %v", v.Memo) i++ } + if v.Header != nil { + fields[i] = fmt.Sprintf("Header: %v", v.Header) + i++ + } return fmt.Sprintf("StartWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -30308,6 +30659,9 @@ func (v *StartWorkflowExecutionRequest) Equals(rhs *StartWorkflowExecutionReques if !((v.Memo == nil && rhs.Memo == nil) || (v.Memo != nil && rhs.Memo != nil && v.Memo.Equals(rhs.Memo))) { return false } + if !((v.Header == nil && rhs.Header == nil) || (v.Header != nil && rhs.Header != nil && v.Header.Equals(rhs.Header))) { + return false + } return true } @@ -34561,6 +34915,7 @@ type WorkflowExecutionContinuedAsNewEventAttributes struct { FailureReason *string `json:"failureReason,omitempty"` FailureDetails []byte `json:"failureDetails,omitempty"` LastCompletionResult []byte `json:"lastCompletionResult,omitempty"` + Header *Header `json:"header,omitempty"` } // ToWire translates a WorkflowExecutionContinuedAsNewEventAttributes struct into a Thrift-level intermediate @@ -34580,7 +34935,7 @@ type WorkflowExecutionContinuedAsNewEventAttributes struct { // } func (v *WorkflowExecutionContinuedAsNewEventAttributes) ToWire() (wire.Value, error) { var ( - fields [12]wire.Field + fields [13]wire.Field i int = 0 w wire.Value err error @@ -34682,6 +35037,14 @@ func (v *WorkflowExecutionContinuedAsNewEventAttributes) ToWire() (wire.Value, e fields[i] = wire.Field{ID: 120, Value: w} i++ } + if v.Header != nil { + w, err = v.Header.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 130, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -34817,6 +35180,14 @@ func (v *WorkflowExecutionContinuedAsNewEventAttributes) FromWire(w wire.Value) return err } + } + case 130: + if field.Value.Type() == wire.TStruct { + v.Header, err = _Header_Read(field.Value) + if err != nil { + return err + } + } } } @@ -34831,7 +35202,7 @@ func (v *WorkflowExecutionContinuedAsNewEventAttributes) String() string { return "" } - var fields [12]string + var fields [13]string i := 0 if v.NewExecutionRunId != nil { fields[i] = fmt.Sprintf("NewExecutionRunId: %v", *(v.NewExecutionRunId)) @@ -34881,6 +35252,10 @@ func (v *WorkflowExecutionContinuedAsNewEventAttributes) String() string { fields[i] = fmt.Sprintf("LastCompletionResult: %v", v.LastCompletionResult) i++ } + if v.Header != nil { + fields[i] = fmt.Sprintf("Header: %v", v.Header) + i++ + } return fmt.Sprintf("WorkflowExecutionContinuedAsNewEventAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -34926,6 +35301,9 @@ func (v *WorkflowExecutionContinuedAsNewEventAttributes) Equals(rhs *WorkflowExe if !((v.LastCompletionResult == nil && rhs.LastCompletionResult == nil) || (v.LastCompletionResult != nil && rhs.LastCompletionResult != nil && bytes.Equal(v.LastCompletionResult, rhs.LastCompletionResult))) { return false } + if !((v.Header == nil && rhs.Header == nil) || (v.Header != nil && rhs.Header != nil && v.Header.Equals(rhs.Header))) { + return false + } return true } @@ -35882,6 +36260,7 @@ type WorkflowExecutionStartedEventAttributes struct { CronSchedule *string `json:"cronSchedule,omitempty"` FirstDecisionTaskBackoffSeconds *int32 `json:"firstDecisionTaskBackoffSeconds,omitempty"` Memo *Memo `json:"memo,omitempty"` + Header *Header `json:"header,omitempty"` } // ToWire translates a WorkflowExecutionStartedEventAttributes struct into a Thrift-level intermediate @@ -35901,7 +36280,7 @@ type WorkflowExecutionStartedEventAttributes struct { // } func (v *WorkflowExecutionStartedEventAttributes) ToWire() (wire.Value, error) { var ( - fields [21]wire.Field + fields [22]wire.Field i int = 0 w wire.Value err error @@ -36075,6 +36454,14 @@ func (v *WorkflowExecutionStartedEventAttributes) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 120, Value: w} i++ } + if v.Header != nil { + w, err = v.Header.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 130, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -36294,6 +36681,14 @@ func (v *WorkflowExecutionStartedEventAttributes) FromWire(w wire.Value) error { return err } + } + case 130: + if field.Value.Type() == wire.TStruct { + v.Header, err = _Header_Read(field.Value) + if err != nil { + return err + } + } } } @@ -36308,7 +36703,7 @@ func (v *WorkflowExecutionStartedEventAttributes) String() string { return "" } - var fields [21]string + var fields [22]string i := 0 if v.WorkflowType != nil { fields[i] = fmt.Sprintf("WorkflowType: %v", v.WorkflowType) @@ -36394,6 +36789,10 @@ func (v *WorkflowExecutionStartedEventAttributes) String() string { fields[i] = fmt.Sprintf("Memo: %v", v.Memo) i++ } + if v.Header != nil { + fields[i] = fmt.Sprintf("Header: %v", v.Header) + i++ + } return fmt.Sprintf("WorkflowExecutionStartedEventAttributes{%v}", strings.Join(fields[:i], ", ")) } @@ -36466,6 +36865,9 @@ func (v *WorkflowExecutionStartedEventAttributes) Equals(rhs *WorkflowExecutionS if !((v.Memo == nil && rhs.Memo == nil) || (v.Memo != nil && rhs.Memo != nil && v.Memo.Equals(rhs.Memo))) { return false } + if !((v.Header == nil && rhs.Header == nil) || (v.Header != nil && rhs.Header != nil && v.Header.Equals(rhs.Header))) { + return false + } return true } diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index d12da3df1..68a31e1a0 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -77,6 +77,12 @@ exception RetryTaskError { 5: optional i64 (js.type = "Long") nextEventId } +exception ClientVersionNotSupportedError { + 1: required string featureVersion + 2: required string clientImpl + 3: required string supportedVersions +} + enum WorkflowIdReusePolicy { /* * allow start a workflow execution using the same workflow ID, @@ -327,6 +333,7 @@ struct ScheduleActivityTaskDecisionAttributes { 55: optional i32 startToCloseTimeoutSeconds 60: optional i32 heartbeatTimeoutSeconds 70: optional RetryPolicy retryPolicy + 80: optional Header header } struct RequestCancelActivityTaskDecisionAttributes { @@ -391,6 +398,7 @@ struct ContinueAsNewWorkflowExecutionDecisionAttributes { 100: optional binary failureDetails 110: optional binary lastCompletionResult 120: optional string cronSchedule + 130: optional Header header } struct StartChildWorkflowExecutionDecisionAttributes { @@ -406,6 +414,7 @@ struct StartChildWorkflowExecutionDecisionAttributes { 100: optional WorkflowIdReusePolicy workflowIdReusePolicy 110: optional RetryPolicy retryPolicy 120: optional string cronSchedule + 130: optional Header header } struct Decision { @@ -446,6 +455,7 @@ struct WorkflowExecutionStartedEventAttributes { 100: optional string cronSchedule 110: optional i32 firstDecisionTaskBackoffSeconds 120: optional Memo memo + 130: optional Header header } struct WorkflowExecutionCompletedEventAttributes { @@ -482,6 +492,7 @@ struct WorkflowExecutionContinuedAsNewEventAttributes { 100: optional string failureReason 110: optional binary failureDetails 120: optional binary lastCompletionResult + 130: optional Header header } struct DecisionTaskScheduledEventAttributes { @@ -535,6 +546,7 @@ struct ActivityTaskScheduledEventAttributes { 60: optional i32 heartbeatTimeoutSeconds 90: optional i64 (js.type = "Long") decisionTaskCompletedEventId 110: optional RetryPolicy retryPolicy + 120: optional Header header } struct ActivityTaskStartedEventAttributes { @@ -704,6 +716,7 @@ struct StartChildWorkflowExecutionInitiatedEventAttributes { 110: optional WorkflowIdReusePolicy workflowIdReusePolicy 120: optional RetryPolicy retryPolicy 130: optional string cronSchedule + 140: optional Header header } struct StartChildWorkflowExecutionFailedEventAttributes { @@ -721,6 +734,7 @@ struct ChildWorkflowExecutionStartedEventAttributes { 20: optional i64 (js.type = "Long") initiatedEventId 30: optional WorkflowExecution workflowExecution 40: optional WorkflowType workflowType + 50: optional Header header } struct ChildWorkflowExecutionCompletedEventAttributes { @@ -943,6 +957,7 @@ struct StartWorkflowExecutionRequest { 120: optional RetryPolicy retryPolicy 130: optional string cronSchedule 140: optional Memo memo + 150: optional Header header } struct StartWorkflowExecutionResponse { @@ -1019,6 +1034,7 @@ struct PollForActivityTaskResponse { 140: optional binary heartbeatDetails 150: optional WorkflowType workflowType 160: optional string workflowDomain + 170: optional Header header } struct RecordActivityTaskHeartbeatRequest { diff --git a/internal/activity.go b/internal/activity.go index e6bd3cb32..8df6fd404 100644 --- a/internal/activity.go +++ b/internal/activity.go @@ -311,7 +311,7 @@ func WithActivityTask( Name: *task.WorkflowType.Name, }, workflowDomain: *task.WorkflowDomain, - workerStopChannel: workerStopChannel, + workerStopChannel: workerStopChannel, }) } diff --git a/internal/context.go b/internal/context.go index 8ed09c857..588115779 100644 --- a/internal/context.go +++ b/internal/context.go @@ -27,6 +27,10 @@ import ( "go.uber.org/cadence/.gen/go/shared" ) +const ( + headerContextKey contextKey = "headerKey" +) + // Context is a clone of context.Context with Done() returning Channel instead // of native channel. // A Context carries a deadline, a cancellation signal, and other values across diff --git a/internal/internal_event_handlers.go b/internal/internal_event_handlers.go index 634f83755..ba750f3b2 100644 --- a/internal/internal_event_handlers.go +++ b/internal/internal_event_handlers.go @@ -815,7 +815,7 @@ func (weh *workflowExecutionEventHandlerImpl) handleWorkflowExecutionStarted( } // Invoke the workflow. - weh.workflowDefinition.Execute(weh, attributes.Input) + weh.workflowDefinition.Execute(weh, attributes.Header.Fields, attributes.Input) return nil } diff --git a/internal/internal_worker_base.go b/internal/internal_worker_base.go index 23c071abb..8652de803 100644 --- a/internal/internal_worker_base.go +++ b/internal/internal_worker_base.go @@ -85,7 +85,7 @@ type ( // WorkflowDefinition wraps the code that can execute a workflow. workflowDefinition interface { - Execute(env workflowEnvironment, input []byte) + Execute(env workflowEnvironment, headers map[string][]byte, input []byte) // Called for each non timed out startDecision event. // Executed after all history events since the previous decision are applied to workflowDefinition OnDecisionTaskStarted() diff --git a/internal/internal_workflow.go b/internal/internal_workflow.go index f79707fb0..f99cd9206 100644 --- a/internal/internal_workflow.go +++ b/internal/internal_workflow.go @@ -397,7 +397,7 @@ func newWorkflowContext(env workflowEnvironment) Context { return rootCtx } -func (d *syncWorkflowDefinition) Execute(env workflowEnvironment, input []byte) { +func (d *syncWorkflowDefinition) Execute(env workflowEnvironment, header map[string][]byte, input []byte) { dispatcher, rootCtx := newDispatcher(newWorkflowContext(env), func(ctx Context) { r := &workflowResult{} @@ -411,6 +411,9 @@ func (d *syncWorkflowDefinition) Execute(env workflowEnvironment, input []byte) rpp := getWorkflowResultPointerPointer(ctx) *rpp = r }) + + // Add the header information to the Context passed in + rootCtx = WithValue(rootCtx, headerContextKey, header) d.rootCtx, d.cancel = WithCancel(rootCtx) d.dispatcher = dispatcher diff --git a/internal/internal_workflow_client.go b/internal/internal_workflow_client.go index b33a3ef8a..04ccf3063 100644 --- a/internal/internal_workflow_client.go +++ b/internal/internal_workflow_client.go @@ -172,6 +172,7 @@ func (wc *workflowClient) StartWorkflow( return nil, err } + // run propagators to extract information about tracing and other stuff, store in headers field startRequest := &s.StartWorkflowExecutionRequest{ Domain: common.StringPtr(wc.domain), RequestId: common.StringPtr(uuid.New()), diff --git a/internal/internal_workflow_testsuite.go b/internal/internal_workflow_testsuite.go index caea98207..f8d96f5cd 100644 --- a/internal/internal_workflow_testsuite.go +++ b/internal/internal_workflow_testsuite.go @@ -408,7 +408,7 @@ func (env *testWorkflowEnvironmentImpl) executeWorkflowInternal(delayStart time. // In case of child workflow, this executeWorkflowInternal() is run in separate goroutinue, so use postCallback // to make sure workflowDef.Execute() is run in main loop. env.postCallback(func() { - env.workflowDef.Execute(env, input) + env.workflowDef.Execute(env, map[string][]byte{}, input) // kick off first decision task to start the workflow if delayStart == 0 { env.startDecisionTask() From d7861fc149278ac48aad0af147fd6d05d6847979 Mon Sep 17 00:00:00 2001 From: Shreyas Srivatsan Date: Mon, 29 Apr 2019 10:41:37 -0700 Subject: [PATCH 02/11] fixup header logic --- internal/internal_event_handlers.go | 8 +++++++- internal/internal_workflow.go | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/internal_event_handlers.go b/internal/internal_event_handlers.go index ba750f3b2..2b7993c92 100644 --- a/internal/internal_event_handlers.go +++ b/internal/internal_event_handlers.go @@ -814,8 +814,14 @@ func (weh *workflowExecutionEventHandlerImpl) handleWorkflowExecutionStarted( return err } + // Extract the headers from the attributes + var headers map[string][]byte + if attributes.Header != nil { + headers = attributes.Header.Fields + } + // Invoke the workflow. - weh.workflowDefinition.Execute(weh, attributes.Header.Fields, attributes.Input) + weh.workflowDefinition.Execute(weh, headers, attributes.Input) return nil } diff --git a/internal/internal_workflow.go b/internal/internal_workflow.go index f99cd9206..a008bfcee 100644 --- a/internal/internal_workflow.go +++ b/internal/internal_workflow.go @@ -413,7 +413,9 @@ func (d *syncWorkflowDefinition) Execute(env workflowEnvironment, header map[str }) // Add the header information to the Context passed in - rootCtx = WithValue(rootCtx, headerContextKey, header) + if len(header) > 0 { + rootCtx = WithValue(rootCtx, headerContextKey, header) + } d.rootCtx, d.cancel = WithCancel(rootCtx) d.dispatcher = dispatcher From 59f6a5a69ad56854f5274a66cbfda96daa50173d Mon Sep 17 00:00:00 2001 From: Shreyas Srivatsan Date: Mon, 29 Apr 2019 22:43:30 -0700 Subject: [PATCH 03/11] header support --- internal/activity.go | 2 +- internal/client.go | 22 +-- internal/context.go | 17 ++- internal/headers.go | 176 ++++++++++++++++++++++++ internal/headers_test.go | 35 +++++ internal/internal_event_handlers.go | 21 +-- internal/internal_task_handlers.go | 47 ++++--- internal/internal_worker.go | 3 + internal/internal_worker_base.go | 4 +- internal/internal_workflow.go | 13 +- internal/internal_workflow_client.go | 26 +++- internal/internal_workflow_testsuite.go | 6 +- internal/worker.go | 7 +- internal/workflow.go | 7 + 14 files changed, 331 insertions(+), 55 deletions(-) create mode 100644 internal/headers.go create mode 100644 internal/headers_test.go diff --git a/internal/activity.go b/internal/activity.go index 8df6fd404..e6bd3cb32 100644 --- a/internal/activity.go +++ b/internal/activity.go @@ -311,7 +311,7 @@ func WithActivityTask( Name: *task.WorkflowType.Name, }, workflowDomain: *task.WorkflowDomain, - workerStopChannel: workerStopChannel, + workerStopChannel: workerStopChannel, }) } diff --git a/internal/client.go b/internal/client.go index a50480a48..46c29b88e 100644 --- a/internal/client.go +++ b/internal/client.go @@ -243,9 +243,10 @@ type ( // ClientOptions are optional parameters for Client creation. ClientOptions struct { - MetricsScope tally.Scope - Identity string - DataConverter encoded.DataConverter + MetricsScope tally.Scope + Identity string + DataConverter encoded.DataConverter + ContextPropagators []ContextPropagator } // StartWorkflowOptions configuration parameters for starting a workflow execution. @@ -401,12 +402,17 @@ func NewClient(service workflowserviceclient.Interface, domain string, options * } else { dataConverter = getDefaultDataConverter() } + var contextPropagators []ContextPropagator + if options != nil { + contextPropagators = options.ContextPropagators + } return &workflowClient{ - workflowService: metrics.NewWorkflowServiceWrapper(service, metricScope), - domain: domain, - metricsScope: metrics.NewTaggedScope(metricScope), - identity: identity, - dataConverter: dataConverter, + workflowService: metrics.NewWorkflowServiceWrapper(service, metricScope), + domain: domain, + metricsScope: metrics.NewTaggedScope(metricScope), + identity: identity, + dataConverter: dataConverter, + contextPropagators: contextPropagators, } } diff --git a/internal/context.go b/internal/context.go index 588115779..152a86af3 100644 --- a/internal/context.go +++ b/internal/context.go @@ -24,12 +24,11 @@ import ( "fmt" "time" + "github.com/opentracing/opentracing-go" "go.uber.org/cadence/.gen/go/shared" ) -const ( - headerContextKey contextKey = "headerKey" -) +const activeSpanKey contextKey = "activeSpanKey" // Context is a clone of context.Context with Done() returning Channel instead // of native channel. @@ -423,3 +422,15 @@ func (c *valueCtx) Value(key interface{}) interface{} { } return c.Context.Value(key) } + +func spanFromContext(ctx Context) opentracing.Span { + val := ctx.Value(activeSpanKey) + if sp, ok := val.(opentracing.Span); ok { + return sp + } + return nil +} + +func contextWithSpan(ctx Context, span opentracing.Span) Context { + return WithValue(ctx, activeSpanKey, span) +} diff --git a/internal/headers.go b/internal/headers.go new file mode 100644 index 000000000..82f6d8db2 --- /dev/null +++ b/internal/headers.go @@ -0,0 +1,176 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package internal + +import ( + "context" + + "github.com/opentracing/opentracing-go" + "go.uber.org/cadence/.gen/go/shared" + "go.uber.org/cadence/encoded" +) + +// HeaderWriter is an interface to write information to cadence headers +type HeaderWriter interface { + Set(string, []byte) +} + +// HeaderReader is an interface to read information from cadence headers +type HeaderReader interface { + ForEachKey(handler func(string, []byte) error) error +} + +// ContextPropagator is an interface that determins what information from +// context to pass along +type ContextPropagator interface { + // Inject injects information from a Go Context into headers + Inject(context.Context, HeaderWriter) error + + // Extract extracts context information from headers and returns a context + // object + Extract(context.Context, HeaderReader) (context.Context, error) + + // InjectFromWorkflow injects information from workflow context into headers + InjectFromWorkflow(Context, HeaderWriter) error + + // ExtractToWorkflow extracts context information from headers and returns + // a workflow context + ExtractToWorkflow(Context, HeaderReader) (Context, error) +} + +// NewTracingContextPropagator returns new tracing context propagator object +func NewTracingContextPropagator(dataConverter encoded.DataConverter) ContextPropagator { + if dataConverter == nil { + dataConverter = getDefaultDataConverter() + } + return &tracingContextPropagator{dataConverter} +} + +const tracingKey = "tracingContextKey" + +type tracingContextPropagator struct { + converter encoded.DataConverter +} + +func (t *tracingContextPropagator) Inject( + ctx context.Context, + hw HeaderWriter, +) error { + // retrieve span from context object + span := opentracing.SpanFromContext(ctx) + + // marshal span object + data, err := t.converter.ToData(span) + if err != nil { + return err + } + hw.Set(tracingKey, data) + return nil +} + +func (t *tracingContextPropagator) Extract( + ctx context.Context, + hr HeaderReader, +) (context.Context, error) { + err := hr.ForEachKey(func(key string, value []byte) error { + if key == tracingKey { + var span opentracing.Span + if err := t.converter.FromData(value, &span); err != nil { + return err + } + ctx = opentracing.ContextWithSpan(ctx, span) + return nil + } + return nil + }) + if err != nil { + return nil, err + } + return ctx, nil +} + +func (t *tracingContextPropagator) InjectFromWorkflow( + ctx Context, + hw HeaderWriter, +) error { + // retrieve span from context object + span := spanFromContext(ctx) + + // marshal span object + data, err := t.converter.ToData(span) + if err != nil { + return err + } + hw.Set(tracingKey, data) + return nil +} + +func (t *tracingContextPropagator) ExtractToWorkflow( + ctx Context, + hr HeaderReader, +) (Context, error) { + err := hr.ForEachKey(func(key string, value []byte) error { + if key == tracingKey { + var span opentracing.Span + if err := t.converter.FromData(value, &span); err != nil { + return err + } + ctx = contextWithSpan(ctx, span) + return nil + } + return nil + }) + if err != nil { + return nil, err + } + return ctx, nil +} + +type headerReader struct { + header *shared.Header +} + +func (hr *headerReader) ForEachKey(handler func(string, []byte) error) error { + for key, value := range hr.header.Fields { + if err := handler(key, value); err != nil { + return err + } + } + return nil +} + +// NewHeaderReader returns a header reader interface +func NewHeaderReader(header *shared.Header) HeaderReader { + return &headerReader{header} +} + +type headerWriter struct { + header *shared.Header +} + +func (hw *headerWriter) Set(key string, value []byte) { + hw.header.Fields[key] = value +} + +// NewHeaderWriter returns a header writer interface +func NewHeaderWriter(header *shared.Header) HeaderWriter { + return &headerWriter{header} +} diff --git a/internal/headers_test.go b/internal/headers_test.go new file mode 100644 index 000000000..cbd3a5342 --- /dev/null +++ b/internal/headers_test.go @@ -0,0 +1,35 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package internal + +import "testing" + +func TestHeaderWriter(t *testing.T) { + +} + +func TestHeaderReader(t *testing.T) { + +} + +func TestTracingContextPropagator(t *testing.T) { + +} diff --git a/internal/internal_event_handlers.go b/internal/internal_event_handlers.go index 2b7993c92..ae7497d35 100644 --- a/internal/internal_event_handlers.go +++ b/internal/internal_event_handlers.go @@ -106,9 +106,10 @@ type ( isReplay bool // flag to indicate if workflow is in replay mode enableLoggingInReplay bool // flag to indicate if workflow should enable logging in replay mode - metricsScope tally.Scope - hostEnv *hostEnvImpl - dataConverter encoded.DataConverter + metricsScope tally.Scope + hostEnv *hostEnvImpl + dataConverter encoded.DataConverter + contextPropagators []ContextPropagator } localActivityTask struct { @@ -170,6 +171,7 @@ func newWorkflowExecutionEventHandler( scope tally.Scope, hostEnv *hostEnvImpl, dataConverter encoded.DataConverter, + contextPropagators []ContextPropagator, ) workflowExecutionEventHandler { context := &workflowEnvironmentImpl{ workflowInfo: workflowInfo, @@ -183,6 +185,7 @@ func newWorkflowExecutionEventHandler( enableLoggingInReplay: enableLoggingInReplay, hostEnv: hostEnv, dataConverter: dataConverter, + contextPropagators: contextPropagators, } context.logger = logger.With( zapcore.Field{Key: tagWorkflowType, Type: zapcore.StringType, String: workflowInfo.WorkflowType.Name}, @@ -339,6 +342,10 @@ func (wc *workflowEnvironmentImpl) GetDataConverter() encoded.DataConverter { return wc.dataConverter } +func (wc *workflowEnvironmentImpl) GetContextPropagators() []ContextPropagator { + return wc.contextPropagators +} + func (wc *workflowEnvironmentImpl) IsReplaying() bool { return wc.isReplay } @@ -814,14 +821,8 @@ func (weh *workflowExecutionEventHandlerImpl) handleWorkflowExecutionStarted( return err } - // Extract the headers from the attributes - var headers map[string][]byte - if attributes.Header != nil { - headers = attributes.Header.Fields - } - // Invoke the workflow. - weh.workflowDefinition.Execute(weh, headers, attributes.Input) + weh.workflowDefinition.Execute(weh, attributes.Header, attributes.Input) return nil } diff --git a/internal/internal_task_handlers.go b/internal/internal_task_handlers.go index f65c4ef7b..d4cf277d7 100644 --- a/internal/internal_task_handlers.go +++ b/internal/internal_task_handlers.go @@ -118,21 +118,23 @@ type ( laTunnel *localActivityTunnel nonDeterministicWorkflowPolicy NonDeterministicWorkflowPolicy dataConverter encoded.DataConverter + contextPropagators []ContextPropagator } activityProvider func(name string) activity // activityTaskHandlerImpl is the implementation of ActivityTaskHandler activityTaskHandlerImpl struct { - taskListName string - identity string - service workflowserviceclient.Interface - metricsScope *metrics.TaggedScope - logger *zap.Logger - userContext context.Context - hostEnv *hostEnvImpl - activityProvider activityProvider - dataConverter encoded.DataConverter - workerStopCh <-chan struct{} + taskListName string + identity string + service workflowserviceclient.Interface + metricsScope *metrics.TaggedScope + logger *zap.Logger + userContext context.Context + hostEnv *hostEnvImpl + activityProvider activityProvider + dataConverter encoded.DataConverter + workerStopCh <-chan struct{} + contextPropagators []ContextPropagator } // history wrapper method to help information about events. @@ -320,6 +322,7 @@ func newWorkflowTaskHandler( hostEnv: hostEnv, nonDeterministicWorkflowPolicy: params.NonDeterministicWorkflowPolicy, dataConverter: params.DataConverter, + contextPropagators: params.ContextPropagators, } } @@ -468,7 +471,8 @@ func (w *workflowExecutionContextImpl) createEventHandler() { w.wth.enableLoggingInReplay, w.wth.metricsScope, w.wth.hostEnv, - w.wth.dataConverter).(*workflowExecutionEventHandlerImpl) + w.wth.dataConverter, + w.wth.contextPropagators).(*workflowExecutionEventHandlerImpl) } func resetHistory(task *s.PollForDecisionTaskResponse, historyIterator HistoryIterator) (*s.History, error) { @@ -1362,16 +1366,17 @@ func newActivityTaskHandlerWithCustomProvider( activityProvider activityProvider, ) ActivityTaskHandler { return &activityTaskHandlerImpl{ - taskListName: params.TaskList, - identity: params.Identity, - service: service, - logger: params.Logger, - metricsScope: metrics.NewTaggedScope(params.MetricsScope), - userContext: params.UserContext, - hostEnv: env, - activityProvider: activityProvider, - dataConverter: params.DataConverter, - workerStopCh: params.WorkerStopChannel, + taskListName: params.TaskList, + identity: params.Identity, + service: service, + logger: params.Logger, + metricsScope: metrics.NewTaggedScope(params.MetricsScope), + userContext: params.UserContext, + hostEnv: env, + activityProvider: activityProvider, + dataConverter: params.DataConverter, + workerStopCh: params.WorkerStopChannel, + contextPropagators: params.ContextPropagators, } } diff --git a/internal/internal_worker.go b/internal/internal_worker.go index efbf5435b..60af24ce7 100644 --- a/internal/internal_worker.go +++ b/internal/internal_worker.go @@ -168,6 +168,8 @@ type ( // WorkerStopChannel is a read only channel listen on worker close. The worker will close the channel before exit. WorkerStopChannel <-chan struct{} + + ContextPropagators []ContextPropagator } // defaultDataConverter uses thrift encoder/decoder when possible, for everything else use json. @@ -1032,6 +1034,7 @@ func newAggregatedWorker( DataConverter: wOptions.DataConverter, WorkerStopTimeout: wOptions.WorkerStopTimeout, WorkerStopChannel: readOnlyWorkerStopCh, + ContextPropagators: wOptions.ContextPropagators, } ensureRequiredParams(&workerParams) diff --git a/internal/internal_worker_base.go b/internal/internal_worker_base.go index 8652de803..acfeee38b 100644 --- a/internal/internal_worker_base.go +++ b/internal/internal_worker_base.go @@ -30,6 +30,7 @@ import ( "fmt" "github.com/uber-go/tally" + "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/encoded" "go.uber.org/cadence/internal/common/backoff" "go.uber.org/cadence/internal/common/metrics" @@ -81,11 +82,12 @@ type ( IsReplaying() bool MutableSideEffect(id string, f func() interface{}, equals func(a, b interface{}) bool) encoded.Value GetDataConverter() encoded.DataConverter + GetContextPropagators() []ContextPropagator } // WorkflowDefinition wraps the code that can execute a workflow. workflowDefinition interface { - Execute(env workflowEnvironment, headers map[string][]byte, input []byte) + Execute(env workflowEnvironment, header *shared.Header, input []byte) // Called for each non timed out startDecision event. // Executed after all history events since the previous decision are applied to workflowDefinition OnDecisionTaskStarted() diff --git a/internal/internal_workflow.go b/internal/internal_workflow.go index a008bfcee..8b5cbff75 100644 --- a/internal/internal_workflow.go +++ b/internal/internal_workflow.go @@ -173,6 +173,7 @@ type ( dataConverter encoded.DataConverter retryPolicy *shared.RetryPolicy cronSchedule string + contextPropagators []ContextPropagator } executeWorkflowParams struct { @@ -392,12 +393,13 @@ func newWorkflowContext(env workflowEnvironment) Context { rootCtx = WithWorkflowTaskStartToCloseTimeout(rootCtx, time.Duration(wInfo.TaskStartToCloseTimeoutSeconds)*time.Second) rootCtx = WithTaskList(rootCtx, wInfo.TaskListName) rootCtx = WithDataConverter(rootCtx, env.GetDataConverter()) + rootCtx = WithContextPropagators(rootCtx, env.GetContextPropagators()) getActivityOptions(rootCtx).OriginalTaskListName = wInfo.TaskListName return rootCtx } -func (d *syncWorkflowDefinition) Execute(env workflowEnvironment, header map[string][]byte, input []byte) { +func (d *syncWorkflowDefinition) Execute(env workflowEnvironment, header *shared.Header, input []byte) { dispatcher, rootCtx := newDispatcher(newWorkflowContext(env), func(ctx Context) { r := &workflowResult{} @@ -412,10 +414,13 @@ func (d *syncWorkflowDefinition) Execute(env workflowEnvironment, header map[str *rpp = r }) - // Add the header information to the Context passed in - if len(header) > 0 { - rootCtx = WithValue(rootCtx, headerContextKey, header) + for _, ctxProp := range env.GetContextPropagators() { + var err error + if rootCtx, err = ctxProp.ExtractToWorkflow(rootCtx, NewHeaderReader(header)); err != nil { + panic(fmt.Sprintf("Unable to propagate context %v", err)) + } } + d.rootCtx, d.cancel = WithCancel(rootCtx) d.dispatcher = dispatcher diff --git a/internal/internal_workflow_client.go b/internal/internal_workflow_client.go index 04ccf3063..171e50cc7 100644 --- a/internal/internal_workflow_client.go +++ b/internal/internal_workflow_client.go @@ -50,11 +50,12 @@ const ( type ( // workflowClient is the client for starting a workflow execution. workflowClient struct { - workflowService workflowserviceclient.Interface - domain string - metricsScope *metrics.TaggedScope - identity string - dataConverter encoded.DataConverter + workflowService workflowserviceclient.Interface + domain string + metricsScope *metrics.TaggedScope + identity string + dataConverter encoded.DataConverter + contextPropagators []ContextPropagator } // domainClient is the client for managing domains. @@ -172,6 +173,9 @@ func (wc *workflowClient) StartWorkflow( return nil, err } + // get workflow headers from the context + header := wc.getWorkflowHeader(ctx) + // run propagators to extract information about tracing and other stuff, store in headers field startRequest := &s.StartWorkflowExecutionRequest{ Domain: common.StringPtr(wc.domain), @@ -187,6 +191,7 @@ func (wc *workflowClient) StartWorkflow( RetryPolicy: convertRetryPolicy(options.RetryPolicy), CronSchedule: common.StringPtr(options.CronSchedule), Memo: memo, + Header: header, } var response *s.StartWorkflowExecutionResponse @@ -688,6 +693,17 @@ func (wc *workflowClient) DescribeTaskList(ctx context.Context, tasklist string, return resp, nil } +func (wc *workflowClient) getWorkflowHeader(ctx context.Context) *s.Header { + header := &s.Header{ + Fields: make(map[string][]byte), + } + writer := NewHeaderWriter(header) + for _, ctxProp := range wc.contextPropagators { + ctxProp.Inject(ctx, writer) + } + return header +} + // Register a domain with cadence server // The errors it can throw: // - DomainAlreadyExistsError diff --git a/internal/internal_workflow_testsuite.go b/internal/internal_workflow_testsuite.go index f8d96f5cd..3405c1db4 100644 --- a/internal/internal_workflow_testsuite.go +++ b/internal/internal_workflow_testsuite.go @@ -408,7 +408,7 @@ func (env *testWorkflowEnvironmentImpl) executeWorkflowInternal(delayStart time. // In case of child workflow, this executeWorkflowInternal() is run in separate goroutinue, so use postCallback // to make sure workflowDef.Execute() is run in main loop. env.postCallback(func() { - env.workflowDef.Execute(env, map[string][]byte{}, input) + env.workflowDef.Execute(env, &shared.Header{}, input) // kick off first decision task to start the workflow if delayStart == 0 { env.startDecisionTask() @@ -856,6 +856,10 @@ func (env *testWorkflowEnvironmentImpl) GetDataConverter() encoded.DataConverter return env.workerOptions.DataConverter } +func (env *testWorkflowEnvironmentImpl) GetContextPropagators() []ContextPropagator { + return env.workerOptions.ContextPropagators +} + func (env *testWorkflowEnvironmentImpl) ExecuteActivity(parameters executeActivityParams, callback resultHandler) *activityInfo { var activityID string if parameters.ActivityID == nil || *parameters.ActivityID == "" { diff --git a/internal/worker.go b/internal/worker.go index b17d0fe44..d7857205c 100644 --- a/internal/worker.go +++ b/internal/worker.go @@ -27,6 +27,8 @@ import ( "time" "encoding/json" + "io/ioutil" + "github.com/golang/mock/gomock" "github.com/pborman/uuid" "github.com/uber-go/tally" @@ -36,7 +38,6 @@ import ( "go.uber.org/cadence/encoded" "go.uber.org/cadence/internal/common" "go.uber.org/zap" - "io/ioutil" ) type ( @@ -163,6 +164,10 @@ type ( // Optional: worker graceful shutdown timeout // default: 0s WorkerStopTimeout time.Duration + + // Optional: Sets ContextPropagators that allows users to control the context information passed through a workflow + // default: no ContextPropagators + ContextPropagators []ContextPropagator } ) diff --git a/internal/workflow.go b/internal/workflow.go index 1c56345d9..c869d30de 100644 --- a/internal/workflow.go +++ b/internal/workflow.go @@ -846,6 +846,13 @@ func WithDataConverter(ctx Context, dc encoded.DataConverter) Context { return ctx1 } +// WithContextPropagators adds ContextPropagators to the context. +func WithContextPropagators(ctx Context, contextPropagators []ContextPropagator) Context { + ctx1 := setWorkflowEnvOptionsIfNotExist(ctx) + getWorkflowEnvOptions(ctx1).contextPropagators = contextPropagators + return ctx1 +} + // GetSignalChannel returns channel corresponding to the signal name. func GetSignalChannel(ctx Context, signalName string) Channel { return getWorkflowEnvOptions(ctx).getSignalChannel(ctx, signalName) From ecb5397066ff500c71d126a340f25e87f4dc1b3e Mon Sep 17 00:00:00 2001 From: Shreyas Srivatsan Date: Tue, 30 Apr 2019 14:30:28 -0700 Subject: [PATCH 04/11] add headers in many places --- internal/activity.go | 6 ++++-- internal/internal_activity.go | 1 + internal/internal_event_handlers.go | 1 + internal/internal_task_handlers.go | 12 +++++++++++- internal/internal_worker.go | 7 +++++++ internal/internal_workflow.go | 2 ++ internal/internal_workflow_testsuite.go | 15 ++++++++------- internal/workflow.go | 1 + 8 files changed, 35 insertions(+), 10 deletions(-) diff --git a/internal/activity.go b/internal/activity.go index e6bd3cb32..1f890e2f3 100644 --- a/internal/activity.go +++ b/internal/activity.go @@ -265,6 +265,7 @@ func WithActivityTask( scope tally.Scope, dataConverter encoded.DataConverter, workerStopChannel <-chan struct{}, + contextPropagators []ContextPropagator, ) context.Context { var deadline time.Time scheduled := time.Unix(0, task.GetScheduledTimestamp()) @@ -310,8 +311,9 @@ func WithActivityTask( workflowType: &WorkflowType{ Name: *task.WorkflowType.Name, }, - workflowDomain: *task.WorkflowDomain, - workerStopChannel: workerStopChannel, + workflowDomain: *task.WorkflowDomain, + workerStopChannel: workerStopChannel, + contextPropagators: contextPropagators, }) } diff --git a/internal/internal_activity.go b/internal/internal_activity.go index c85f51ff5..cde7b64d4 100644 --- a/internal/internal_activity.go +++ b/internal/internal_activity.go @@ -128,6 +128,7 @@ type ( workflowType *WorkflowType workflowDomain string workerStopChannel <-chan struct{} + contextPropagators []ContextPropagator } // context.WithValue need this type instead of basic type string to avoid lint error diff --git a/internal/internal_event_handlers.go b/internal/internal_event_handlers.go index ae7497d35..b9c11466d 100644 --- a/internal/internal_event_handlers.go +++ b/internal/internal_event_handlers.go @@ -304,6 +304,7 @@ func (wc *workflowEnvironmentImpl) ExecuteChildWorkflow( attributes.ChildPolicy = params.childPolicy.toThriftChildPolicyPtr() attributes.WorkflowIdReusePolicy = params.workflowIDReusePolicy.toThriftPtr() attributes.RetryPolicy = params.retryPolicy + attributes.Header = params.header if len(params.cronSchedule) > 0 { attributes.CronSchedule = common.StringPtr(params.cronSchedule) } diff --git a/internal/internal_task_handlers.go b/internal/internal_task_handlers.go index d4cf277d7..f9a241a6c 100644 --- a/internal/internal_task_handlers.go +++ b/internal/internal_task_handlers.go @@ -1288,6 +1288,7 @@ func (wth *workflowTaskHandlerImpl) completeWorkflow( TaskList: common.TaskListPtr(s.TaskList{Name: contErr.params.taskListName}), ExecutionStartToCloseTimeoutSeconds: contErr.params.executionStartToCloseTimeoutSeconds, TaskStartToCloseTimeoutSeconds: contErr.params.taskStartToCloseTimeoutSeconds, + Header: contErr.params.header, } } else if workflowContext.err != nil { // Workflow failures @@ -1536,7 +1537,7 @@ func (ath *activityTaskHandlerImpl) Execute(taskList string, t *s.PollForActivit workflowType := t.WorkflowType.GetName() activityType := t.ActivityType.GetName() metricsScope := getMetricsScopeForActivity(ath.metricsScope, workflowType, activityType) - ctx := WithActivityTask(canCtx, t, taskList, invoker, ath.logger, metricsScope, ath.dataConverter, ath.workerStopCh) + ctx := WithActivityTask(canCtx, t, taskList, invoker, ath.logger, metricsScope, ath.dataConverter, ath.workerStopCh, ath.contextPropagators) activityImplementation := ath.getActivity(activityType) if activityImplementation == nil { @@ -1561,6 +1562,15 @@ func (ath *activityTaskHandlerImpl) Execute(taskList string, t *s.PollForActivit result, err = convertActivityResultToRespondRequest(ath.identity, t.TaskToken, nil, panicErr, ath.dataConverter), nil } }() + + // propagate context information into the activity context from the headers + for _, ctxProp := range ath.contextPropagators { + var err error + if ctx, err = ctxProp.Extract(ctx, NewHeaderReader(t.Header)); err != nil { + return nil, fmt.Errorf("unable to propagate context %v", err) + } + } + info := ctx.Value(activityEnvContextKey).(*activityEnvironment) ctx, dlCancelFunc := context.WithDeadline(ctx, info.deadline) diff --git a/internal/internal_worker.go b/internal/internal_worker.go index 60af24ce7..47df4da08 100644 --- a/internal/internal_worker.go +++ b/internal/internal_worker.go @@ -788,6 +788,9 @@ func (we *workflowExecutor) Execute(ctx Context, input []byte) ([]byte, error) { // Workflow context. args := []reflect.Value{reflect.ValueOf(ctx)} + // TODO: @shreyassrivatsan add tracing support for workflow here. Mark is + // as child workflow if that is the case. + dataConverter := getWorkflowEnvOptions(ctx).dataConverter if fnType.NumIn() > 1 && isTypeByteSlice(fnType.In(1)) { // 0 - is workflow context. @@ -828,6 +831,8 @@ func (ae *activityExecutor) Execute(ctx context.Context, input []byte) ([]byte, args := []reflect.Value{} dataConverter := getDataConverterFromActivityCtx(ctx) + // TODO: @shreyassrivatsan add tracing support for activity here + // activities optionally might not take context. if fnType.NumIn() > 0 && isActivityContext(fnType.In(0)) { args = append(args, reflect.ValueOf(ctx)) @@ -861,6 +866,8 @@ func (ae *activityExecutor) executeWithActualArgsWithoutParseResult(ctx context. fnType := reflect.TypeOf(ae.fn) args := []reflect.Value{} + // TODO: @shreyassrivatsan add tracing support for activity here + // activities optionally might not take context. argsOffeset := 0 if fnType.NumIn() > 0 && isActivityContext(fnType.In(0)) { diff --git a/internal/internal_workflow.go b/internal/internal_workflow.go index 8b5cbff75..109b7afac 100644 --- a/internal/internal_workflow.go +++ b/internal/internal_workflow.go @@ -180,6 +180,7 @@ type ( workflowOptions workflowType *WorkflowType input []byte + header *shared.Header attempt int32 // used by test framework to support child workflow retry scheduledTime time.Time // used by test framework to support child workflow retry lastCompletionResult []byte // used by test framework to support cron @@ -414,6 +415,7 @@ func (d *syncWorkflowDefinition) Execute(env workflowEnvironment, header *shared *rpp = r }) + // set the information from the headers that is to be propagated in the workflow context for _, ctxProp := range env.GetContextPropagators() { var err error if rootCtx, err = ctxProp.ExtractToWorkflow(rootCtx, NewHeaderReader(header)); err != nil { diff --git a/internal/internal_workflow_testsuite.go b/internal/internal_workflow_testsuite.go index 3405c1db4..a02f90c15 100644 --- a/internal/internal_workflow_testsuite.go +++ b/internal/internal_workflow_testsuite.go @@ -1419,13 +1419,14 @@ func (m *mockWrapper) executeMockWithActualArgs(ctx interface{}, inputArgs []int func (env *testWorkflowEnvironmentImpl) newTestActivityTaskHandler(taskList string, dataConverter encoded.DataConverter) ActivityTaskHandler { wOptions := fillWorkerOptionsDefaults(env.workerOptions) params := workerExecutionParameters{ - TaskList: taskList, - Identity: wOptions.Identity, - MetricsScope: wOptions.MetricsScope, - Logger: wOptions.Logger, - UserContext: wOptions.BackgroundActivityContext, - DataConverter: dataConverter, - WorkerStopChannel: env.workerStopChannel, + TaskList: taskList, + Identity: wOptions.Identity, + MetricsScope: wOptions.MetricsScope, + Logger: wOptions.Logger, + UserContext: wOptions.BackgroundActivityContext, + DataConverter: dataConverter, + WorkerStopChannel: env.workerStopChannel, + ContextPropagators: wOptions.ContextPropagators, } ensureRequiredParams(¶ms) diff --git a/internal/workflow.go b/internal/workflow.go index c869d30de..796de8243 100644 --- a/internal/workflow.go +++ b/internal/workflow.go @@ -545,6 +545,7 @@ func ExecuteChildWorkflow(ctx Context, childWorkflow interface{}, args ...interf return result } options.dataConverter = dc + options.contextPropagators = getWorkflowEnvOptions(ctx).contextPropagators params := executeWorkflowParams{ workflowOptions: *options, From b437e25cc1b7c1134df23d39233baa0a3103a7d8 Mon Sep 17 00:00:00 2001 From: Shreyas Srivatsan Date: Tue, 30 Apr 2019 14:35:36 -0700 Subject: [PATCH 05/11] pull latest thrift file --- .gen/go/shared/idl.go | 4 +- .gen/go/shared/types.go | 1299 ++++++++++++++++++++- idl/github.com/uber/cadence/shared.thrift | 40 +- 3 files changed, 1333 insertions(+), 10 deletions(-) diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index 85b3c1ffb..c3be9df0d 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "go.uber.org/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "9f07faff7803679e708717b189aa377670ec4760", + SHA1: "56d5dd2ba77a77a2a52fab0e5877f4f637dc25ba", Raw: rawIDL, } -const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nexception DomainNotActiveError {\n 1: required string message\n 2: required string domainName\n 3: required string currentCluster\n 4: required string activeCluster\n}\n\nexception LimitExceededError {\n 1: required string message\n}\n\nexception AccessDeniedError {\n 1: required string message\n}\n\nexception RetryTaskError {\n 1: required string message\n 2: optional string domainId\n 3: optional string workflowId\n 4: optional string runId\n 5: optional i64 (js.type = \"Long\") nextEventId\n}\n\nexception ClientVersionNotSupportedError {\n 1: required string featureVersion\n 2: required string clientImpl\n 3: required string supportedVersions\n}\n\nenum WorkflowIdReusePolicy {\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running, and the last execution close state is in\n * [terminated, cancelled, timeouted, failed].\n */\n AllowDuplicateFailedOnly,\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running.\n */\n AllowDuplicate,\n /*\n * do not allow start a workflow execution using the same workflow ID at all\n */\n RejectDuplicate,\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\n// whenever this list of decision is changed\n// do change the mutableStateBuilder.go\n// function shouldBufferEvent\n// to make sure wo do the correct event ordering\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n SignalExternalWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n SignalExternalWorkflowExecutionInitiated,\n SignalExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionSignaled,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE,\n BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_START_CHILD_EXECUTION_ATTRIBUTES,\n FORCE_CLOSE_DECISION,\n FAILOVER_CLOSE_DECISION,\n BAD_SIGNAL_INPUT_SIZE,\n RESET_WORKFLOW,\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum SignalExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nenum PendingActivityState {\n SCHEDULED,\n STARTED,\n CANCEL_REQUESTED,\n}\n\nenum HistoryEventFilterType {\n ALL_EVENT,\n CLOSE_EVENT,\n}\n\nenum TaskListKind {\n NORMAL,\n STICKY,\n}\n\nenum ArchivalStatus {\n DISABLED,\n ENABLED,\n}\n\nstruct Header {\n 10: optional map fields\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n 20: optional TaskListKind kind\n}\n\nenum EncodingType {\n ThriftRW,\n}\n\nstruct DataBlob {\n 10: optional EncodingType EncodingType\n 20: optional binary Data\n}\n\nstruct ReplicationInfo {\n 10: optional i64 (js.type = \"Long\") version\n 20: optional i64 (js.type = \"Long\") lastEventId\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct Memo {\n 10: optional map fields\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n 70: optional string parentDomainId\n 80: optional WorkflowExecution parentExecution\n 90: optional i64 (js.type = \"Long\") executionTime\n 100: optional Memo memo\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 70: optional RetryPolicy retryPolicy\n 80: optional Header header\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional string signalName\n 40: optional binary input\n 50: optional binary control\n 60: optional bool childWorkflowOnly\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional Header header\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional i32 backoffStartIntervalInSeconds\n 70: optional RetryPolicy retryPolicy\n 80: optional ContinueAsNewInitiator initiator\n 90: optional string failureReason\n 100: optional binary failureDetails\n 110: optional binary lastCompletionResult\n 120: optional string cronSchedule\n 130: optional Header header\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional RetryPolicy retryPolicy\n 120: optional string cronSchedule\n 130: optional Header header\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n 110: optional SignalExternalWorkflowExecutionDecisionAttributes signalExternalWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 12: optional string parentWorkflowDomain\n 14: optional WorkflowExecution parentWorkflowExecution\n 16: optional i64 (js.type = \"Long\") parentInitiatedEventId\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 52: optional ChildPolicy childPolicy\n 54: optional string continuedExecutionRunId\n 55: optional ContinueAsNewInitiator initiator\n 56: optional string continuedFailureReason\n 57: optional binary continuedFailureDetails\n 58: optional binary lastCompletionResult\n 60: optional string identity\n 70: optional RetryPolicy retryPolicy\n 80: optional i32 attempt\n 90: optional i64 (js.type = \"Long\") expirationTimestamp\n 100: optional string cronSchedule\n 110: optional i32 firstDecisionTaskBackoffSeconds\n 120: optional Memo memo\n 130: optional Header header\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nenum ContinueAsNewInitiator {\n Decider,\n RetryPolicy,\n CronSchedule,\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 80: optional i32 backoffStartIntervalInSeconds\n 90: optional ContinueAsNewInitiator initiator\n 100: optional string failureReason\n 110: optional binary failureDetails\n 120: optional binary lastCompletionResult\n 130: optional Header header\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n 50: optional string binaryChecksum\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n 50: optional string reason\n // for reset workflow\n 60: optional string baseRunId\n 70: optional string newRunId\n 80: optional i64 (js.type = \"Long\") forkEventVersion\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional RetryPolicy retryPolicy\n 120: optional Header header\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n 40: optional i32 attempt\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional Header header\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct SignalExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional string signalName\n 50: optional binary input\n 60: optional binary control\n 70: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionFailedEventAttributes {\n 10: optional SignalExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionSignaledEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 120: optional RetryPolicy retryPolicy\n 130: optional string cronSchedule\n 140: optional Header header\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional Header header\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 35: optional i64 (js.type = \"Long\") version\n 36: optional i64 (js.type = \"Long\") taskId\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n 420: optional SignalExternalWorkflowExecutionInitiatedEventAttributes signalExternalWorkflowExecutionInitiatedEventAttributes\n 430: optional SignalExternalWorkflowExecutionFailedEventAttributes signalExternalWorkflowExecutionFailedEventAttributes\n 440: optional ExternalWorkflowExecutionSignaledEventAttributes externalWorkflowExecutionSignaledEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n // A key-value map for any customized purpose\n 50: optional map data\n 60: optional string uuid\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n 30: optional string archivalBucketName\n 40: optional i32 archivalRetentionPeriodInDays\n 50: optional ArchivalStatus archivalStatus\n 60: optional string archivalBucketOwner\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n // A key-value map for any customized purpose\n 30: optional map data\n}\n\nstruct ClusterReplicationConfiguration {\n 10: optional string clusterName\n}\n\nstruct DomainReplicationConfiguration {\n 10: optional string activeClusterName\n 20: optional list clusters\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n 60: optional list clusters\n 70: optional string activeClusterName\n // A key-value map for any customized purpose\n 80: optional map data\n 90: optional string securityToken\n 100: optional ArchivalStatus archivalStatus\n 110: optional string archivalBucketName\n}\n\nstruct ListDomainsRequest {\n 10: optional i32 pageSize\n 20: optional binary nextPageToken\n}\n\nstruct ListDomainsResponse {\n 10: optional list domains\n 20: optional binary nextPageToken\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n 20: optional string uuid\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n 40: optional DomainReplicationConfiguration replicationConfiguration\n 50: optional string securityToken\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n 20: optional string securityToken\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional ChildPolicy childPolicy\n 120: optional RetryPolicy retryPolicy\n 130: optional string cronSchedule\n 140: optional Memo memo\n 150: optional Header header\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 51: optional i64 (js.type = 'Long') attempt\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n 90: optional TaskList WorkflowExecutionTaskList\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n 60: optional bool returnNewDecisionTask\n 70: optional bool forceCreateNewDecisionTask\n 80: optional string binaryChecksum\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n 10: optional PollForDecisionTaskResponse decisionTask\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n 120: optional i32 attempt\n 130: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n 140: optional binary heartbeatDetails\n 150: optional WorkflowType workflowType\n 160: optional string workflowDomain\n 170: optional Header header\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n 60: optional HistoryEventFilterType HistoryEventFilterType\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n 30: optional bool archived\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n 60: optional string requestId\n 70: optional binary control\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional string signalName\n 120: optional binary signalInput\n 130: optional binary control\n 140: optional RetryPolicy retryPolicy\n 150: optional string cronSchedule\n 160: optional Memo memo\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ResetWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional i64 (js.type = \"Long\") decisionFinishEventId\n 50: optional string requestId\n}\n\nstruct ResetWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct ResetStickyTaskListRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n // The reason to keep this response is to allow returning\n // information in the future.\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct PendingActivityInfo {\n 10: optional string activityID\n 20: optional ActivityType activityType\n 30: optional PendingActivityState state\n 40: optional binary heartbeatDetails\n 50: optional i64 (js.type = \"Long\") lastHeartbeatTimestamp\n 60: optional i64 (js.type = \"Long\") lastStartedTimestamp\n 70: optional i32 attempt\n 80: optional i32 maximumAttempts\n 90: optional i64 (js.type = \"Long\") scheduledTimestamp\n 100: optional i64 (js.type = \"Long\") expirationTimestamp\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n 30: optional list pendingActivities\n}\n\nstruct DescribeTaskListRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n 40: optional bool includeTaskListStatus\n}\n\nstruct DescribeTaskListResponse {\n 10: optional list pollers\n 20: optional TaskListStatus taskListStatus\n}\n\nstruct TaskListStatus {\n 10: optional i64 (js.type = \"Long\") backlogCountHint\n 20: optional i64 (js.type = \"Long\") readLevel\n 30: optional i64 (js.type = \"Long\") ackLevel\n 35: optional double ratePerSecond\n 40: optional TaskIDBlock taskIDBlock\n}\n\nstruct TaskIDBlock {\n 10: optional i64 (js.type = \"Long\") startID\n 20: optional i64 (js.type = \"Long\") endID\n}\n\n//At least one of the parameters needs to be provided\nstruct DescribeHistoryHostRequest {\n 10: optional string hostAddress //ip:port\n 20: optional i32 shardIdForHost\n 30: optional WorkflowExecution executionForHost\n}\n\nstruct DescribeHistoryHostResponse{\n 10: optional i32 numberOfShards\n 20: optional list shardIDs\n 30: optional DomainCacheInfo domainCache\n 40: optional string shardControllerStatus\n 50: optional string address\n}\n\nstruct DomainCacheInfo{\n 10: optional i64 numOfItemsInCacheByID\n 20: optional i64 numOfItemsInCacheByName\n}\n\nenum TaskListType {\n /*\n * Decision type of tasklist\n */\n Decision,\n /*\n * Activity type of tasklist\n */\n Activity,\n}\n\nstruct PollerInfo {\n // Unix Nano\n 10: optional i64 (js.type = \"Long\") lastAccessTime\n 20: optional string identity\n 30: optional double ratePerSecond\n}\n\nstruct RetryPolicy {\n // Interval of the first retry. If coefficient is 1.0 then it is used for all retries.\n 10: optional i32 initialIntervalInSeconds\n\n // Coefficient used to calculate the next retry interval.\n // The next retry interval is previous interval multiplied by the coefficient.\n // Must be 1 or larger.\n 20: optional double backoffCoefficient\n\n // Maximum interval between retries. Exponential backoff leads to interval increase.\n // This value is the cap of the increase. Default is 100x of initial interval.\n 30: optional i32 maximumIntervalInSeconds\n\n // Maximum number of attempts. When exceeded the retries stop even if not expired yet.\n // Must be 1 or bigger. Default is unlimited.\n 40: optional i32 maximumAttempts\n\n // Non-Retriable errors. Will stop retrying if error matches this list.\n 50: optional list nonRetriableErrorReasons\n\n // Expiration time for the whole retry process.\n 60: optional i32 expirationIntervalInSeconds\n}\n\n// HistoryBranchRange represents a piece of range for a branch.\nstruct HistoryBranchRange{\n // branchID of original branch forked from\n 10: optional string branchID\n // beinning node for the range, inclusive\n 20: optional i64 beginNodeID\n // ending node for the range, exclusive\n 30: optional i64 endNodeID\n}\n\n// For history persistence to serialize/deserialize branch details\nstruct HistoryBranch{\n 10: optional string treeID\n 20: optional string branchID\n 30: optional list ancestors\n}\n" +const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\nnamespace java com.uber.cadence\n\nexception BadRequestError {\n 1: required string message\n}\n\nexception InternalServiceError {\n 1: required string message\n}\n\nexception DomainAlreadyExistsError {\n 1: required string message\n}\n\nexception WorkflowExecutionAlreadyStartedError {\n 10: optional string message\n 20: optional string startRequestId\n 30: optional string runId\n}\n\nexception EntityNotExistsError {\n 1: required string message\n}\n\nexception ServiceBusyError {\n 1: required string message\n}\n\nexception CancellationAlreadyRequestedError {\n 1: required string message\n}\n\nexception QueryFailedError {\n 1: required string message\n}\n\nexception DomainNotActiveError {\n 1: required string message\n 2: required string domainName\n 3: required string currentCluster\n 4: required string activeCluster\n}\n\nexception LimitExceededError {\n 1: required string message\n}\n\nexception AccessDeniedError {\n 1: required string message\n}\n\nexception RetryTaskError {\n 1: required string message\n 2: optional string domainId\n 3: optional string workflowId\n 4: optional string runId\n 5: optional i64 (js.type = \"Long\") nextEventId\n}\n\nexception ClientVersionNotSupportedError {\n 1: required string featureVersion\n 2: required string clientImpl\n 3: required string supportedVersions\n}\n\nenum WorkflowIdReusePolicy {\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running, and the last execution close state is in\n * [terminated, cancelled, timeouted, failed].\n */\n AllowDuplicateFailedOnly,\n /*\n * allow start a workflow execution using the same workflow ID,\n * when workflow not running.\n */\n AllowDuplicate,\n /*\n * do not allow start a workflow execution using the same workflow ID at all\n */\n RejectDuplicate,\n}\n\nenum DomainStatus {\n REGISTERED,\n DEPRECATED,\n DELETED,\n}\n\nenum TimeoutType {\n START_TO_CLOSE,\n SCHEDULE_TO_START,\n SCHEDULE_TO_CLOSE,\n HEARTBEAT,\n}\n\n// whenever this list of decision is changed\n// do change the mutableStateBuilder.go\n// function shouldBufferEvent\n// to make sure wo do the correct event ordering\nenum DecisionType {\n ScheduleActivityTask,\n RequestCancelActivityTask,\n StartTimer,\n CompleteWorkflowExecution,\n FailWorkflowExecution,\n CancelTimer,\n CancelWorkflowExecution,\n RequestCancelExternalWorkflowExecution,\n RecordMarker,\n ContinueAsNewWorkflowExecution,\n StartChildWorkflowExecution,\n SignalExternalWorkflowExecution,\n}\n\nenum EventType {\n WorkflowExecutionStarted,\n WorkflowExecutionCompleted,\n WorkflowExecutionFailed,\n WorkflowExecutionTimedOut,\n DecisionTaskScheduled,\n DecisionTaskStarted,\n DecisionTaskCompleted,\n DecisionTaskTimedOut\n DecisionTaskFailed,\n ActivityTaskScheduled,\n ActivityTaskStarted,\n ActivityTaskCompleted,\n ActivityTaskFailed,\n ActivityTaskTimedOut,\n ActivityTaskCancelRequested,\n RequestCancelActivityTaskFailed,\n ActivityTaskCanceled,\n TimerStarted,\n TimerFired,\n CancelTimerFailed,\n TimerCanceled,\n WorkflowExecutionCancelRequested,\n WorkflowExecutionCanceled,\n RequestCancelExternalWorkflowExecutionInitiated,\n RequestCancelExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionCancelRequested,\n MarkerRecorded,\n WorkflowExecutionSignaled,\n WorkflowExecutionTerminated,\n WorkflowExecutionContinuedAsNew,\n StartChildWorkflowExecutionInitiated,\n StartChildWorkflowExecutionFailed,\n ChildWorkflowExecutionStarted,\n ChildWorkflowExecutionCompleted,\n ChildWorkflowExecutionFailed,\n ChildWorkflowExecutionCanceled,\n ChildWorkflowExecutionTimedOut,\n ChildWorkflowExecutionTerminated,\n SignalExternalWorkflowExecutionInitiated,\n SignalExternalWorkflowExecutionFailed,\n ExternalWorkflowExecutionSignaled,\n}\n\nenum DecisionTaskFailedCause {\n UNHANDLED_DECISION,\n BAD_SCHEDULE_ACTIVITY_ATTRIBUTES,\n BAD_REQUEST_CANCEL_ACTIVITY_ATTRIBUTES,\n BAD_START_TIMER_ATTRIBUTES,\n BAD_CANCEL_TIMER_ATTRIBUTES,\n BAD_RECORD_MARKER_ATTRIBUTES,\n BAD_COMPLETE_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_FAIL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CANCEL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_CONTINUE_AS_NEW_ATTRIBUTES,\n START_TIMER_DUPLICATE_ID,\n RESET_STICKY_TASKLIST,\n WORKFLOW_WORKER_UNHANDLED_FAILURE,\n BAD_SIGNAL_WORKFLOW_EXECUTION_ATTRIBUTES,\n BAD_START_CHILD_EXECUTION_ATTRIBUTES,\n FORCE_CLOSE_DECISION,\n FAILOVER_CLOSE_DECISION,\n BAD_SIGNAL_INPUT_SIZE,\n RESET_WORKFLOW,\n}\n\nenum CancelExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum SignalExternalWorkflowExecutionFailedCause {\n UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION,\n}\n\nenum ChildWorkflowExecutionFailedCause {\n WORKFLOW_ALREADY_RUNNING,\n}\n\nenum WorkflowExecutionCloseStatus {\n COMPLETED,\n FAILED,\n CANCELED,\n TERMINATED,\n CONTINUED_AS_NEW,\n TIMED_OUT,\n}\n\nenum ChildPolicy {\n TERMINATE,\n REQUEST_CANCEL,\n ABANDON,\n}\n\nenum QueryTaskCompletedType {\n COMPLETED,\n FAILED,\n}\n\nenum PendingActivityState {\n SCHEDULED,\n STARTED,\n CANCEL_REQUESTED,\n}\n\nenum HistoryEventFilterType {\n ALL_EVENT,\n CLOSE_EVENT,\n}\n\nenum TaskListKind {\n NORMAL,\n STICKY,\n}\n\nenum ArchivalStatus {\n DISABLED,\n ENABLED,\n}\n\nstruct Header {\n 10: optional map fields\n}\n\nstruct WorkflowType {\n 10: optional string name\n}\n\nstruct ActivityType {\n 10: optional string name\n}\n\nstruct TaskList {\n 10: optional string name\n 20: optional TaskListKind kind\n}\n\nenum EncodingType {\n ThriftRW,\n}\n\nstruct DataBlob {\n 10: optional EncodingType EncodingType\n 20: optional binary Data\n}\n\nstruct ReplicationInfo {\n 10: optional i64 (js.type = \"Long\") version\n 20: optional i64 (js.type = \"Long\") lastEventId\n}\n\nstruct TaskListMetadata {\n 10: optional double maxTasksPerSecond\n}\n\nstruct WorkflowExecution {\n 10: optional string workflowId\n 20: optional string runId\n}\n\nstruct Memo {\n 10: optional map fields\n}\n\nstruct WorkflowExecutionInfo {\n 10: optional WorkflowExecution execution\n 20: optional WorkflowType type\n 30: optional i64 (js.type = \"Long\") startTime\n 40: optional i64 (js.type = \"Long\") closeTime\n 50: optional WorkflowExecutionCloseStatus closeStatus\n 60: optional i64 (js.type = \"Long\") historyLength\n 70: optional string parentDomainId\n 80: optional WorkflowExecution parentExecution\n 90: optional i64 (js.type = \"Long\") executionTime\n 100: optional Memo memo\n}\n\nstruct WorkflowExecutionConfiguration {\n 10: optional TaskList taskList\n 20: optional i32 executionStartToCloseTimeoutSeconds\n 30: optional i32 taskStartToCloseTimeoutSeconds\n 40: optional ChildPolicy childPolicy\n}\n\nstruct TransientDecisionInfo {\n 10: optional HistoryEvent scheduledEvent\n 20: optional HistoryEvent startedEvent\n}\n\nstruct ScheduleActivityTaskDecisionAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 70: optional RetryPolicy retryPolicy\n 80: optional Header header\n}\n\nstruct RequestCancelActivityTaskDecisionAttributes {\n 10: optional string activityId\n}\n\nstruct StartTimerDecisionAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n}\n\nstruct CompleteWorkflowExecutionDecisionAttributes {\n 10: optional binary result\n}\n\nstruct FailWorkflowExecutionDecisionAttributes {\n 10: optional string reason\n 20: optional binary details\n}\n\nstruct CancelTimerDecisionAttributes {\n 10: optional string timerId\n}\n\nstruct CancelWorkflowExecutionDecisionAttributes {\n 10: optional binary details\n}\n\nstruct RequestCancelExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional string runId\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional string signalName\n 40: optional binary input\n 50: optional binary control\n 60: optional bool childWorkflowOnly\n}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional Header header\n}\n\nstruct ContinueAsNewWorkflowExecutionDecisionAttributes {\n 10: optional WorkflowType workflowType\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 60: optional i32 backoffStartIntervalInSeconds\n 70: optional RetryPolicy retryPolicy\n 80: optional ContinueAsNewInitiator initiator\n 90: optional string failureReason\n 100: optional binary failureDetails\n 110: optional binary lastCompletionResult\n 120: optional string cronSchedule\n 130: optional Header header\n}\n\nstruct StartChildWorkflowExecutionDecisionAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional RetryPolicy retryPolicy\n 120: optional string cronSchedule\n 130: optional Header header\n}\n\nstruct Decision {\n 10: optional DecisionType decisionType\n 20: optional ScheduleActivityTaskDecisionAttributes scheduleActivityTaskDecisionAttributes\n 25: optional StartTimerDecisionAttributes startTimerDecisionAttributes\n 30: optional CompleteWorkflowExecutionDecisionAttributes completeWorkflowExecutionDecisionAttributes\n 35: optional FailWorkflowExecutionDecisionAttributes failWorkflowExecutionDecisionAttributes\n 40: optional RequestCancelActivityTaskDecisionAttributes requestCancelActivityTaskDecisionAttributes\n 50: optional CancelTimerDecisionAttributes cancelTimerDecisionAttributes\n 60: optional CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes\n 70: optional RequestCancelExternalWorkflowExecutionDecisionAttributes requestCancelExternalWorkflowExecutionDecisionAttributes\n 80: optional RecordMarkerDecisionAttributes recordMarkerDecisionAttributes\n 90: optional ContinueAsNewWorkflowExecutionDecisionAttributes continueAsNewWorkflowExecutionDecisionAttributes\n 100: optional StartChildWorkflowExecutionDecisionAttributes startChildWorkflowExecutionDecisionAttributes\n 110: optional SignalExternalWorkflowExecutionDecisionAttributes signalExternalWorkflowExecutionDecisionAttributes\n}\n\nstruct WorkflowExecutionStartedEventAttributes {\n 10: optional WorkflowType workflowType\n 12: optional string parentWorkflowDomain\n 14: optional WorkflowExecution parentWorkflowExecution\n 16: optional i64 (js.type = \"Long\") parentInitiatedEventId\n 20: optional TaskList taskList\n 30: optional binary input\n 40: optional i32 executionStartToCloseTimeoutSeconds\n 50: optional i32 taskStartToCloseTimeoutSeconds\n 52: optional ChildPolicy childPolicy\n 54: optional string continuedExecutionRunId\n 55: optional ContinueAsNewInitiator initiator\n 56: optional string continuedFailureReason\n 57: optional binary continuedFailureDetails\n 58: optional binary lastCompletionResult\n 60: optional string identity\n 70: optional RetryPolicy retryPolicy\n 80: optional i32 attempt\n 90: optional i64 (js.type = \"Long\") expirationTimestamp\n 100: optional string cronSchedule\n 110: optional i32 firstDecisionTaskBackoffSeconds\n 120: optional Memo memo\n 130: optional ResetPoints prevAutoResetPoints\n 140: optional Header header\n}\n\nstruct ResetPoints{\n 10: optional list points\n}\n\n struct ResetPointInfo{\n 10: optional string binaryChecksum\n 20: optional string runId\n 30: optional i64 firstDecisionCompletedId\n 40: optional i64 (js.type = \"Long\") createdTimeNano\n 50: optional i64 (js.type = \"Long\") expiringTimeNano //the time that the run is deleted due to retention\n 60: optional bool resettable // false if the resset point has pending childWFs/reqCancels/signalExternals.\n}\n\nstruct WorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct WorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n}\n\nenum ContinueAsNewInitiator {\n Decider,\n RetryPolicy,\n CronSchedule,\n}\n\nstruct WorkflowExecutionContinuedAsNewEventAttributes {\n 10: optional string newExecutionRunId\n 20: optional WorkflowType workflowType\n 30: optional TaskList taskList\n 40: optional binary input\n 50: optional i32 executionStartToCloseTimeoutSeconds\n 60: optional i32 taskStartToCloseTimeoutSeconds\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 80: optional i32 backoffStartIntervalInSeconds\n 90: optional ContinueAsNewInitiator initiator\n 100: optional string failureReason\n 110: optional binary failureDetails\n 120: optional binary lastCompletionResult\n 130: optional Header header\n}\n\nstruct DecisionTaskScheduledEventAttributes {\n 10: optional TaskList taskList\n 20: optional i32 startToCloseTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") attempt\n}\n\nstruct DecisionTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n}\n\nstruct DecisionTaskCompletedEventAttributes {\n 10: optional binary executionContext\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n 50: optional string binaryChecksum\n}\n\nstruct DecisionTaskTimedOutEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct DecisionTaskFailedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional DecisionTaskFailedCause cause\n 35: optional binary details\n 40: optional string identity\n 50: optional string reason\n // for reset workflow\n 60: optional string baseRunId\n 70: optional string newRunId\n 80: optional i64 (js.type = \"Long\") forkEventVersion\n}\n\nstruct ActivityTaskScheduledEventAttributes {\n 10: optional string activityId\n 20: optional ActivityType activityType\n 25: optional string domain\n 30: optional TaskList taskList\n 40: optional binary input\n 45: optional i32 scheduleToCloseTimeoutSeconds\n 50: optional i32 scheduleToStartTimeoutSeconds\n 55: optional i32 startToCloseTimeoutSeconds\n 60: optional i32 heartbeatTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional RetryPolicy retryPolicy\n 120: optional Header header\n}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\n 40: optional i32 attempt\n}\n\nstruct ActivityTaskCompletedEventAttributes {\n 10: optional binary result\n 20: optional i64 (js.type = \"Long\") scheduledEventId\n 30: optional i64 (js.type = \"Long\") startedEventId\n 40: optional string identity\n}\n\nstruct ActivityTaskFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct ActivityTaskTimedOutEventAttributes {\n 05: optional binary details\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional TimeoutType timeoutType\n}\n\nstruct ActivityTaskCancelRequestedEventAttributes {\n 10: optional string activityId\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct RequestCancelActivityTaskFailedEventAttributes{\n 10: optional string activityId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ActivityTaskCanceledEventAttributes {\n 10: optional binary details\n 20: optional i64 (js.type = \"Long\") latestCancelRequestedEventId\n 30: optional i64 (js.type = \"Long\") scheduledEventId\n 40: optional i64 (js.type = \"Long\") startedEventId\n 50: optional string identity\n}\n\nstruct TimerStartedEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startToFireTimeoutSeconds\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct TimerFiredEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct TimerCanceledEventAttributes {\n 10: optional string timerId\n 20: optional i64 (js.type = \"Long\") startedEventId\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct CancelTimerFailedEventAttributes {\n 10: optional string timerId\n 20: optional string cause\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCancelRequestedEventAttributes {\n 10: optional string cause\n 20: optional i64 (js.type = \"Long\") externalInitiatedEventId\n 30: optional WorkflowExecution externalWorkflowExecution\n 40: optional string identity\n}\n\nstruct WorkflowExecutionCanceledEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional binary details\n}\n\nstruct MarkerRecordedEventAttributes {\n 10: optional string markerName\n 20: optional binary details\n 30: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 40: optional Header header\n}\n\nstruct WorkflowExecutionSignaledEventAttributes {\n 10: optional string signalName\n 20: optional binary input\n 30: optional string identity\n}\n\nstruct WorkflowExecutionTerminatedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RequestCancelExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n 50: optional bool childWorkflowOnly\n}\n\nstruct RequestCancelExternalWorkflowExecutionFailedEventAttributes {\n 10: optional CancelExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionCancelRequestedEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n}\n\nstruct SignalExternalWorkflowExecutionInitiatedEventAttributes {\n 10: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional string signalName\n 50: optional binary input\n 60: optional binary control\n 70: optional bool childWorkflowOnly\n}\n\nstruct SignalExternalWorkflowExecutionFailedEventAttributes {\n 10: optional SignalExternalWorkflowExecutionFailedCause cause\n 20: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional binary control\n}\n\nstruct ExternalWorkflowExecutionSignaledEventAttributes {\n 10: optional i64 (js.type = \"Long\") initiatedEventId\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional binary control\n}\n\nstruct StartChildWorkflowExecutionInitiatedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional ChildPolicy childPolicy\n 90: optional binary control\n 100: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n 110: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 120: optional RetryPolicy retryPolicy\n 130: optional string cronSchedule\n 140: optional Header header\n}\n\nstruct StartChildWorkflowExecutionFailedEventAttributes {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional ChildWorkflowExecutionFailedCause cause\n 50: optional binary control\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") decisionTaskCompletedEventId\n}\n\nstruct ChildWorkflowExecutionStartedEventAttributes {\n 10: optional string domain\n 20: optional i64 (js.type = \"Long\") initiatedEventId\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional Header header\n}\n\nstruct ChildWorkflowExecutionCompletedEventAttributes {\n 10: optional binary result\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionFailedEventAttributes {\n 10: optional string reason\n 20: optional binary details\n 30: optional string domain\n 40: optional WorkflowExecution workflowExecution\n 50: optional WorkflowType workflowType\n 60: optional i64 (js.type = \"Long\") initiatedEventId\n 70: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionCanceledEventAttributes {\n 10: optional binary details\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTimedOutEventAttributes {\n 10: optional TimeoutType timeoutType\n 20: optional string domain\n 30: optional WorkflowExecution workflowExecution\n 40: optional WorkflowType workflowType\n 50: optional i64 (js.type = \"Long\") initiatedEventId\n 60: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct ChildWorkflowExecutionTerminatedEventAttributes {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") initiatedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n}\n\nstruct HistoryEvent {\n 10: optional i64 (js.type = \"Long\") eventId\n 20: optional i64 (js.type = \"Long\") timestamp\n 30: optional EventType eventType\n 35: optional i64 (js.type = \"Long\") version\n 36: optional i64 (js.type = \"Long\") taskId\n 40: optional WorkflowExecutionStartedEventAttributes workflowExecutionStartedEventAttributes\n 50: optional WorkflowExecutionCompletedEventAttributes workflowExecutionCompletedEventAttributes\n 60: optional WorkflowExecutionFailedEventAttributes workflowExecutionFailedEventAttributes\n 70: optional WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes\n 80: optional DecisionTaskScheduledEventAttributes decisionTaskScheduledEventAttributes\n 90: optional DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes\n 100: optional DecisionTaskCompletedEventAttributes decisionTaskCompletedEventAttributes\n 110: optional DecisionTaskTimedOutEventAttributes decisionTaskTimedOutEventAttributes\n 120: optional DecisionTaskFailedEventAttributes decisionTaskFailedEventAttributes\n 130: optional ActivityTaskScheduledEventAttributes activityTaskScheduledEventAttributes\n 140: optional ActivityTaskStartedEventAttributes activityTaskStartedEventAttributes\n 150: optional ActivityTaskCompletedEventAttributes activityTaskCompletedEventAttributes\n 160: optional ActivityTaskFailedEventAttributes activityTaskFailedEventAttributes\n 170: optional ActivityTaskTimedOutEventAttributes activityTaskTimedOutEventAttributes\n 180: optional TimerStartedEventAttributes timerStartedEventAttributes\n 190: optional TimerFiredEventAttributes timerFiredEventAttributes\n 200: optional ActivityTaskCancelRequestedEventAttributes activityTaskCancelRequestedEventAttributes\n 210: optional RequestCancelActivityTaskFailedEventAttributes requestCancelActivityTaskFailedEventAttributes\n 220: optional ActivityTaskCanceledEventAttributes activityTaskCanceledEventAttributes\n 230: optional TimerCanceledEventAttributes timerCanceledEventAttributes\n 240: optional CancelTimerFailedEventAttributes cancelTimerFailedEventAttributes\n 250: optional MarkerRecordedEventAttributes markerRecordedEventAttributes\n 260: optional WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes\n 270: optional WorkflowExecutionTerminatedEventAttributes workflowExecutionTerminatedEventAttributes\n 280: optional WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes\n 290: optional WorkflowExecutionCanceledEventAttributes workflowExecutionCanceledEventAttributes\n 300: optional RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes\n 310: optional RequestCancelExternalWorkflowExecutionFailedEventAttributes requestCancelExternalWorkflowExecutionFailedEventAttributes\n 320: optional ExternalWorkflowExecutionCancelRequestedEventAttributes externalWorkflowExecutionCancelRequestedEventAttributes\n 330: optional WorkflowExecutionContinuedAsNewEventAttributes workflowExecutionContinuedAsNewEventAttributes\n 340: optional StartChildWorkflowExecutionInitiatedEventAttributes startChildWorkflowExecutionInitiatedEventAttributes\n 350: optional StartChildWorkflowExecutionFailedEventAttributes startChildWorkflowExecutionFailedEventAttributes\n 360: optional ChildWorkflowExecutionStartedEventAttributes childWorkflowExecutionStartedEventAttributes\n 370: optional ChildWorkflowExecutionCompletedEventAttributes childWorkflowExecutionCompletedEventAttributes\n 380: optional ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes\n 390: optional ChildWorkflowExecutionCanceledEventAttributes childWorkflowExecutionCanceledEventAttributes\n 400: optional ChildWorkflowExecutionTimedOutEventAttributes childWorkflowExecutionTimedOutEventAttributes\n 410: optional ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes\n 420: optional SignalExternalWorkflowExecutionInitiatedEventAttributes signalExternalWorkflowExecutionInitiatedEventAttributes\n 430: optional SignalExternalWorkflowExecutionFailedEventAttributes signalExternalWorkflowExecutionFailedEventAttributes\n 440: optional ExternalWorkflowExecutionSignaledEventAttributes externalWorkflowExecutionSignaledEventAttributes\n}\n\nstruct History {\n 10: optional list events\n}\n\nstruct WorkflowExecutionFilter {\n 10: optional string workflowId\n}\n\nstruct WorkflowTypeFilter {\n 10: optional string name\n}\n\nstruct StartTimeFilter {\n 10: optional i64 (js.type = \"Long\") earliestTime\n 20: optional i64 (js.type = \"Long\") latestTime\n}\n\nstruct DomainInfo {\n 10: optional string name\n 20: optional DomainStatus status\n 30: optional string description\n 40: optional string ownerEmail\n // A key-value map for any customized purpose\n 50: optional map data\n 60: optional string uuid\n}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n 30: optional string archivalBucketName\n 40: optional i32 archivalRetentionPeriodInDays\n 50: optional ArchivalStatus archivalStatus\n 60: optional string archivalBucketOwner\n 70: optional BadBinaries badBinaries\n}\n\nstruct BadBinaries{\n 10: optional map binaries\n}\n\nstruct BadBinaryInfo{\n 10: optional string reason\n 20: optional string operator\n 30: optional i64 (js.type = \"Long\") createdTimeNano\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\n // A key-value map for any customized purpose\n 30: optional map data\n}\n\nstruct ClusterReplicationConfiguration {\n 10: optional string clusterName\n}\n\nstruct DomainReplicationConfiguration {\n 10: optional string activeClusterName\n 20: optional list clusters\n}\n\nstruct RegisterDomainRequest {\n 10: optional string name\n 20: optional string description\n 30: optional string ownerEmail\n 40: optional i32 workflowExecutionRetentionPeriodInDays\n 50: optional bool emitMetric\n 60: optional list clusters\n 70: optional string activeClusterName\n // A key-value map for any customized purpose\n 80: optional map data\n 90: optional string securityToken\n 100: optional ArchivalStatus archivalStatus\n 110: optional string archivalBucketName\n}\n\nstruct ListDomainsRequest {\n 10: optional i32 pageSize\n 20: optional binary nextPageToken\n}\n\nstruct ListDomainsResponse {\n 10: optional list domains\n 20: optional binary nextPageToken\n}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n 20: optional string uuid\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n 40: optional DomainReplicationConfiguration replicationConfiguration\n 50: optional string securityToken\n 60: optional string deleteBadBinary\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n 30: optional DomainReplicationConfiguration replicationConfiguration\n 40: optional i64 (js.type = \"Long\") failoverVersion\n 50: optional bool isGlobalDomain\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\n 20: optional string securityToken\n}\n\nstruct StartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional ChildPolicy childPolicy\n 120: optional RetryPolicy retryPolicy\n 130: optional string cronSchedule\n 140: optional Memo memo\n 150: optional Header header\n}\n\nstruct StartWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional WorkflowType workflowType\n 40: optional i64 (js.type = \"Long\") previousStartedEventId\n 50: optional i64 (js.type = \"Long\") startedEventId\n 51: optional i64 (js.type = 'Long') attempt\n 54: optional i64 (js.type = \"Long\") backlogCountHint\n 60: optional History history\n 70: optional binary nextPageToken\n 80: optional WorkflowQuery query\n 90: optional TaskList WorkflowExecutionTaskList\n}\n\nstruct StickyExecutionAttributes {\n 10: optional TaskList workerTaskList\n 20: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional list decisions\n 30: optional binary executionContext\n 40: optional string identity\n 50: optional StickyExecutionAttributes stickyAttributes\n 60: optional bool returnNewDecisionTask\n 70: optional bool forceCreateNewDecisionTask\n 80: optional string binaryChecksum\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n 10: optional PollForDecisionTaskResponse decisionTask\n}\n\nstruct RespondDecisionTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional DecisionTaskFailedCause cause\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional string identity\n 40: optional TaskListMetadata taskListMetadata\n}\n\nstruct PollForActivityTaskResponse {\n 10: optional binary taskToken\n 20: optional WorkflowExecution workflowExecution\n 30: optional string activityId\n 40: optional ActivityType activityType\n 50: optional binary input\n 70: optional i64 (js.type = \"Long\") scheduledTimestamp\n 80: optional i32 scheduleToCloseTimeoutSeconds\n 90: optional i64 (js.type = \"Long\") startedTimestamp\n 100: optional i32 startToCloseTimeoutSeconds\n 110: optional i32 heartbeatTimeoutSeconds\n 120: optional i32 attempt\n 130: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n 140: optional binary heartbeatDetails\n 150: optional WorkflowType workflowType\n 160: optional string workflowDomain\n 170: optional Header header\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RecordActivityTaskHeartbeatResponse {\n 10: optional bool cancelRequested\n}\n\nstruct RespondActivityTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional binary result\n 30: optional string identity\n}\n\nstruct RespondActivityTaskFailedRequest {\n 10: optional binary taskToken\n 20: optional string reason\n 30: optional binary details\n 40: optional string identity\n}\n\nstruct RespondActivityTaskCanceledRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: optional string identity\n}\n\nstruct RespondActivityTaskCompletedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary result\n 60: optional string identity\n}\n\nstruct RespondActivityTaskFailedByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional string reason\n 60: optional binary details\n 70: optional string identity\n}\n\nstruct RespondActivityTaskCanceledByIDRequest {\n 10: optional string domain\n 20: optional string workflowID\n 30: optional string runID\n 40: optional string activityID\n 50: optional binary details\n 60: optional string identity\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string identity\n 40: optional string requestId\n}\n\nstruct GetWorkflowExecutionHistoryRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional i32 maximumPageSize\n 40: optional binary nextPageToken\n 50: optional bool waitForNewEvent\n 60: optional HistoryEventFilterType HistoryEventFilterType\n}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\n 30: optional bool archived\n}\n\nstruct SignalWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string signalName\n 40: optional binary input\n 50: optional string identity\n 60: optional string requestId\n 70: optional binary control\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional string workflowId\n 30: optional WorkflowType workflowType\n 40: optional TaskList taskList\n 50: optional binary input\n 60: optional i32 executionStartToCloseTimeoutSeconds\n 70: optional i32 taskStartToCloseTimeoutSeconds\n 80: optional string identity\n 90: optional string requestId\n 100: optional WorkflowIdReusePolicy workflowIdReusePolicy\n 110: optional string signalName\n 120: optional binary signalInput\n 130: optional binary control\n 140: optional RetryPolicy retryPolicy\n 150: optional string cronSchedule\n 160: optional Memo memo\n}\n\nstruct TerminateWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional binary details\n 50: optional string identity\n}\n\nstruct ResetWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution workflowExecution\n 30: optional string reason\n 40: optional i64 (js.type = \"Long\") decisionFinishEventId\n 50: optional string requestId\n}\n\nstruct ResetWorkflowExecutionResponse {\n 10: optional string runId\n}\n\nstruct ListOpenWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n}\n\nstruct ListOpenWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListClosedWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 maximumPageSize\n 30: optional binary nextPageToken\n 40: optional StartTimeFilter StartTimeFilter\n 50: optional WorkflowExecutionFilter executionFilter\n 60: optional WorkflowTypeFilter typeFilter\n 70: optional WorkflowExecutionCloseStatus statusFilter\n}\n\nstruct ListClosedWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct ListWorkflowExecutionsRequest {\n 10: optional string domain\n 20: optional i32 pageSize\n 30: optional binary nextPageToken\n 40: optional string query\n}\n\nstruct ListWorkflowExecutionsResponse {\n 10: optional list executions\n 20: optional binary nextPageToken\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n 30: optional WorkflowQuery query\n}\n\nstruct QueryWorkflowResponse {\n 10: optional binary queryResult\n}\n\nstruct WorkflowQuery {\n 10: optional string queryType\n 20: optional binary queryArgs\n}\n\nstruct ResetStickyTaskListRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n // The reason to keep this response is to allow returning\n // information in the future.\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional binary taskToken\n 20: optional QueryTaskCompletedType completedType\n 30: optional binary queryResult\n 40: optional string errorMessage\n}\n\nstruct DescribeWorkflowExecutionRequest {\n 10: optional string domain\n 20: optional WorkflowExecution execution\n}\n\nstruct PendingActivityInfo {\n 10: optional string activityID\n 20: optional ActivityType activityType\n 30: optional PendingActivityState state\n 40: optional binary heartbeatDetails\n 50: optional i64 (js.type = \"Long\") lastHeartbeatTimestamp\n 60: optional i64 (js.type = \"Long\") lastStartedTimestamp\n 70: optional i32 attempt\n 80: optional i32 maximumAttempts\n 90: optional i64 (js.type = \"Long\") scheduledTimestamp\n 100: optional i64 (js.type = \"Long\") expirationTimestamp\n}\n\nstruct DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n 30: optional list pendingActivities\n}\n\nstruct DescribeTaskListRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n 40: optional bool includeTaskListStatus\n}\n\nstruct DescribeTaskListResponse {\n 10: optional list pollers\n 20: optional TaskListStatus taskListStatus\n}\n\nstruct TaskListStatus {\n 10: optional i64 (js.type = \"Long\") backlogCountHint\n 20: optional i64 (js.type = \"Long\") readLevel\n 30: optional i64 (js.type = \"Long\") ackLevel\n 35: optional double ratePerSecond\n 40: optional TaskIDBlock taskIDBlock\n}\n\nstruct TaskIDBlock {\n 10: optional i64 (js.type = \"Long\") startID\n 20: optional i64 (js.type = \"Long\") endID\n}\n\n//At least one of the parameters needs to be provided\nstruct DescribeHistoryHostRequest {\n 10: optional string hostAddress //ip:port\n 20: optional i32 shardIdForHost\n 30: optional WorkflowExecution executionForHost\n}\n\nstruct DescribeHistoryHostResponse{\n 10: optional i32 numberOfShards\n 20: optional list shardIDs\n 30: optional DomainCacheInfo domainCache\n 40: optional string shardControllerStatus\n 50: optional string address\n}\n\nstruct DomainCacheInfo{\n 10: optional i64 numOfItemsInCacheByID\n 20: optional i64 numOfItemsInCacheByName\n}\n\nenum TaskListType {\n /*\n * Decision type of tasklist\n */\n Decision,\n /*\n * Activity type of tasklist\n */\n Activity,\n}\n\nstruct PollerInfo {\n // Unix Nano\n 10: optional i64 (js.type = \"Long\") lastAccessTime\n 20: optional string identity\n 30: optional double ratePerSecond\n}\n\nstruct RetryPolicy {\n // Interval of the first retry. If coefficient is 1.0 then it is used for all retries.\n 10: optional i32 initialIntervalInSeconds\n\n // Coefficient used to calculate the next retry interval.\n // The next retry interval is previous interval multiplied by the coefficient.\n // Must be 1 or larger.\n 20: optional double backoffCoefficient\n\n // Maximum interval between retries. Exponential backoff leads to interval increase.\n // This value is the cap of the increase. Default is 100x of initial interval.\n 30: optional i32 maximumIntervalInSeconds\n\n // Maximum number of attempts. When exceeded the retries stop even if not expired yet.\n // Must be 1 or bigger. Default is unlimited.\n 40: optional i32 maximumAttempts\n\n // Non-Retriable errors. Will stop retrying if error matches this list.\n 50: optional list nonRetriableErrorReasons\n\n // Expiration time for the whole retry process.\n 60: optional i32 expirationIntervalInSeconds\n}\n\n// HistoryBranchRange represents a piece of range for a branch.\nstruct HistoryBranchRange{\n // branchID of original branch forked from\n 10: optional string branchID\n // beinning node for the range, inclusive\n 20: optional i64 beginNodeID\n // ending node for the range, exclusive\n 30: optional i64 endNodeID\n}\n\n// For history persistence to serialize/deserialize branch details\nstruct HistoryBranch{\n 10: optional string treeID\n 20: optional string branchID\n 30: optional list ancestors\n}\n" diff --git a/.gen/go/shared/types.go b/.gen/go/shared/types.go index be69e1273..de93f8333 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -2213,6 +2213,387 @@ func (v *ArchivalStatus) UnmarshalJSON(text []byte) error { } } +type BadBinaries struct { + Binaries map[string]*BadBinaryInfo `json:"binaries,omitempty"` +} + +type _Map_String_BadBinaryInfo_MapItemList map[string]*BadBinaryInfo + +func (m _Map_String_BadBinaryInfo_MapItemList) ForEach(f func(wire.MapItem) error) error { + for k, v := range m { + if v == nil { + return fmt.Errorf("invalid [%v]: value is nil", k) + } + kw, err := wire.NewValueString(k), error(nil) + if err != nil { + return err + } + + vw, err := v.ToWire() + if err != nil { + return err + } + err = f(wire.MapItem{Key: kw, Value: vw}) + if err != nil { + return err + } + } + return nil +} + +func (m _Map_String_BadBinaryInfo_MapItemList) Size() int { + return len(m) +} + +func (_Map_String_BadBinaryInfo_MapItemList) KeyType() wire.Type { + return wire.TBinary +} + +func (_Map_String_BadBinaryInfo_MapItemList) ValueType() wire.Type { + return wire.TStruct +} + +func (_Map_String_BadBinaryInfo_MapItemList) Close() {} + +// ToWire translates a BadBinaries struct into a Thrift-level intermediate +// representation. This intermediate representation may be serialized +// into bytes using a ThriftRW protocol implementation. +// +// An error is returned if the struct or any of its fields failed to +// validate. +// +// x, err := v.ToWire() +// if err != nil { +// return err +// } +// +// if err := binaryProtocol.Encode(x, writer); err != nil { +// return err +// } +func (v *BadBinaries) ToWire() (wire.Value, error) { + var ( + fields [1]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.Binaries != nil { + w, err = wire.NewValueMap(_Map_String_BadBinaryInfo_MapItemList(v.Binaries)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 10, Value: w} + i++ + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +func _BadBinaryInfo_Read(w wire.Value) (*BadBinaryInfo, error) { + var v BadBinaryInfo + err := v.FromWire(w) + return &v, err +} + +func _Map_String_BadBinaryInfo_Read(m wire.MapItemList) (map[string]*BadBinaryInfo, error) { + if m.KeyType() != wire.TBinary { + return nil, nil + } + + if m.ValueType() != wire.TStruct { + return nil, nil + } + + o := make(map[string]*BadBinaryInfo, m.Size()) + err := m.ForEach(func(x wire.MapItem) error { + k, err := x.Key.GetString(), error(nil) + if err != nil { + return err + } + + v, err := _BadBinaryInfo_Read(x.Value) + if err != nil { + return err + } + + o[k] = v + return nil + }) + m.Close() + return o, err +} + +// FromWire deserializes a BadBinaries struct from its Thrift-level +// representation. The Thrift-level representation may be obtained +// from a ThriftRW protocol implementation. +// +// An error is returned if we were unable to build a BadBinaries struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v BadBinaries +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *BadBinaries) FromWire(w wire.Value) error { + var err error + + for _, field := range w.GetStruct().Fields { + switch field.ID { + case 10: + if field.Value.Type() == wire.TMap { + v.Binaries, err = _Map_String_BadBinaryInfo_Read(field.Value.GetMap()) + if err != nil { + return err + } + + } + } + } + + return nil +} + +// String returns a readable string representation of a BadBinaries +// struct. +func (v *BadBinaries) String() string { + if v == nil { + return "" + } + + var fields [1]string + i := 0 + if v.Binaries != nil { + fields[i] = fmt.Sprintf("Binaries: %v", v.Binaries) + i++ + } + + return fmt.Sprintf("BadBinaries{%v}", strings.Join(fields[:i], ", ")) +} + +func _Map_String_BadBinaryInfo_Equals(lhs, rhs map[string]*BadBinaryInfo) bool { + if len(lhs) != len(rhs) { + return false + } + + for lk, lv := range lhs { + rv, ok := rhs[lk] + if !ok { + return false + } + if !lv.Equals(rv) { + return false + } + } + return true +} + +// Equals returns true if all the fields of this BadBinaries match the +// provided BadBinaries. +// +// This function performs a deep comparison. +func (v *BadBinaries) Equals(rhs *BadBinaries) bool { + if !((v.Binaries == nil && rhs.Binaries == nil) || (v.Binaries != nil && rhs.Binaries != nil && _Map_String_BadBinaryInfo_Equals(v.Binaries, rhs.Binaries))) { + return false + } + + return true +} + +type BadBinaryInfo struct { + Reason *string `json:"reason,omitempty"` + Operator *string `json:"operator,omitempty"` + CreatedTimeNano *int64 `json:"createdTimeNano,omitempty"` +} + +// ToWire translates a BadBinaryInfo struct into a Thrift-level intermediate +// representation. This intermediate representation may be serialized +// into bytes using a ThriftRW protocol implementation. +// +// An error is returned if the struct or any of its fields failed to +// validate. +// +// x, err := v.ToWire() +// if err != nil { +// return err +// } +// +// if err := binaryProtocol.Encode(x, writer); err != nil { +// return err +// } +func (v *BadBinaryInfo) ToWire() (wire.Value, error) { + var ( + fields [3]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.Reason != nil { + w, err = wire.NewValueString(*(v.Reason)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 10, Value: w} + i++ + } + if v.Operator != nil { + w, err = wire.NewValueString(*(v.Operator)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 20, Value: w} + i++ + } + if v.CreatedTimeNano != nil { + w, err = wire.NewValueI64(*(v.CreatedTimeNano)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 30, Value: w} + i++ + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +// FromWire deserializes a BadBinaryInfo struct from its Thrift-level +// representation. The Thrift-level representation may be obtained +// from a ThriftRW protocol implementation. +// +// An error is returned if we were unable to build a BadBinaryInfo struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v BadBinaryInfo +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *BadBinaryInfo) FromWire(w wire.Value) error { + var err error + + for _, field := range w.GetStruct().Fields { + switch field.ID { + case 10: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.Reason = &x + if err != nil { + return err + } + + } + case 20: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.Operator = &x + if err != nil { + return err + } + + } + case 30: + if field.Value.Type() == wire.TI64 { + var x int64 + x, err = field.Value.GetI64(), error(nil) + v.CreatedTimeNano = &x + if err != nil { + return err + } + + } + } + } + + return nil +} + +// String returns a readable string representation of a BadBinaryInfo +// struct. +func (v *BadBinaryInfo) String() string { + if v == nil { + return "" + } + + var fields [3]string + i := 0 + if v.Reason != nil { + fields[i] = fmt.Sprintf("Reason: %v", *(v.Reason)) + i++ + } + if v.Operator != nil { + fields[i] = fmt.Sprintf("Operator: %v", *(v.Operator)) + i++ + } + if v.CreatedTimeNano != nil { + fields[i] = fmt.Sprintf("CreatedTimeNano: %v", *(v.CreatedTimeNano)) + i++ + } + + return fmt.Sprintf("BadBinaryInfo{%v}", strings.Join(fields[:i], ", ")) +} + +// Equals returns true if all the fields of this BadBinaryInfo match the +// provided BadBinaryInfo. +// +// This function performs a deep comparison. +func (v *BadBinaryInfo) Equals(rhs *BadBinaryInfo) bool { + if !_String_EqualsPtr(v.Reason, rhs.Reason) { + return false + } + if !_String_EqualsPtr(v.Operator, rhs.Operator) { + return false + } + if !_I64_EqualsPtr(v.CreatedTimeNano, rhs.CreatedTimeNano) { + return false + } + + return true +} + +// GetReason returns the value of Reason if it is set or its +// zero value if it is unset. +func (v *BadBinaryInfo) GetReason() (o string) { + if v.Reason != nil { + return *v.Reason + } + + return +} + +// GetOperator returns the value of Operator if it is set or its +// zero value if it is unset. +func (v *BadBinaryInfo) GetOperator() (o string) { + if v.Operator != nil { + return *v.Operator + } + + return +} + +// GetCreatedTimeNano returns the value of CreatedTimeNano if it is set or its +// zero value if it is unset. +func (v *BadBinaryInfo) GetCreatedTimeNano() (o int64) { + if v.CreatedTimeNano != nil { + return *v.CreatedTimeNano + } + + return +} + type BadRequestError struct { Message string `json:"message,required"` } @@ -10321,6 +10702,7 @@ type DomainConfiguration struct { ArchivalRetentionPeriodInDays *int32 `json:"archivalRetentionPeriodInDays,omitempty"` ArchivalStatus *ArchivalStatus `json:"archivalStatus,omitempty"` ArchivalBucketOwner *string `json:"archivalBucketOwner,omitempty"` + BadBinaries *BadBinaries `json:"badBinaries,omitempty"` } // ToWire translates a DomainConfiguration struct into a Thrift-level intermediate @@ -10340,7 +10722,7 @@ type DomainConfiguration struct { // } func (v *DomainConfiguration) ToWire() (wire.Value, error) { var ( - fields [6]wire.Field + fields [7]wire.Field i int = 0 w wire.Value err error @@ -10394,6 +10776,14 @@ func (v *DomainConfiguration) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 60, Value: w} i++ } + if v.BadBinaries != nil { + w, err = v.BadBinaries.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 70, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -10404,6 +10794,12 @@ func _ArchivalStatus_Read(w wire.Value) (ArchivalStatus, error) { return v, err } +func _BadBinaries_Read(w wire.Value) (*BadBinaries, error) { + var v BadBinaries + err := v.FromWire(w) + return &v, err +} + // FromWire deserializes a DomainConfiguration struct from its Thrift-level // representation. The Thrift-level representation may be obtained // from a ThriftRW protocol implementation. @@ -10485,6 +10881,14 @@ func (v *DomainConfiguration) FromWire(w wire.Value) error { return err } + } + case 70: + if field.Value.Type() == wire.TStruct { + v.BadBinaries, err = _BadBinaries_Read(field.Value) + if err != nil { + return err + } + } } } @@ -10499,7 +10903,7 @@ func (v *DomainConfiguration) String() string { return "" } - var fields [6]string + var fields [7]string i := 0 if v.WorkflowExecutionRetentionPeriodInDays != nil { fields[i] = fmt.Sprintf("WorkflowExecutionRetentionPeriodInDays: %v", *(v.WorkflowExecutionRetentionPeriodInDays)) @@ -10525,6 +10929,10 @@ func (v *DomainConfiguration) String() string { fields[i] = fmt.Sprintf("ArchivalBucketOwner: %v", *(v.ArchivalBucketOwner)) i++ } + if v.BadBinaries != nil { + fields[i] = fmt.Sprintf("BadBinaries: %v", v.BadBinaries) + i++ + } return fmt.Sprintf("DomainConfiguration{%v}", strings.Join(fields[:i], ", ")) } @@ -10562,6 +10970,9 @@ func (v *DomainConfiguration) Equals(rhs *DomainConfiguration) bool { if !_String_EqualsPtr(v.ArchivalBucketOwner, rhs.ArchivalBucketOwner) { return false } + if !((v.BadBinaries == nil && rhs.BadBinaries == nil) || (v.BadBinaries != nil && rhs.BadBinaries != nil && v.BadBinaries.Equals(rhs.BadBinaries))) { + return false + } return true } @@ -17114,6 +17525,346 @@ func (v *ListOpenWorkflowExecutionsResponse) Equals(rhs *ListOpenWorkflowExecuti return true } +type ListWorkflowExecutionsRequest struct { + Domain *string `json:"domain,omitempty"` + PageSize *int32 `json:"pageSize,omitempty"` + NextPageToken []byte `json:"nextPageToken,omitempty"` + Query *string `json:"query,omitempty"` +} + +// ToWire translates a ListWorkflowExecutionsRequest struct into a Thrift-level intermediate +// representation. This intermediate representation may be serialized +// into bytes using a ThriftRW protocol implementation. +// +// An error is returned if the struct or any of its fields failed to +// validate. +// +// x, err := v.ToWire() +// if err != nil { +// return err +// } +// +// if err := binaryProtocol.Encode(x, writer); err != nil { +// return err +// } +func (v *ListWorkflowExecutionsRequest) ToWire() (wire.Value, error) { + var ( + fields [4]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.Domain != nil { + w, err = wire.NewValueString(*(v.Domain)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 10, Value: w} + i++ + } + if v.PageSize != nil { + w, err = wire.NewValueI32(*(v.PageSize)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 20, Value: w} + i++ + } + if v.NextPageToken != nil { + w, err = wire.NewValueBinary(v.NextPageToken), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 30, Value: w} + i++ + } + if v.Query != nil { + w, err = wire.NewValueString(*(v.Query)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 40, Value: w} + i++ + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +// FromWire deserializes a ListWorkflowExecutionsRequest struct from its Thrift-level +// representation. The Thrift-level representation may be obtained +// from a ThriftRW protocol implementation. +// +// An error is returned if we were unable to build a ListWorkflowExecutionsRequest struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v ListWorkflowExecutionsRequest +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *ListWorkflowExecutionsRequest) FromWire(w wire.Value) error { + var err error + + for _, field := range w.GetStruct().Fields { + switch field.ID { + case 10: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.Domain = &x + if err != nil { + return err + } + + } + case 20: + if field.Value.Type() == wire.TI32 { + var x int32 + x, err = field.Value.GetI32(), error(nil) + v.PageSize = &x + if err != nil { + return err + } + + } + case 30: + if field.Value.Type() == wire.TBinary { + v.NextPageToken, err = field.Value.GetBinary(), error(nil) + if err != nil { + return err + } + + } + case 40: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.Query = &x + if err != nil { + return err + } + + } + } + } + + return nil +} + +// String returns a readable string representation of a ListWorkflowExecutionsRequest +// struct. +func (v *ListWorkflowExecutionsRequest) String() string { + if v == nil { + return "" + } + + var fields [4]string + i := 0 + if v.Domain != nil { + fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) + i++ + } + if v.PageSize != nil { + fields[i] = fmt.Sprintf("PageSize: %v", *(v.PageSize)) + i++ + } + if v.NextPageToken != nil { + fields[i] = fmt.Sprintf("NextPageToken: %v", v.NextPageToken) + i++ + } + if v.Query != nil { + fields[i] = fmt.Sprintf("Query: %v", *(v.Query)) + i++ + } + + return fmt.Sprintf("ListWorkflowExecutionsRequest{%v}", strings.Join(fields[:i], ", ")) +} + +// Equals returns true if all the fields of this ListWorkflowExecutionsRequest match the +// provided ListWorkflowExecutionsRequest. +// +// This function performs a deep comparison. +func (v *ListWorkflowExecutionsRequest) Equals(rhs *ListWorkflowExecutionsRequest) bool { + if !_String_EqualsPtr(v.Domain, rhs.Domain) { + return false + } + if !_I32_EqualsPtr(v.PageSize, rhs.PageSize) { + return false + } + if !((v.NextPageToken == nil && rhs.NextPageToken == nil) || (v.NextPageToken != nil && rhs.NextPageToken != nil && bytes.Equal(v.NextPageToken, rhs.NextPageToken))) { + return false + } + if !_String_EqualsPtr(v.Query, rhs.Query) { + return false + } + + return true +} + +// GetDomain returns the value of Domain if it is set or its +// zero value if it is unset. +func (v *ListWorkflowExecutionsRequest) GetDomain() (o string) { + if v.Domain != nil { + return *v.Domain + } + + return +} + +// GetPageSize returns the value of PageSize if it is set or its +// zero value if it is unset. +func (v *ListWorkflowExecutionsRequest) GetPageSize() (o int32) { + if v.PageSize != nil { + return *v.PageSize + } + + return +} + +// GetQuery returns the value of Query if it is set or its +// zero value if it is unset. +func (v *ListWorkflowExecutionsRequest) GetQuery() (o string) { + if v.Query != nil { + return *v.Query + } + + return +} + +type ListWorkflowExecutionsResponse struct { + Executions []*WorkflowExecutionInfo `json:"executions,omitempty"` + NextPageToken []byte `json:"nextPageToken,omitempty"` +} + +// ToWire translates a ListWorkflowExecutionsResponse struct into a Thrift-level intermediate +// representation. This intermediate representation may be serialized +// into bytes using a ThriftRW protocol implementation. +// +// An error is returned if the struct or any of its fields failed to +// validate. +// +// x, err := v.ToWire() +// if err != nil { +// return err +// } +// +// if err := binaryProtocol.Encode(x, writer); err != nil { +// return err +// } +func (v *ListWorkflowExecutionsResponse) ToWire() (wire.Value, error) { + var ( + fields [2]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.Executions != nil { + w, err = wire.NewValueList(_List_WorkflowExecutionInfo_ValueList(v.Executions)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 10, Value: w} + i++ + } + if v.NextPageToken != nil { + w, err = wire.NewValueBinary(v.NextPageToken), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 20, Value: w} + i++ + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +// FromWire deserializes a ListWorkflowExecutionsResponse struct from its Thrift-level +// representation. The Thrift-level representation may be obtained +// from a ThriftRW protocol implementation. +// +// An error is returned if we were unable to build a ListWorkflowExecutionsResponse struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v ListWorkflowExecutionsResponse +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *ListWorkflowExecutionsResponse) FromWire(w wire.Value) error { + var err error + + for _, field := range w.GetStruct().Fields { + switch field.ID { + case 10: + if field.Value.Type() == wire.TList { + v.Executions, err = _List_WorkflowExecutionInfo_Read(field.Value.GetList()) + if err != nil { + return err + } + + } + case 20: + if field.Value.Type() == wire.TBinary { + v.NextPageToken, err = field.Value.GetBinary(), error(nil) + if err != nil { + return err + } + + } + } + } + + return nil +} + +// String returns a readable string representation of a ListWorkflowExecutionsResponse +// struct. +func (v *ListWorkflowExecutionsResponse) String() string { + if v == nil { + return "" + } + + var fields [2]string + i := 0 + if v.Executions != nil { + fields[i] = fmt.Sprintf("Executions: %v", v.Executions) + i++ + } + if v.NextPageToken != nil { + fields[i] = fmt.Sprintf("NextPageToken: %v", v.NextPageToken) + i++ + } + + return fmt.Sprintf("ListWorkflowExecutionsResponse{%v}", strings.Join(fields[:i], ", ")) +} + +// Equals returns true if all the fields of this ListWorkflowExecutionsResponse match the +// provided ListWorkflowExecutionsResponse. +// +// This function performs a deep comparison. +func (v *ListWorkflowExecutionsResponse) Equals(rhs *ListWorkflowExecutionsResponse) bool { + if !((v.Executions == nil && rhs.Executions == nil) || (v.Executions != nil && rhs.Executions != nil && _List_WorkflowExecutionInfo_Equals(v.Executions, rhs.Executions))) { + return false + } + if !((v.NextPageToken == nil && rhs.NextPageToken == nil) || (v.NextPageToken != nil && rhs.NextPageToken != nil && bytes.Equal(v.NextPageToken, rhs.NextPageToken))) { + return false + } + + return true +} + type MarkerRecordedEventAttributes struct { MarkerName *string `json:"markerName,omitempty"` Details []byte `json:"details,omitempty"` @@ -22677,6 +23428,474 @@ func (v *RequestCancelWorkflowExecutionRequest) GetRequestId() (o string) { return } +type ResetPointInfo struct { + BinaryChecksum *string `json:"binaryChecksum,omitempty"` + RunId *string `json:"runId,omitempty"` + FirstDecisionCompletedId *int64 `json:"firstDecisionCompletedId,omitempty"` + CreatedTimeNano *int64 `json:"createdTimeNano,omitempty"` + ExpiringTimeNano *int64 `json:"expiringTimeNano,omitempty"` + Resettable *bool `json:"resettable,omitempty"` +} + +// ToWire translates a ResetPointInfo struct into a Thrift-level intermediate +// representation. This intermediate representation may be serialized +// into bytes using a ThriftRW protocol implementation. +// +// An error is returned if the struct or any of its fields failed to +// validate. +// +// x, err := v.ToWire() +// if err != nil { +// return err +// } +// +// if err := binaryProtocol.Encode(x, writer); err != nil { +// return err +// } +func (v *ResetPointInfo) ToWire() (wire.Value, error) { + var ( + fields [6]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.BinaryChecksum != nil { + w, err = wire.NewValueString(*(v.BinaryChecksum)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 10, Value: w} + i++ + } + if v.RunId != nil { + w, err = wire.NewValueString(*(v.RunId)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 20, Value: w} + i++ + } + if v.FirstDecisionCompletedId != nil { + w, err = wire.NewValueI64(*(v.FirstDecisionCompletedId)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 30, Value: w} + i++ + } + if v.CreatedTimeNano != nil { + w, err = wire.NewValueI64(*(v.CreatedTimeNano)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 40, Value: w} + i++ + } + if v.ExpiringTimeNano != nil { + w, err = wire.NewValueI64(*(v.ExpiringTimeNano)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 50, Value: w} + i++ + } + if v.Resettable != nil { + w, err = wire.NewValueBool(*(v.Resettable)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 60, Value: w} + i++ + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +// FromWire deserializes a ResetPointInfo struct from its Thrift-level +// representation. The Thrift-level representation may be obtained +// from a ThriftRW protocol implementation. +// +// An error is returned if we were unable to build a ResetPointInfo struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v ResetPointInfo +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *ResetPointInfo) FromWire(w wire.Value) error { + var err error + + for _, field := range w.GetStruct().Fields { + switch field.ID { + case 10: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.BinaryChecksum = &x + if err != nil { + return err + } + + } + case 20: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.RunId = &x + if err != nil { + return err + } + + } + case 30: + if field.Value.Type() == wire.TI64 { + var x int64 + x, err = field.Value.GetI64(), error(nil) + v.FirstDecisionCompletedId = &x + if err != nil { + return err + } + + } + case 40: + if field.Value.Type() == wire.TI64 { + var x int64 + x, err = field.Value.GetI64(), error(nil) + v.CreatedTimeNano = &x + if err != nil { + return err + } + + } + case 50: + if field.Value.Type() == wire.TI64 { + var x int64 + x, err = field.Value.GetI64(), error(nil) + v.ExpiringTimeNano = &x + if err != nil { + return err + } + + } + case 60: + if field.Value.Type() == wire.TBool { + var x bool + x, err = field.Value.GetBool(), error(nil) + v.Resettable = &x + if err != nil { + return err + } + + } + } + } + + return nil +} + +// String returns a readable string representation of a ResetPointInfo +// struct. +func (v *ResetPointInfo) String() string { + if v == nil { + return "" + } + + var fields [6]string + i := 0 + if v.BinaryChecksum != nil { + fields[i] = fmt.Sprintf("BinaryChecksum: %v", *(v.BinaryChecksum)) + i++ + } + if v.RunId != nil { + fields[i] = fmt.Sprintf("RunId: %v", *(v.RunId)) + i++ + } + if v.FirstDecisionCompletedId != nil { + fields[i] = fmt.Sprintf("FirstDecisionCompletedId: %v", *(v.FirstDecisionCompletedId)) + i++ + } + if v.CreatedTimeNano != nil { + fields[i] = fmt.Sprintf("CreatedTimeNano: %v", *(v.CreatedTimeNano)) + i++ + } + if v.ExpiringTimeNano != nil { + fields[i] = fmt.Sprintf("ExpiringTimeNano: %v", *(v.ExpiringTimeNano)) + i++ + } + if v.Resettable != nil { + fields[i] = fmt.Sprintf("Resettable: %v", *(v.Resettable)) + i++ + } + + return fmt.Sprintf("ResetPointInfo{%v}", strings.Join(fields[:i], ", ")) +} + +// Equals returns true if all the fields of this ResetPointInfo match the +// provided ResetPointInfo. +// +// This function performs a deep comparison. +func (v *ResetPointInfo) Equals(rhs *ResetPointInfo) bool { + if !_String_EqualsPtr(v.BinaryChecksum, rhs.BinaryChecksum) { + return false + } + if !_String_EqualsPtr(v.RunId, rhs.RunId) { + return false + } + if !_I64_EqualsPtr(v.FirstDecisionCompletedId, rhs.FirstDecisionCompletedId) { + return false + } + if !_I64_EqualsPtr(v.CreatedTimeNano, rhs.CreatedTimeNano) { + return false + } + if !_I64_EqualsPtr(v.ExpiringTimeNano, rhs.ExpiringTimeNano) { + return false + } + if !_Bool_EqualsPtr(v.Resettable, rhs.Resettable) { + return false + } + + return true +} + +// GetBinaryChecksum returns the value of BinaryChecksum if it is set or its +// zero value if it is unset. +func (v *ResetPointInfo) GetBinaryChecksum() (o string) { + if v.BinaryChecksum != nil { + return *v.BinaryChecksum + } + + return +} + +// GetRunId returns the value of RunId if it is set or its +// zero value if it is unset. +func (v *ResetPointInfo) GetRunId() (o string) { + if v.RunId != nil { + return *v.RunId + } + + return +} + +// GetFirstDecisionCompletedId returns the value of FirstDecisionCompletedId if it is set or its +// zero value if it is unset. +func (v *ResetPointInfo) GetFirstDecisionCompletedId() (o int64) { + if v.FirstDecisionCompletedId != nil { + return *v.FirstDecisionCompletedId + } + + return +} + +// GetCreatedTimeNano returns the value of CreatedTimeNano if it is set or its +// zero value if it is unset. +func (v *ResetPointInfo) GetCreatedTimeNano() (o int64) { + if v.CreatedTimeNano != nil { + return *v.CreatedTimeNano + } + + return +} + +// GetExpiringTimeNano returns the value of ExpiringTimeNano if it is set or its +// zero value if it is unset. +func (v *ResetPointInfo) GetExpiringTimeNano() (o int64) { + if v.ExpiringTimeNano != nil { + return *v.ExpiringTimeNano + } + + return +} + +// GetResettable returns the value of Resettable if it is set or its +// zero value if it is unset. +func (v *ResetPointInfo) GetResettable() (o bool) { + if v.Resettable != nil { + return *v.Resettable + } + + return +} + +type ResetPoints struct { + Points []*ResetPointInfo `json:"points,omitempty"` +} + +type _List_ResetPointInfo_ValueList []*ResetPointInfo + +func (v _List_ResetPointInfo_ValueList) ForEach(f func(wire.Value) error) error { + for i, x := range v { + if x == nil { + return fmt.Errorf("invalid [%v]: value is nil", i) + } + w, err := x.ToWire() + if err != nil { + return err + } + err = f(w) + if err != nil { + return err + } + } + return nil +} + +func (v _List_ResetPointInfo_ValueList) Size() int { + return len(v) +} + +func (_List_ResetPointInfo_ValueList) ValueType() wire.Type { + return wire.TStruct +} + +func (_List_ResetPointInfo_ValueList) Close() {} + +// ToWire translates a ResetPoints struct into a Thrift-level intermediate +// representation. This intermediate representation may be serialized +// into bytes using a ThriftRW protocol implementation. +// +// An error is returned if the struct or any of its fields failed to +// validate. +// +// x, err := v.ToWire() +// if err != nil { +// return err +// } +// +// if err := binaryProtocol.Encode(x, writer); err != nil { +// return err +// } +func (v *ResetPoints) ToWire() (wire.Value, error) { + var ( + fields [1]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.Points != nil { + w, err = wire.NewValueList(_List_ResetPointInfo_ValueList(v.Points)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 10, Value: w} + i++ + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +func _ResetPointInfo_Read(w wire.Value) (*ResetPointInfo, error) { + var v ResetPointInfo + err := v.FromWire(w) + return &v, err +} + +func _List_ResetPointInfo_Read(l wire.ValueList) ([]*ResetPointInfo, error) { + if l.ValueType() != wire.TStruct { + return nil, nil + } + + o := make([]*ResetPointInfo, 0, l.Size()) + err := l.ForEach(func(x wire.Value) error { + i, err := _ResetPointInfo_Read(x) + if err != nil { + return err + } + o = append(o, i) + return nil + }) + l.Close() + return o, err +} + +// FromWire deserializes a ResetPoints struct from its Thrift-level +// representation. The Thrift-level representation may be obtained +// from a ThriftRW protocol implementation. +// +// An error is returned if we were unable to build a ResetPoints struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v ResetPoints +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *ResetPoints) FromWire(w wire.Value) error { + var err error + + for _, field := range w.GetStruct().Fields { + switch field.ID { + case 10: + if field.Value.Type() == wire.TList { + v.Points, err = _List_ResetPointInfo_Read(field.Value.GetList()) + if err != nil { + return err + } + + } + } + } + + return nil +} + +// String returns a readable string representation of a ResetPoints +// struct. +func (v *ResetPoints) String() string { + if v == nil { + return "" + } + + var fields [1]string + i := 0 + if v.Points != nil { + fields[i] = fmt.Sprintf("Points: %v", v.Points) + i++ + } + + return fmt.Sprintf("ResetPoints{%v}", strings.Join(fields[:i], ", ")) +} + +func _List_ResetPointInfo_Equals(lhs, rhs []*ResetPointInfo) bool { + if len(lhs) != len(rhs) { + return false + } + + for i, lv := range lhs { + rv := rhs[i] + if !lv.Equals(rv) { + return false + } + } + + return true +} + +// Equals returns true if all the fields of this ResetPoints match the +// provided ResetPoints. +// +// This function performs a deep comparison. +func (v *ResetPoints) Equals(rhs *ResetPoints) bool { + if !((v.Points == nil && rhs.Points == nil) || (v.Points != nil && rhs.Points != nil && _List_ResetPointInfo_Equals(v.Points, rhs.Points))) { + return false + } + + return true +} + type ResetStickyTaskListRequest struct { Domain *string `json:"domain,omitempty"` Execution *WorkflowExecution `json:"execution,omitempty"` @@ -33235,6 +34454,7 @@ type UpdateDomainRequest struct { Configuration *DomainConfiguration `json:"configuration,omitempty"` ReplicationConfiguration *DomainReplicationConfiguration `json:"replicationConfiguration,omitempty"` SecurityToken *string `json:"securityToken,omitempty"` + DeleteBadBinary *string `json:"deleteBadBinary,omitempty"` } // ToWire translates a UpdateDomainRequest struct into a Thrift-level intermediate @@ -33254,7 +34474,7 @@ type UpdateDomainRequest struct { // } func (v *UpdateDomainRequest) ToWire() (wire.Value, error) { var ( - fields [5]wire.Field + fields [6]wire.Field i int = 0 w wire.Value err error @@ -33300,6 +34520,14 @@ func (v *UpdateDomainRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 50, Value: w} i++ } + if v.DeleteBadBinary != nil { + w, err = wire.NewValueString(*(v.DeleteBadBinary)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 60, Value: w} + i++ + } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } @@ -33375,6 +34603,16 @@ func (v *UpdateDomainRequest) FromWire(w wire.Value) error { return err } + } + case 60: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.DeleteBadBinary = &x + if err != nil { + return err + } + } } } @@ -33389,7 +34627,7 @@ func (v *UpdateDomainRequest) String() string { return "" } - var fields [5]string + var fields [6]string i := 0 if v.Name != nil { fields[i] = fmt.Sprintf("Name: %v", *(v.Name)) @@ -33411,6 +34649,10 @@ func (v *UpdateDomainRequest) String() string { fields[i] = fmt.Sprintf("SecurityToken: %v", *(v.SecurityToken)) i++ } + if v.DeleteBadBinary != nil { + fields[i] = fmt.Sprintf("DeleteBadBinary: %v", *(v.DeleteBadBinary)) + i++ + } return fmt.Sprintf("UpdateDomainRequest{%v}", strings.Join(fields[:i], ", ")) } @@ -33435,6 +34677,9 @@ func (v *UpdateDomainRequest) Equals(rhs *UpdateDomainRequest) bool { if !_String_EqualsPtr(v.SecurityToken, rhs.SecurityToken) { return false } + if !_String_EqualsPtr(v.DeleteBadBinary, rhs.DeleteBadBinary) { + return false + } return true } @@ -33459,6 +34704,16 @@ func (v *UpdateDomainRequest) GetSecurityToken() (o string) { return } +// GetDeleteBadBinary returns the value of DeleteBadBinary if it is set or its +// zero value if it is unset. +func (v *UpdateDomainRequest) GetDeleteBadBinary() (o string) { + if v.DeleteBadBinary != nil { + return *v.DeleteBadBinary + } + + return +} + type UpdateDomainResponse struct { DomainInfo *DomainInfo `json:"domainInfo,omitempty"` Configuration *DomainConfiguration `json:"configuration,omitempty"` @@ -36260,6 +37515,7 @@ type WorkflowExecutionStartedEventAttributes struct { CronSchedule *string `json:"cronSchedule,omitempty"` FirstDecisionTaskBackoffSeconds *int32 `json:"firstDecisionTaskBackoffSeconds,omitempty"` Memo *Memo `json:"memo,omitempty"` + PrevAutoResetPoints *ResetPoints `json:"prevAutoResetPoints,omitempty"` Header *Header `json:"header,omitempty"` } @@ -36280,7 +37536,7 @@ type WorkflowExecutionStartedEventAttributes struct { // } func (v *WorkflowExecutionStartedEventAttributes) ToWire() (wire.Value, error) { var ( - fields [22]wire.Field + fields [23]wire.Field i int = 0 w wire.Value err error @@ -36454,18 +37710,32 @@ func (v *WorkflowExecutionStartedEventAttributes) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 120, Value: w} i++ } + if v.PrevAutoResetPoints != nil { + w, err = v.PrevAutoResetPoints.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 130, Value: w} + i++ + } if v.Header != nil { w, err = v.Header.ToWire() if err != nil { return w, err } - fields[i] = wire.Field{ID: 130, Value: w} + fields[i] = wire.Field{ID: 140, Value: w} i++ } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } +func _ResetPoints_Read(w wire.Value) (*ResetPoints, error) { + var v ResetPoints + err := v.FromWire(w) + return &v, err +} + // FromWire deserializes a WorkflowExecutionStartedEventAttributes struct from its Thrift-level // representation. The Thrift-level representation may be obtained // from a ThriftRW protocol implementation. @@ -36683,6 +37953,14 @@ func (v *WorkflowExecutionStartedEventAttributes) FromWire(w wire.Value) error { } case 130: + if field.Value.Type() == wire.TStruct { + v.PrevAutoResetPoints, err = _ResetPoints_Read(field.Value) + if err != nil { + return err + } + + } + case 140: if field.Value.Type() == wire.TStruct { v.Header, err = _Header_Read(field.Value) if err != nil { @@ -36703,7 +37981,7 @@ func (v *WorkflowExecutionStartedEventAttributes) String() string { return "" } - var fields [22]string + var fields [23]string i := 0 if v.WorkflowType != nil { fields[i] = fmt.Sprintf("WorkflowType: %v", v.WorkflowType) @@ -36789,6 +38067,10 @@ func (v *WorkflowExecutionStartedEventAttributes) String() string { fields[i] = fmt.Sprintf("Memo: %v", v.Memo) i++ } + if v.PrevAutoResetPoints != nil { + fields[i] = fmt.Sprintf("PrevAutoResetPoints: %v", v.PrevAutoResetPoints) + i++ + } if v.Header != nil { fields[i] = fmt.Sprintf("Header: %v", v.Header) i++ @@ -36865,6 +38147,9 @@ func (v *WorkflowExecutionStartedEventAttributes) Equals(rhs *WorkflowExecutionS if !((v.Memo == nil && rhs.Memo == nil) || (v.Memo != nil && rhs.Memo != nil && v.Memo.Equals(rhs.Memo))) { return false } + if !((v.PrevAutoResetPoints == nil && rhs.PrevAutoResetPoints == nil) || (v.PrevAutoResetPoints != nil && rhs.PrevAutoResetPoints != nil && v.PrevAutoResetPoints.Equals(rhs.PrevAutoResetPoints))) { + return false + } if !((v.Header == nil && rhs.Header == nil) || (v.Header != nil && rhs.Header != nil && v.Header.Equals(rhs.Header))) { return false } diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index 68a31e1a0..6e02c44c9 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -455,7 +455,21 @@ struct WorkflowExecutionStartedEventAttributes { 100: optional string cronSchedule 110: optional i32 firstDecisionTaskBackoffSeconds 120: optional Memo memo - 130: optional Header header + 130: optional ResetPoints prevAutoResetPoints + 140: optional Header header +} + +struct ResetPoints{ + 10: optional list points +} + + struct ResetPointInfo{ + 10: optional string binaryChecksum + 20: optional string runId + 30: optional i64 firstDecisionCompletedId + 40: optional i64 (js.type = "Long") createdTimeNano + 50: optional i64 (js.type = "Long") expiringTimeNano //the time that the run is deleted due to retention + 60: optional bool resettable // false if the resset point has pending childWFs/reqCancels/signalExternals. } struct WorkflowExecutionCompletedEventAttributes { @@ -865,6 +879,17 @@ struct DomainConfiguration { 40: optional i32 archivalRetentionPeriodInDays 50: optional ArchivalStatus archivalStatus 60: optional string archivalBucketOwner + 70: optional BadBinaries badBinaries +} + +struct BadBinaries{ + 10: optional map binaries +} + +struct BadBinaryInfo{ + 10: optional string reason + 20: optional string operator + 30: optional i64 (js.type = "Long") createdTimeNano } struct UpdateDomainInfo { @@ -927,6 +952,7 @@ struct UpdateDomainRequest { 30: optional DomainConfiguration configuration 40: optional DomainReplicationConfiguration replicationConfiguration 50: optional string securityToken + 60: optional string deleteBadBinary } struct UpdateDomainResponse { @@ -1203,6 +1229,18 @@ struct ListClosedWorkflowExecutionsResponse { 20: optional binary nextPageToken } +struct ListWorkflowExecutionsRequest { + 10: optional string domain + 20: optional i32 pageSize + 30: optional binary nextPageToken + 40: optional string query +} + +struct ListWorkflowExecutionsResponse { + 10: optional list executions + 20: optional binary nextPageToken +} + struct QueryWorkflowRequest { 10: optional string domain 20: optional WorkflowExecution execution From f86c7a03332c1e8f70bad8bfb932a54ec9ecdd3d Mon Sep 17 00:00:00 2001 From: Shreyas Srivatsan Date: Tue, 30 Apr 2019 16:23:45 -0700 Subject: [PATCH 06/11] add test --- internal/headers_test.go | 134 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 133 insertions(+), 1 deletion(-) diff --git a/internal/headers_test.go b/internal/headers_test.go index cbd3a5342..b21a6b91d 100644 --- a/internal/headers_test.go +++ b/internal/headers_test.go @@ -20,16 +20,148 @@ package internal -import "testing" +import ( + "context" + "testing" + + "github.com/opentracing/opentracing-go" + "github.com/stretchr/testify/assert" + "go.uber.org/cadence/.gen/go/shared" +) func TestHeaderWriter(t *testing.T) { + tests := []struct { + name string + initial *shared.Header + expected *shared.Header + vals map[string][]byte + }{ + { + "no values", + &shared.Header{ + Fields: map[string][]byte{}, + }, + &shared.Header{ + Fields: map[string][]byte{}, + }, + map[string][]byte{}, + }, + { + "add values", + &shared.Header{ + Fields: map[string][]byte{}, + }, + &shared.Header{ + Fields: map[string][]byte{ + "key1": []byte("val1"), + "key2": []byte("val2"), + }, + }, + map[string][]byte{ + "key1": []byte("val1"), + "key2": []byte("val2"), + }, + }, + { + "overwrite values", + &shared.Header{ + Fields: map[string][]byte{ + "key1": []byte("unexpected"), + }, + }, + &shared.Header{ + Fields: map[string][]byte{ + "key1": []byte("val1"), + "key2": []byte("val2"), + }, + }, + map[string][]byte{ + "key1": []byte("val1"), + "key2": []byte("val2"), + }, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + writer := NewHeaderWriter(test.initial) + for key, val := range test.vals { + writer.Set(key, val) + } + assert.Equal(t, test.expected, test.initial) + }) + } } func TestHeaderReader(t *testing.T) { + tests := []struct { + name string + header *shared.Header + keys map[string]struct{} + isError bool + }{ + { + "valid values", + &shared.Header{ + Fields: map[string][]byte{ + "key1": []byte("val1"), + "key2": []byte("val2"), + }, + }, + map[string]struct{}{"key1": struct{}{}, "key2": struct{}{}}, + false, + }, + { + "invalid values", + &shared.Header{ + Fields: map[string][]byte{ + "key1": []byte("val1"), + "key2": []byte("val2"), + }, + }, + map[string]struct{}{"key2": struct{}{}}, + true, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + reader := NewHeaderReader(test.header) + err := reader.ForEachKey(func(key string, val []byte) error { + if _, ok := test.keys[key]; !ok { + return assert.AnError + } + return nil + }) + if test.isError { + assert.Error(t, err) + } else { + assert.NoError(t, err) + } + }) + } } func TestTracingContextPropagator(t *testing.T) { + ctxProp := NewTracingContextPropagator(nil) + + tracer := opentracing.NoopTracer{} + span := tracer.StartSpan("test-operation") + ctx := context.Background() + ctx = opentracing.ContextWithSpan(ctx, span) + header := &shared.Header{ + Fields: map[string][]byte{}, + } + + err := ctxProp.Inject(ctx, NewHeaderWriter(header)) + assert.NoError(t, err) + + _, ok := header.Fields[tracingKey] + assert.True(t, ok) + returnCtx := context.Background() + returnCtx, err = ctxProp.Extract(returnCtx, NewHeaderReader(header)) + assert.NoError(t, err) + newSpan := opentracing.SpanFromContext(returnCtx) + assert.Equal(t, span, newSpan) } From 945c5ce71858eef36627640c687f8ee78ea74696 Mon Sep 17 00:00:00 2001 From: Shreyas Srivatsan Date: Tue, 30 Apr 2019 21:29:50 -0700 Subject: [PATCH 07/11] fix tracing propagator --- internal/headers.go | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/internal/headers.go b/internal/headers.go index 82f6d8db2..cd047b537 100644 --- a/internal/headers.go +++ b/internal/headers.go @@ -25,7 +25,6 @@ import ( "github.com/opentracing/opentracing-go" "go.uber.org/cadence/.gen/go/shared" - "go.uber.org/cadence/encoded" ) // HeaderWriter is an interface to write information to cadence headers @@ -57,17 +56,14 @@ type ContextPropagator interface { } // NewTracingContextPropagator returns new tracing context propagator object -func NewTracingContextPropagator(dataConverter encoded.DataConverter) ContextPropagator { - if dataConverter == nil { - dataConverter = getDefaultDataConverter() - } - return &tracingContextPropagator{dataConverter} +func NewTracingContextPropagator() ContextPropagator { + return &tracingContextPropagator{} } const tracingKey = "tracingContextKey" type tracingContextPropagator struct { - converter encoded.DataConverter + tracer opentracing.Tracer } func (t *tracingContextPropagator) Inject( @@ -77,12 +73,7 @@ func (t *tracingContextPropagator) Inject( // retrieve span from context object span := opentracing.SpanFromContext(ctx) - // marshal span object - data, err := t.converter.ToData(span) - if err != nil { - return err - } - hw.Set(tracingKey, data) + t.tracer.Inject(span.Context(), opentracing.HTTPHeaders, hw) return nil } @@ -92,11 +83,6 @@ func (t *tracingContextPropagator) Extract( ) (context.Context, error) { err := hr.ForEachKey(func(key string, value []byte) error { if key == tracingKey { - var span opentracing.Span - if err := t.converter.FromData(value, &span); err != nil { - return err - } - ctx = opentracing.ContextWithSpan(ctx, span) return nil } return nil @@ -114,12 +100,7 @@ func (t *tracingContextPropagator) InjectFromWorkflow( // retrieve span from context object span := spanFromContext(ctx) - // marshal span object - data, err := t.converter.ToData(span) - if err != nil { - return err - } - hw.Set(tracingKey, data) + t.tracer.Inject(span.Context(), opentracing.HTTPHeaders, hw) return nil } @@ -129,11 +110,6 @@ func (t *tracingContextPropagator) ExtractToWorkflow( ) (Context, error) { err := hr.ForEachKey(func(key string, value []byte) error { if key == tracingKey { - var span opentracing.Span - if err := t.converter.FromData(value, &span); err != nil { - return err - } - ctx = contextWithSpan(ctx, span) return nil } return nil From 78c970f9ee0793e21cdc0f73a283f8aee1938f25 Mon Sep 17 00:00:00 2001 From: Shreyas Srivatsan Date: Wed, 1 May 2019 09:38:26 -0700 Subject: [PATCH 08/11] fix --- internal/headers_test.go | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/headers_test.go b/internal/headers_test.go index b21a6b91d..40fe9b40d 100644 --- a/internal/headers_test.go +++ b/internal/headers_test.go @@ -21,10 +21,8 @@ package internal import ( - "context" "testing" - "github.com/opentracing/opentracing-go" "github.com/stretchr/testify/assert" "go.uber.org/cadence/.gen/go/shared" ) @@ -143,25 +141,27 @@ func TestHeaderReader(t *testing.T) { } func TestTracingContextPropagator(t *testing.T) { - ctxProp := NewTracingContextPropagator(nil) + /* + ctxProp := NewTracingContextPropagator() - tracer := opentracing.NoopTracer{} - span := tracer.StartSpan("test-operation") - ctx := context.Background() - ctx = opentracing.ContextWithSpan(ctx, span) - header := &shared.Header{ - Fields: map[string][]byte{}, - } + tracer := opentracing.NoopTracer{} + span := tracer.StartSpan("test-operation") + ctx := context.Background() + ctx = opentracing.ContextWithSpan(ctx, span) + header := &shared.Header{ + Fields: map[string][]byte{}, + } - err := ctxProp.Inject(ctx, NewHeaderWriter(header)) - assert.NoError(t, err) + err := ctxProp.Inject(ctx, NewHeaderWriter(header)) + assert.NoError(t, err) - _, ok := header.Fields[tracingKey] - assert.True(t, ok) + _, ok := header.Fields[tracingKey] + assert.True(t, ok) - returnCtx := context.Background() - returnCtx, err = ctxProp.Extract(returnCtx, NewHeaderReader(header)) - assert.NoError(t, err) - newSpan := opentracing.SpanFromContext(returnCtx) - assert.Equal(t, span, newSpan) + returnCtx := context.Background() + returnCtx, err = ctxProp.Extract(returnCtx, NewHeaderReader(header)) + assert.NoError(t, err) + newSpan := opentracing.SpanFromContext(returnCtx) + assert.Equal(t, span, newSpan) + */ } From 160b00e6baf26886127165a23c6f3a734c35772b Mon Sep 17 00:00:00 2001 From: Shreyas Srivatsan Date: Wed, 1 May 2019 12:31:01 -0700 Subject: [PATCH 09/11] Fix up tracing propagator --- Gopkg.lock | 38 +++++++++++++++ Gopkg.toml | 4 ++ internal/headers.go | 66 -------------------------- internal/headers_test.go | 26 ---------- internal/tracer.go | 100 +++++++++++++++++++++++++++++++++++++++ internal/tracer_test.go | 57 ++++++++++++++++++++++ 6 files changed, 199 insertions(+), 92 deletions(-) create mode 100644 internal/tracer.go create mode 100644 internal/tracer_test.go diff --git a/Gopkg.lock b/Gopkg.lock index cbfca9d68..43ff1baa0 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -16,6 +16,14 @@ pruneopts = "" revision = "3a771d992973f24aa725d07868b467d1ddfceafb" +[[projects]] + branch = "master" + digest = "1:c46fd324e7902268373e1b337436a6377c196e2dbd7b35624c6256d29d494e78" + name = "github.com/codahale/hdrhistogram" + packages = ["."] + pruneopts = "" + revision = "3a0bb77429bd3a61596f5e8a3172445844342120" + [[projects]] digest = "1:56c130d885a4aacae1dd9c7b71cfe39912c7ebc1ff7d2b46083c8812996dc43b" name = "github.com/davecgh/go-spew" @@ -169,6 +177,34 @@ revision = "6c4631652c6aab57c64f65c2e0aaec2e9aae3a64" version = "v3.3.1" +[[projects]] + digest = "1:941ab4973b3218a9a6d02d31734f5c762239eb538c0d702fff62d4037af8ab0a" + name = "github.com/uber/jaeger-client-go" + packages = [ + ".", + "internal/baggage", + "internal/spanlog", + "internal/throttler", + "log", + "thrift", + "thrift-gen/agent", + "thrift-gen/jaeger", + "thrift-gen/sampling", + "thrift-gen/zipkincore", + "utils", + ] + pruneopts = "" + revision = "1a782e2da844727691fef1757c72eb190c2909f0" + version = "v2.15.0" + +[[projects]] + digest = "1:aa1598d34009b45ce74fdabdd25e4258d7923d1e1b418d4c98482e79607cb9b0" + name = "github.com/uber/jaeger-lib" + packages = ["metrics"] + pruneopts = "" + revision = "ed3a127ec5fef7ae9ea95b01b542c47fbd999ce5" + version = "v1.5.0" + [[projects]] digest = "1:e04fd5ac3dc6bde26e35bc7612df4df3326fa10e75883dd16eca84014e531089" name = "github.com/uber/tchannel-go" @@ -305,6 +341,7 @@ "github.com/apache/thrift/lib/go/thrift", "github.com/facebookgo/clock", "github.com/golang/mock/gomock", + "github.com/opentracing/opentracing-go", "github.com/pborman/uuid", "github.com/robfig/cron", "github.com/sirupsen/logrus", @@ -313,6 +350,7 @@ "github.com/stretchr/testify/require", "github.com/stretchr/testify/suite", "github.com/uber-go/tally", + "github.com/uber/jaeger-client-go", "github.com/uber/tchannel-go/thrift", "go.uber.org/atomic", "go.uber.org/thriftrw/thriftreflect", diff --git a/Gopkg.toml b/Gopkg.toml index aaf0cfe2c..30eaf9bfc 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -85,3 +85,7 @@ ignored = ["go.uber.org/cadence/.tmp"] [[constraint]] name = "github.com/robfig/cron" version = "1.1.0" + +[[constraint]] + name = "github.com/uber/jaeger-client-go" + version = "2.15.0" diff --git a/internal/headers.go b/internal/headers.go index cd047b537..a5a356a61 100644 --- a/internal/headers.go +++ b/internal/headers.go @@ -23,7 +23,6 @@ package internal import ( "context" - "github.com/opentracing/opentracing-go" "go.uber.org/cadence/.gen/go/shared" ) @@ -55,71 +54,6 @@ type ContextPropagator interface { ExtractToWorkflow(Context, HeaderReader) (Context, error) } -// NewTracingContextPropagator returns new tracing context propagator object -func NewTracingContextPropagator() ContextPropagator { - return &tracingContextPropagator{} -} - -const tracingKey = "tracingContextKey" - -type tracingContextPropagator struct { - tracer opentracing.Tracer -} - -func (t *tracingContextPropagator) Inject( - ctx context.Context, - hw HeaderWriter, -) error { - // retrieve span from context object - span := opentracing.SpanFromContext(ctx) - - t.tracer.Inject(span.Context(), opentracing.HTTPHeaders, hw) - return nil -} - -func (t *tracingContextPropagator) Extract( - ctx context.Context, - hr HeaderReader, -) (context.Context, error) { - err := hr.ForEachKey(func(key string, value []byte) error { - if key == tracingKey { - return nil - } - return nil - }) - if err != nil { - return nil, err - } - return ctx, nil -} - -func (t *tracingContextPropagator) InjectFromWorkflow( - ctx Context, - hw HeaderWriter, -) error { - // retrieve span from context object - span := spanFromContext(ctx) - - t.tracer.Inject(span.Context(), opentracing.HTTPHeaders, hw) - return nil -} - -func (t *tracingContextPropagator) ExtractToWorkflow( - ctx Context, - hr HeaderReader, -) (Context, error) { - err := hr.ForEachKey(func(key string, value []byte) error { - if key == tracingKey { - return nil - } - return nil - }) - if err != nil { - return nil, err - } - return ctx, nil -} - type headerReader struct { header *shared.Header } diff --git a/internal/headers_test.go b/internal/headers_test.go index 40fe9b40d..625b1e95f 100644 --- a/internal/headers_test.go +++ b/internal/headers_test.go @@ -139,29 +139,3 @@ func TestHeaderReader(t *testing.T) { }) } } - -func TestTracingContextPropagator(t *testing.T) { - /* - ctxProp := NewTracingContextPropagator() - - tracer := opentracing.NoopTracer{} - span := tracer.StartSpan("test-operation") - ctx := context.Background() - ctx = opentracing.ContextWithSpan(ctx, span) - header := &shared.Header{ - Fields: map[string][]byte{}, - } - - err := ctxProp.Inject(ctx, NewHeaderWriter(header)) - assert.NoError(t, err) - - _, ok := header.Fields[tracingKey] - assert.True(t, ok) - - returnCtx := context.Background() - returnCtx, err = ctxProp.Extract(returnCtx, NewHeaderReader(header)) - assert.NoError(t, err) - newSpan := opentracing.SpanFromContext(returnCtx) - assert.Equal(t, span, newSpan) - */ -} diff --git a/internal/tracer.go b/internal/tracer.go new file mode 100644 index 000000000..5190c877d --- /dev/null +++ b/internal/tracer.go @@ -0,0 +1,100 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package internal + +import ( + "context" + + "github.com/opentracing/opentracing-go" + "github.com/opentracing/opentracing-go/ext" +) + +// NewTracingContextPropagator returns new tracing context propagator object +func NewTracingContextPropagator(tracer opentracing.Tracer) ContextPropagator { + return &tracingContextPropagator{tracer} +} + +type tracingReader struct { + reader HeaderReader +} + +func (t tracingReader) ForeachKey(handler func(key, val string) error) error { + return t.reader.ForEachKey(func(k string, v []byte) error { + return handler(k, string(v)) + }) +} + +type tracingWriter struct { + writer HeaderWriter +} + +func (t tracingWriter) Set(key, val string) { + t.writer.Set(key, []byte(val)) +} + +type tracingContextPropagator struct { + tracer opentracing.Tracer +} + +func (t *tracingContextPropagator) Inject( + ctx context.Context, + hw HeaderWriter, +) error { + // retrieve span from context object + span := opentracing.SpanFromContext(ctx) + + return t.tracer.Inject(span.Context(), opentracing.TextMap, tracingWriter{hw}) +} + +func (t *tracingContextPropagator) Extract( + ctx context.Context, + hr HeaderReader, +) (context.Context, error) { + spanContext, err := t.tracer.Extract(opentracing.TextMap, tracingReader{hr}) + if err != nil { + return nil, err + } + span := t.tracer.StartSpan("test-operation", ext.RPCServerOption(spanContext)) + return opentracing.ContextWithSpan(ctx, span), nil +} + +func (t *tracingContextPropagator) InjectFromWorkflow( + ctx Context, + hw HeaderWriter, +) error { + // retrieve span from context object + span := spanFromContext(ctx) + + t.tracer.Inject(span.Context(), opentracing.HTTPHeaders, hw) + return nil +} + +func (t *tracingContextPropagator) ExtractToWorkflow( + ctx Context, + hr HeaderReader, +) (Context, error) { + spanContext, err := t.tracer.Extract(opentracing.TextMap, hr) + if err != nil { + return nil, err + } + span := t.tracer.StartSpan("test-operation", ext.RPCServerOption(spanContext)) + return contextWithSpan(ctx, span), nil +} diff --git a/internal/tracer_test.go b/internal/tracer_test.go new file mode 100644 index 000000000..19658b5a8 --- /dev/null +++ b/internal/tracer_test.go @@ -0,0 +1,57 @@ +// Copyright (c) 2017 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package internal + +import ( + "context" + "testing" + + "github.com/opentracing/opentracing-go" + "github.com/stretchr/testify/assert" + jaeger_config "github.com/uber/jaeger-client-go/config" + "go.uber.org/cadence/.gen/go/shared" +) + +func TestTracingContextPropagator(t *testing.T) { + config := jaeger_config.Configuration{} + closer, err := config.InitGlobalTracer("test-service") + assert.NoError(t, err) + defer closer.Close() + tracer := opentracing.GlobalTracer() + ctxProp := NewTracingContextPropagator(tracer) + + span := tracer.StartSpan("test-operation") + ctx := context.Background() + ctx = opentracing.ContextWithSpan(ctx, span) + header := &shared.Header{ + Fields: map[string][]byte{}, + } + + err = ctxProp.Inject(ctx, NewHeaderWriter(header)) + assert.NoError(t, err) + + returnCtx := context.Background() + returnCtx, err = ctxProp.Extract(returnCtx, NewHeaderReader(header)) + assert.NoError(t, err) + + span = opentracing.SpanFromContext(returnCtx) + assert.NotNil(t, span) +} From d7e06ac2cc9802a50303fd84fc617257cab40f01 Mon Sep 17 00:00:00 2001 From: Shreyas Srivatsan Date: Wed, 1 May 2019 12:49:49 -0700 Subject: [PATCH 10/11] more tracer tests --- internal/context.go | 4 ++++ internal/tracer.go | 8 ++++---- internal/tracer_test.go | 25 +++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/internal/context.go b/internal/context.go index 152a86af3..f60ce9344 100644 --- a/internal/context.go +++ b/internal/context.go @@ -164,6 +164,10 @@ var ( todo = new(emptyCtx) ) +func Background() Context { + return background +} + // ErrCanceled is the error returned by Context.Err when the context is canceled. var ErrCanceled = NewCanceledError() diff --git a/internal/tracer.go b/internal/tracer.go index 5190c877d..291d5d977 100644 --- a/internal/tracer.go +++ b/internal/tracer.go @@ -72,7 +72,7 @@ func (t *tracingContextPropagator) Extract( if err != nil { return nil, err } - span := t.tracer.StartSpan("test-operation", ext.RPCServerOption(spanContext)) + span := t.tracer.StartSpan("", ext.RPCServerOption(spanContext)) return opentracing.ContextWithSpan(ctx, span), nil } @@ -83,7 +83,7 @@ func (t *tracingContextPropagator) InjectFromWorkflow( // retrieve span from context object span := spanFromContext(ctx) - t.tracer.Inject(span.Context(), opentracing.HTTPHeaders, hw) + t.tracer.Inject(span.Context(), opentracing.HTTPHeaders, tracingWriter{hw}) return nil } @@ -91,10 +91,10 @@ func (t *tracingContextPropagator) ExtractToWorkflow( ctx Context, hr HeaderReader, ) (Context, error) { - spanContext, err := t.tracer.Extract(opentracing.TextMap, hr) + spanContext, err := t.tracer.Extract(opentracing.TextMap, tracingReader{hr}) if err != nil { return nil, err } - span := t.tracer.StartSpan("test-operation", ext.RPCServerOption(spanContext)) + span := t.tracer.StartSpan("", ext.RPCServerOption(spanContext)) return contextWithSpan(ctx, span), nil } diff --git a/internal/tracer_test.go b/internal/tracer_test.go index 19658b5a8..1ded76278 100644 --- a/internal/tracer_test.go +++ b/internal/tracer_test.go @@ -55,3 +55,28 @@ func TestTracingContextPropagator(t *testing.T) { span = opentracing.SpanFromContext(returnCtx) assert.NotNil(t, span) } + +func TestTracingContextPropagatorWorkflowContext(t *testing.T) { + config := jaeger_config.Configuration{} + closer, err := config.InitGlobalTracer("test-service") + assert.NoError(t, err) + defer closer.Close() + tracer := opentracing.GlobalTracer() + ctxProp := NewTracingContextPropagator(tracer) + + span := tracer.StartSpan("test-operation") + ctx := contextWithSpan(Background(), span) + header := &shared.Header{ + Fields: map[string][]byte{}, + } + + err = ctxProp.InjectFromWorkflow(ctx, NewHeaderWriter(header)) + assert.NoError(t, err) + + returnCtx := Background() + returnCtx, err = ctxProp.ExtractToWorkflow(returnCtx, NewHeaderReader(header)) + assert.NoError(t, err) + + span = spanFromContext(returnCtx) + assert.NotNil(t, span) +} From 95f4fd1e79c2933ad24380878c547654f3b655a7 Mon Sep 17 00:00:00 2001 From: Shreyas Srivatsan Date: Wed, 1 May 2019 14:57:43 -0700 Subject: [PATCH 11/11] add more test --- Gopkg.lock | 17 ++++- internal/headers.go | 9 +++ internal/internal_activity.go | 1 + internal/internal_event_handlers.go | 1 + internal/internal_workflow.go | 17 +++++ internal/internal_workflow_client_test.go | 30 ++++++++ internal/internal_workflow_testsuite.go | 15 +++- internal/internal_workflow_testsuite_test.go | 80 ++++++++++++++++++++ internal/workflow.go | 4 + internal/workflow_testsuite.go | 59 +++++++++++++++ 10 files changed, 231 insertions(+), 2 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 43ff1baa0..6d12b82c2 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -83,6 +83,14 @@ revision = "a97ce2ca70fa5a848076093f05e639a89ca34d06" version = "v1.0" +[[projects]] + digest = "1:1d7e1867c49a6dd9856598ef7c3123604ea3daabf5b83f303ff457bcbc410b1d" + name = "github.com/pkg/errors" + packages = ["."] + pruneopts = "" + revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4" + version = "v0.8.1" + [[projects]] digest = "1:256484dbbcd271f9ecebc6795b2df8cad4c458dd0f5fd82a8c2fa0c29f233411" name = "github.com/pmezard/go-difflib" @@ -182,15 +190,21 @@ name = "github.com/uber/jaeger-client-go" packages = [ ".", + "config", "internal/baggage", + "internal/baggage/remote", "internal/spanlog", "internal/throttler", + "internal/throttler/remote", "log", + "rpcmetrics", "thrift", "thrift-gen/agent", + "thrift-gen/baggage", "thrift-gen/jaeger", "thrift-gen/sampling", "thrift-gen/zipkincore", + "transport", "utils", ] pruneopts = "" @@ -342,6 +356,7 @@ "github.com/facebookgo/clock", "github.com/golang/mock/gomock", "github.com/opentracing/opentracing-go", + "github.com/opentracing/opentracing-go/ext", "github.com/pborman/uuid", "github.com/robfig/cron", "github.com/sirupsen/logrus", @@ -350,7 +365,7 @@ "github.com/stretchr/testify/require", "github.com/stretchr/testify/suite", "github.com/uber-go/tally", - "github.com/uber/jaeger-client-go", + "github.com/uber/jaeger-client-go/config", "github.com/uber/tchannel-go/thrift", "go.uber.org/atomic", "go.uber.org/thriftrw/thriftreflect", diff --git a/internal/headers.go b/internal/headers.go index a5a356a61..b644d69be 100644 --- a/internal/headers.go +++ b/internal/headers.go @@ -59,6 +59,9 @@ type headerReader struct { } func (hr *headerReader) ForEachKey(handler func(string, []byte) error) error { + if hr.header == nil { + return nil + } for key, value := range hr.header.Fields { if err := handler(key, value); err != nil { return err @@ -77,10 +80,16 @@ type headerWriter struct { } func (hw *headerWriter) Set(key string, value []byte) { + if hw.header == nil { + return + } hw.header.Fields[key] = value } // NewHeaderWriter returns a header writer interface func NewHeaderWriter(header *shared.Header) HeaderWriter { + if header != nil && header.Fields == nil { + header.Fields = make(map[string][]byte) + } return &headerWriter{header} } diff --git a/internal/internal_activity.go b/internal/internal_activity.go index cde7b64d4..6acc3a7ad 100644 --- a/internal/internal_activity.go +++ b/internal/internal_activity.go @@ -75,6 +75,7 @@ type ( ActivityType ActivityType Input []byte DataConverter encoded.DataConverter + Header *shared.Header } executeLocalActivityParams struct { diff --git a/internal/internal_event_handlers.go b/internal/internal_event_handlers.go index b9c11466d..e8145f6ff 100644 --- a/internal/internal_event_handlers.go +++ b/internal/internal_event_handlers.go @@ -383,6 +383,7 @@ func (wc *workflowEnvironmentImpl) ExecuteActivity(parameters executeActivityPar scheduleTaskAttr.ScheduleToStartTimeoutSeconds = common.Int32Ptr(parameters.ScheduleToStartTimeoutSeconds) scheduleTaskAttr.HeartbeatTimeoutSeconds = common.Int32Ptr(parameters.HeartbeatTimeoutSeconds) scheduleTaskAttr.RetryPolicy = parameters.RetryPolicy + scheduleTaskAttr.Header = parameters.Header decision := wc.decisionsHelper.scheduleActivityTask(scheduleTaskAttr) decision.setData(&scheduledActivity{ diff --git a/internal/internal_workflow.go b/internal/internal_workflow.go index 109b7afac..e068d7255 100644 --- a/internal/internal_workflow.go +++ b/internal/internal_workflow.go @@ -37,6 +37,7 @@ import ( "github.com/uber-go/tally" "go.uber.org/atomic" "go.uber.org/cadence/.gen/go/shared" + s "go.uber.org/cadence/.gen/go/shared" "go.uber.org/cadence/encoded" "go.uber.org/cadence/internal/common" "go.uber.org/cadence/internal/common/metrics" @@ -1172,6 +1173,22 @@ func getDataConverterFromWorkflowContext(ctx Context) encoded.DataConverter { return options.dataConverter } +func getContextPropagatorsFromWorkflowContext(ctx Context) []ContextPropagator { + options := getWorkflowEnvOptions(ctx) + return options.contextPropagators +} + +func getHeadersFromContext(ctx Context) *shared.Header { + header := &s.Header{ + Fields: make(map[string][]byte), + } + contextPropagators := getContextPropagatorsFromWorkflowContext(ctx) + for _, ctxProp := range contextPropagators { + ctxProp.InjectFromWorkflow(ctx, NewHeaderWriter(header)) + } + return header +} + // getSignalChannel finds the associated channel for the signal. func (w *workflowOptions) getSignalChannel(ctx Context, signalName string) Channel { if ch, ok := w.signalChannels[signalName]; ok { diff --git a/internal/internal_workflow_client_test.go b/internal/internal_workflow_client_test.go index 65686df95..dfd3e9612 100644 --- a/internal/internal_workflow_client_test.go +++ b/internal/internal_workflow_client_test.go @@ -22,6 +22,7 @@ package internal import ( "context" "errors" + "fmt" "log" "os" "testing" @@ -748,6 +749,35 @@ func (s *workflowClientTestSuite) TestStartWorkflow() { s.Equal(createResponse.GetRunId(), resp.RunID) } +func (s *workflowClientTestSuite) TestStartWorkflow_WithContext() { + s.client = NewClient(s.service, domain, &ClientOptions{ContextPropagators: []ContextPropagator{&TestContextPropagator{keys: []string{testHeader}}}}) + client, ok := s.client.(*workflowClient) + s.True(ok) + options := StartWorkflowOptions{ + ID: workflowID, + TaskList: tasklist, + ExecutionStartToCloseTimeout: timeoutInSeconds, + DecisionTaskStartToCloseTimeout: timeoutInSeconds, + } + f1 := func(ctx Context, r []byte) error { + value := ctx.Value(contextKey(testHeader)) + if val, ok := value.([]byte); ok { + s.Equal("test-data", string(val)) + return nil + } + return fmt.Errorf("context did not propagate to workflow") + } + + createResponse := &shared.StartWorkflowExecutionResponse{ + RunId: common.StringPtr(runID), + } + s.service.EXPECT().StartWorkflowExecution(gomock.Any(), gomock.Any(), gomock.Any()).Return(createResponse, nil) + + resp, err := client.StartWorkflow(context.Background(), options, f1, []byte("test")) + s.Nil(err) + s.Equal(createResponse.GetRunId(), resp.RunID) +} + func (s *workflowClientTestSuite) TestStartWorkflow_WithDataConverter() { dc := newTestDataConverter() s.client = NewClient(s.service, domain, &ClientOptions{DataConverter: dc}) diff --git a/internal/internal_workflow_testsuite.go b/internal/internal_workflow_testsuite.go index a02f90c15..46b4c4652 100644 --- a/internal/internal_workflow_testsuite.go +++ b/internal/internal_workflow_testsuite.go @@ -52,6 +52,7 @@ const ( defaultTestWorkflowTypeName = "default-test-workflow-type-name" defaultTestDomainName = "default-test-domain-name" workflowTypeNotSpecified = "workflow-type-not-specified" + testHeader = "test-header" ) type ( @@ -283,6 +284,7 @@ func newTestWorkflowEnvironmentImpl(s *WorkflowTestSuite) *testWorkflowEnvironme if env.workerOptions.DataConverter == nil { env.workerOptions.DataConverter = getDefaultDataConverter() } + env.workerOptions.ContextPropagators = append(env.workerOptions.ContextPropagators, &TestContextPropagator{keys: []string{testHeader}}) return env } @@ -404,11 +406,16 @@ func (env *testWorkflowEnvironmentImpl) executeWorkflowInternal(delayStart time. panic(err) } env.workflowDef = workflowDefinition + header := &shared.Header{ + Fields: map[string][]byte{ + "test-header": []byte("test-data"), + }, + } // env.workflowDef.Execute() method will execute dispatcher. We want the dispatcher to only run in main loop. // In case of child workflow, this executeWorkflowInternal() is run in separate goroutinue, so use postCallback // to make sure workflowDef.Execute() is run in main loop. env.postCallback(func() { - env.workflowDef.Execute(env, &shared.Header{}, input) + env.workflowDef.Execute(env, header, input) // kick off first decision task to start the workflow if delayStart == 0 { env.startDecisionTask() @@ -463,6 +470,11 @@ func (env *testWorkflowEnvironmentImpl) executeActivity( }, ActivityType: *activityType, Input: input, + Header: &shared.Header{ + Fields: map[string][]byte{ + testHeader: []byte("test-data"), + }, + }, } task := newTestActivityTask( @@ -1475,6 +1487,7 @@ func newTestActivityTask(workflowID, runID, activityID, workflowTypeName, domain Name: common.StringPtr(workflowTypeName), }, WorkflowDomain: common.StringPtr(domainName), + Header: params.Header, } return task } diff --git a/internal/internal_workflow_testsuite_test.go b/internal/internal_workflow_testsuite_test.go index 8892e7660..e776d5079 100644 --- a/internal/internal_workflow_testsuite_test.go +++ b/internal/internal_workflow_testsuite_test.go @@ -56,8 +56,10 @@ func (s *WorkflowTestSuiteUnitTest) SetupSuite() { ScheduleToCloseTimeout: time.Second * 3, } RegisterWorkflowWithOptions(testWorkflowHello, RegisterWorkflowOptions{Name: "testWorkflowHello"}) + RegisterWorkflow(testWorkflowContext) RegisterWorkflow(testWorkflowHeartbeat) RegisterActivityWithOptions(testActivityHello, RegisterActivityOptions{Name: "testActivityHello"}) + RegisterActivity(testActivityContext) RegisterActivity(testActivityHeartbeat) } @@ -362,6 +364,28 @@ func (s *WorkflowTestSuiteUnitTest) Test_ActivityWithUserContext() { s.Equal(testValue, value) } +func (s *WorkflowTestSuiteUnitTest) Test_ActivityWithHeaderContext() { + workerOptions := WorkerOptions{} + + // inline activity using value passing through user context. + activityWithUserContext := func(ctx context.Context) (string, error) { + value := ctx.Value(contextKey(testHeader)) + if val, ok := value.([]byte); ok { + return string(val), nil + } + return "", errors.New("value not found from ctx") + } + RegisterActivity(activityWithUserContext) + + env := s.NewTestActivityEnvironment() + env.SetWorkerOptions(workerOptions) + blob, err := env.ExecuteActivity(activityWithUserContext) + s.NoError(err) + var value string + blob.Get(&value) + s.Equal("test-data", value) +} + func (s *WorkflowTestSuiteUnitTest) Test_CompleteActivity() { env := s.NewTestWorkflowEnvironment() var activityInfo ActivityInfo @@ -438,10 +462,26 @@ func testWorkflowHello(ctx Context) (string, error) { return result, nil } +func testWorkflowContext(ctx Context) (string, error) { + value := ctx.Value(contextKey(testHeader)) + if val, ok := value.([]byte); ok { + return string(val), nil + } + return "", fmt.Errorf("context did not propagate to workflow") +} + func testActivityHello(ctx context.Context, msg string) (string, error) { return "hello" + "_" + msg, nil } +func testActivityContext(ctx context.Context) (string, error) { + value := ctx.Value(contextKey(testHeader)) + if val, ok := value.([]byte); ok { + return string(val), nil + } + return "", fmt.Errorf("context did not propagate to workflow") +} + func testWorkflowHeartbeat(ctx Context, msg string, waitTime time.Duration) (string, error) { ao := ActivityOptions{ ScheduleToStartTimeout: time.Minute, @@ -1305,6 +1345,46 @@ func (s *WorkflowTestSuiteUnitTest) Test_WorkflowFriendlyName() { s.Equal("testWorkflowHello", called[1]) } +func (s *WorkflowTestSuiteUnitTest) Test_WorkflowHeaderContext() { + + workflowFn := func(ctx Context) error { + value := ctx.Value(contextKey(testHeader)) + if val, ok := value.([]byte); ok { + s.Equal("test-data", string(val)) + } else { + return fmt.Errorf("context did not propagate to workflow") + } + + cwo := ChildWorkflowOptions{ExecutionStartToCloseTimeout: time.Hour /* this is currently ignored by test suite */} + ctx = WithChildWorkflowOptions(ctx, cwo) + var result string + if err := ExecuteChildWorkflow(ctx, testWorkflowContext).Get(ctx, &result); err != nil { + return err + } + s.Equal("test-data", result) + + ao := ActivityOptions{ + ScheduleToStartTimeout: time.Minute, + StartToCloseTimeout: time.Minute, + HeartbeatTimeout: 20 * time.Second, + } + ctx = WithActivityOptions(ctx, ao) + if err := ExecuteActivity(ctx, testActivityContext).Get(ctx, &result); err != nil { + return err + } + s.Equal("test-data", result) + return nil + } + + RegisterWorkflow(workflowFn) + env := s.NewTestWorkflowEnvironment() + + env.ExecuteWorkflow(workflowFn) + + s.True(env.IsWorkflowCompleted()) + s.NoError(env.GetWorkflowError()) +} + func (s *WorkflowTestSuiteUnitTest) Test_ActivityFullyQualifiedName() { // TODO (madhu): Add this back once test workflow environment is able to handle panics gracefully // Right now, the panic happens in a different goroutine and there is no way to catch it diff --git a/internal/workflow.go b/internal/workflow.go index 796de8243..90eb69efd 100644 --- a/internal/workflow.go +++ b/internal/workflow.go @@ -355,11 +355,15 @@ func ExecuteActivity(ctx Context, activity interface{}, args ...interface{}) Fut return future } + // Retrieve headers from context to pass them on + header := getHeadersFromContext(ctx) + params := executeActivityParams{ activityOptions: *options, ActivityType: *activityType, Input: input, DataConverter: dataConverter, + Header: header, } ctxDone, cancellable := ctx.Done().(*channelImpl) diff --git a/internal/workflow_testsuite.go b/internal/workflow_testsuite.go index 3406880dc..89e10264b 100644 --- a/internal/workflow_testsuite.go +++ b/internal/workflow_testsuite.go @@ -68,6 +68,11 @@ type ( runFn func(args mock.Arguments) waitDuration func() time.Duration } + + // TestContextPropagator propagates test keys across a workflow + TestContextPropagator struct { + keys []string + } ) func newEncodedValues(values []byte, dc encoded.DataConverter) encoded.Values { @@ -109,6 +114,60 @@ func (b ErrorDetailsValues) HasValues() bool { return b != nil && len(b) != 0 } +// Inject injects values from context into headers for propagation +func (t *TestContextPropagator) Inject(ctx context.Context, writer HeaderWriter) error { + for _, key := range t.keys { + value, ok := ctx.Value(contextKey(key)).([]byte) + if !ok { + return fmt.Errorf("unable to extract key from context %v", key) + } + writer.Set(key, value) + } + return nil +} + +// InjectFromWorkflow injects values from context into headers for propagation +func (t *TestContextPropagator) InjectFromWorkflow(ctx Context, writer HeaderWriter) error { + for _, key := range t.keys { + value, ok := ctx.Value(contextKey(key)).([]byte) + if !ok { + return fmt.Errorf("unable to extract key from context %v", key) + } + writer.Set(key, value) + } + return nil +} + +// Extract extracts values from headers and puts them into context +func (t *TestContextPropagator) Extract(ctx context.Context, reader HeaderReader) (context.Context, error) { + if err := reader.ForEachKey(func(key string, value []byte) error { + for _, k := range t.keys { + if key == k { + ctx = context.WithValue(ctx, contextKey(key), value) + } + } + return nil + }); err != nil { + return nil, err + } + return ctx, nil +} + +// ExtractToWorkflow extracts values from headers and puts them into context +func (t *TestContextPropagator) ExtractToWorkflow(ctx Context, reader HeaderReader) (Context, error) { + if err := reader.ForEachKey(func(key string, value []byte) error { + for _, k := range t.keys { + if key == k { + ctx = WithValue(ctx, contextKey(key), value) + } + } + return nil + }); err != nil { + return nil, err + } + return ctx, nil +} + // NewTestWorkflowEnvironment creates a new instance of TestWorkflowEnvironment. Use the returned TestWorkflowEnvironment // to run your workflow in the test environment. func (s *WorkflowTestSuite) NewTestWorkflowEnvironment() *TestWorkflowEnvironment {