From ae26fc625dde4a2edfd9c6c3553dbbf69b268e57 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Fri, 22 Dec 2017 15:02:56 -0800 Subject: [PATCH 1/8] make cache more generic --- common/cache/cache.go | 10 +++++----- common/cache/lru.go | 18 +++++++++--------- common/cache/lru_test.go | 26 ++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/common/cache/cache.go b/common/cache/cache.go index a7ad0c969bc..a63d3f6d3f3 100644 --- a/common/cache/cache.go +++ b/common/cache/cache.go @@ -29,20 +29,20 @@ import ( type Cache interface { // Get retrieves an element based on a key, returning nil if the element // does not exist - Get(key string) interface{} + Get(key interface{}) interface{} // Put adds an element to the cache, returning the previous element - Put(key string, value interface{}) interface{} + Put(key interface{}, value interface{}) interface{} // PutIfNotExist puts a value associated with a given key if it does not exist - PutIfNotExist(key string, value interface{}) (interface{}, error) + PutIfNotExist(key interface{}, value interface{}) (interface{}, error) // Delete deletes an element in the cache - Delete(key string) + Delete(key interface{}) // Release decrements the ref count of a pinned element. If the ref count // drops to 0, the element can be evicted from the cache. - Release(key string) + Release(key interface{}) // Size returns the number of entries currently stored in the Cache Size() int diff --git a/common/cache/lru.go b/common/cache/lru.go index f2112794cb3..a6107dbdf12 100644 --- a/common/cache/lru.go +++ b/common/cache/lru.go @@ -36,7 +36,7 @@ var ( type lru struct { mut sync.Mutex byAccess *list.List - byKey map[string]*list.Element + byKey map[interface{}]*list.Element maxSize int ttl time.Duration pin bool @@ -51,7 +51,7 @@ func New(maxSize int, opts *Options) Cache { return &lru{ byAccess: list.New(), - byKey: make(map[string]*list.Element, opts.InitialCapacity), + byKey: make(map[interface{}]*list.Element, opts.InitialCapacity), ttl: opts.TTL, maxSize: maxSize, pin: opts.Pin, @@ -74,7 +74,7 @@ func NewLRUWithInitialCapacity(initialCapacity, maxSize int) Cache { } // Get retrieves the value stored under the given key -func (c *lru) Get(key string) interface{} { +func (c *lru) Get(key interface{}) interface{} { c.mut.Lock() defer c.mut.Unlock() @@ -104,7 +104,7 @@ func (c *lru) Get(key string) interface{} { } // Put puts a new value associated with a given key, returning the existing value (if present) -func (c *lru) Put(key string, value interface{}) interface{} { +func (c *lru) Put(key interface{}, value interface{}) interface{} { if c.pin { panic("Cannot use Put API in Pin mode. Use Delete and PutIfNotExist if necessary") } @@ -113,7 +113,7 @@ func (c *lru) Put(key string, value interface{}) interface{} { } // PutIfNotExist puts a value associated with a given key if it does not exist -func (c *lru) PutIfNotExist(key string, value interface{}) (interface{}, error) { +func (c *lru) PutIfNotExist(key interface{}, value interface{}) (interface{}, error) { existing, err := c.putInternal(key, value, false) if err != nil { return nil, err @@ -128,7 +128,7 @@ func (c *lru) PutIfNotExist(key string, value interface{}) (interface{}, error) } // Delete deletes a key, value pair associated with a key -func (c *lru) Delete(key string) { +func (c *lru) Delete(key interface{}) { c.mut.Lock() defer c.mut.Unlock() @@ -143,7 +143,7 @@ func (c *lru) Delete(key string) { } // Release decrements the ref count of a pinned element. -func (c *lru) Release(key string) { +func (c *lru) Release(key interface{}) { c.mut.Lock() defer c.mut.Unlock() @@ -162,7 +162,7 @@ func (c *lru) Size() int { // Put puts a new value associated with a given key, returning the existing value (if present) // allowUpdate flag is used to control overwrite behavior if the value exists -func (c *lru) putInternal(key string, value interface{}, allowUpdate bool) (interface{}, error) { +func (c *lru) putInternal(key interface{}, value interface{}, allowUpdate bool) (interface{}, error) { c.mut.Lock() defer c.mut.Unlock() @@ -219,7 +219,7 @@ func (c *lru) putInternal(key string, value interface{}, allowUpdate bool) (inte } type cacheEntry struct { - key string + key interface{} expiration time.Time value interface{} refCount int diff --git a/common/cache/lru_test.go b/common/cache/lru_test.go index 8e70cf14ec1..328f6887287 100644 --- a/common/cache/lru_test.go +++ b/common/cache/lru_test.go @@ -28,6 +28,11 @@ import ( "github.com/stretchr/testify/assert" ) +type keyType struct { + dummyString string + dummyInt int +} + func TestLRU(t *testing.T) { cache := NewLRU(5) @@ -62,6 +67,27 @@ func TestLRU(t *testing.T) { assert.Nil(t, cache.Get("A")) } +func TestGenerics(t *testing.T) { + key := keyType{ + dummyString: "some random key", + dummyInt: 59, + } + value := "some random value" + + cache := NewLRU(5) + cache.Put(key, value) + + assert.Equal(t, value, cache.Get(key)) + assert.Equal(t, value, cache.Get(keyType{ + dummyString: "some random key", + dummyInt: 59, + })) + assert.Nil(t, cache.Get(keyType{ + dummyString: "some other random key", + dummyInt: 56, + })) +} + func TestLRUWithTTL(t *testing.T) { cache := New(5, &Options{ TTL: time.Millisecond * 100, From 1958ca772a1c1279978495f3cdd0bf4ba787f42c Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Mon, 25 Dec 2017 18:24:47 -0800 Subject: [PATCH 2/8] add API GetPollerHistory --- .gen/go/cadence/idl.go | 4 +- .../workflowservice_getpollerhistory.go | 501 ++++++++++++++ .../cadence/workflowserviceclient/client.go | 29 + .../cadence/workflowserviceserver/server.go | 37 +- .gen/go/cadence/workflowservicetest/client.go | 33 + .gen/go/matching/idl.go | 4 +- .../matchingservice_getpollerhistory.go | 507 ++++++++++++++ .../matching/matchingservice_queryworkflow.go | 6 - .../matching/matchingserviceclient/client.go | 29 + .../matching/matchingserviceserver/server.go | 37 +- .../go/matching/matchingservicetest/client.go | 33 + .gen/go/matching/types.go | 146 ++++ .gen/go/shared/idl.go | 4 +- .gen/go/shared/types.go | 646 ++++++++++++++++++ client/matching/client.go | 11 + client/matching/metricClient.go | 17 + common/cache/cache.go | 23 + common/cache/lru.go | 160 +++-- common/cache/lru_test.go | 45 +- common/convert.go | 12 +- common/metrics/defs.go | 9 + common/mocks/MatchingClient.go | 24 + host/integration_test.go | 123 ++++ idl/github.com/uber/cadence/cadence.thrift | 10 + idl/github.com/uber/cadence/matching.thrift | 36 +- idl/github.com/uber/cadence/shared.thrift | 27 + service/frontend/handler.go | 47 ++ service/matching/handler.go | 10 + service/matching/matchingEngine.go | 28 + service/matching/matchingEngineInterfaces.go | 1 + service/matching/matchingEngine_test.go | 24 +- service/matching/pollerHistory.go | 85 +++ service/matching/taskListManager.go | 23 + 33 files changed, 2655 insertions(+), 76 deletions(-) create mode 100644 .gen/go/cadence/workflowservice_getpollerhistory.go create mode 100644 .gen/go/matching/matchingservice_getpollerhistory.go create mode 100644 service/matching/pollerHistory.go diff --git a/.gen/go/cadence/idl.go b/.gen/go/cadence/idl.go index 80d4669a4d7..ed899bf2526 100644 --- a/.gen/go/cadence/idl.go +++ b/.gen/go/cadence/idl.go @@ -33,11 +33,11 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "cadence", Package: "github.com/uber/cadence/.gen/go/cadence", FilePath: "cadence.thrift", - SHA1: "e9edfcf677c37b94326911601c9219f173427a8f", + SHA1: "f5cf46872436104150b2c697241f4b3abfd9405d", Includes: []*thriftreflect.ThriftModule{ shared.ThriftModule, }, 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\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence\n\n/**\n* WorkflowService API is exposed to provide support for long running applications. Application is expected to call\n* StartWorkflowExecution to create an instance for each instance of long running workflow. Such applications are expected\n* to have a worker which regularly polls for DecisionTask and ActivityTask from the WorkflowService. For each\n* DecisionTask, application is expected to process the history of events for that session and respond back with next\n* decisions. For each ActivityTask, application is expected to execute the actual logic for that task and respond back\n* with completion or failure. Worker is expected to regularly heartbeat while activity task is running.\n**/\nservice WorkflowService {\n /**\n * RegisterDomain creates a new domain which can be used as a container for all resources. Domain is a top level\n * entity within Cadence, used as a container for all resources like workflow executions, tasklists, etc. Domain\n * acts as a sandbox and provides isolation for all resources within the domain. All resources belongs to exactly one\n * domain.\n **/\n void RegisterDomain(1: shared.RegisterDomainRequest registerRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.DomainAlreadyExistsError domainExistsError,\n )\n\n /**\n * DescribeDomain returns the information and configuration for a registered domain.\n **/\n shared.DescribeDomainResponse DescribeDomain(1: shared.DescribeDomainRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * UpdateDomain is used to update the information and configuration for a registered domain.\n **/\n shared.UpdateDomainResponse UpdateDomain(1: shared.UpdateDomainRequest updateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * DeprecateDomain us used to update status of a registered domain to DEPRECATED. Once the domain is deprecated\n * it cannot be used to start new workflow executions. Existing workflow executions will continue to run on\n * deprecated domains.\n **/\n void DeprecateDomain(1: shared.DeprecateDomainRequest deprecateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * StartWorkflowExecution starts a new long running workflow instance. It will create the instance with\n * 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for the worker to make the\n * first decision for this instance. It will return 'WorkflowExecutionAlreadyStartedError', if an instance already\n * exists with same workflowId.\n **/\n shared.StartWorkflowExecutionResponse StartWorkflowExecution(1: shared.StartWorkflowExecutionRequest startRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.WorkflowExecutionAlreadyStartedError sessionAlreadyExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * Returns the history of specified workflow execution. It fails with 'EntityNotExistError' if speficied workflow\n * execution in unknown to the service.\n **/\n shared.GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory(1: shared.GetWorkflowExecutionHistoryRequest getRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * PollForDecisionTask is called by application worker to process DecisionTask from a specific taskList. A\n * DecisionTask is dispatched to callers for active workflow executions, with pending decisions.\n * Application is then expected to call 'RespondDecisionTaskCompleted' API when it is done processing the DecisionTask.\n * It will also create a 'DecisionTaskStarted' event in the history for that session before handing off DecisionTask to\n * application worker.\n **/\n shared.PollForDecisionTaskResponse PollForDecisionTask(1: shared.PollForDecisionTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed as a result of\n * 'PollForDecisionTask' API call. Completing a DecisionTask will result in new events for the workflow execution and\n * potentially new ActivityTask being created for corresponding decisions. It will also create a DecisionTaskCompleted\n * event in the history for that session. Use the 'taskToken' provided as response of PollForDecisionTask API call\n * for completing the DecisionTask.\n **/\n void RespondDecisionTaskCompleted(1: shared.RespondDecisionTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondDecisionTaskFailed is called by application worker to indicate failure. This results in\n * DecisionTaskFailedEvent written to the history and a new DecisionTask created. This API can be used by client to\n * either clear sticky tasklist or report any panics during DecisionTask processing. Cadence will only append first\n * DecisionTaskFailed event to the history of workflow execution for consecutive failures.\n **/\n void RespondDecisionTaskFailed(1: shared.RespondDecisionTaskFailedRequest failedRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * PollForActivityTask is called by application worker to process ActivityTask from a specific taskList. ActivityTask\n * is dispatched to callers whenever a ScheduleTask decision is made for a workflow execution.\n * Application is expected to call 'RespondActivityTaskCompleted' or 'RespondActivityTaskFailed' once it is done\n * processing the task.\n * Application also needs to call 'RecordActivityTaskHeartbeat' API within 'heartbeatTimeoutSeconds' interval to\n * prevent the task from getting timed out. An event 'ActivityTaskStarted' event is also written to workflow execution\n * history before the ActivityTask is dispatched to application worker.\n **/\n shared.PollForActivityTaskResponse PollForActivityTask(1: shared.PollForActivityTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RecordActivityTaskHeartbeat is called by application worker while it is processing an ActivityTask. If worker fails\n * to heartbeat within 'heartbeatTimeoutSeconds' interval for the ActivityTask, then it will be marked as timedout and\n * 'ActivityTaskTimedOut' event will be written to the workflow history. Calling 'RecordActivityTaskHeartbeat' will\n * fail with 'EntityNotExistsError' in such situations. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for heartbeating.\n **/\n shared.RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(1: shared.RecordActivityTaskHeartbeatRequest heartbeatRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCompleted is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCompleted(1: shared.RespondActivityTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCompletedByID is called by application worker when it is done processing an ActivityTask.\n * It will result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Similar to RespondActivityTaskCompleted but use DomainID,\n * WorkflowID and ActivityID instead of 'taskToken' for completion. It fails with 'EntityNotExistsError'\n * if the these IDs are not valid anymore due to activity timeout.\n **/\n void RespondActivityTaskCompletedByID(1: shared.RespondActivityTaskCompletedByIDRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskFailed is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskFailed(1: shared.RespondActivityTaskFailedRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskFailedByID is called by application worker when it is done processing an ActivityTask.\n * It will result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Similar to RespondActivityTaskFailed but use\n * DomainID, WorkflowID and ActivityID instead of 'taskToken' for completion. It fails with 'EntityNotExistsError'\n * if the these IDs are not valid anymore due to activity timeout.\n **/\n void RespondActivityTaskFailedByID(1: shared.RespondActivityTaskFailedByIDRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an ActivityTask. It will\n * result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceled(1: shared.RespondActivityTaskCanceledRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCanceledByID is called by application worker when it is successfully canceled an ActivityTask.\n * It will result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Similar to RespondActivityTaskCanceled but use\n * DomainID, WorkflowID and ActivityID instead of 'taskToken' for completion. It fails with 'EntityNotExistsError'\n * if the these IDs are not valid anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceledByID(1: shared.RespondActivityTaskCanceledByIDRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RequestCancelWorkflowExecution is called by application worker when it wants to request cancellation of a workflow instance.\n * It will result in a new 'WorkflowExecutionCancelRequested' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. It fails with 'EntityNotExistsError' if the workflow is not valid\n * anymore due to completion or doesn't exist.\n **/\n void RequestCancelWorkflowExecution(1: shared.RequestCancelWorkflowExecutionRequest cancelRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.CancellationAlreadyRequestedError cancellationAlreadyRequestedError,\n 5: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in\n * WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.\n **/\n void SignalWorkflowExecution(1: shared.SignalWorkflowExecutionRequest signalRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event\n * in the history and immediately terminating the execution instance.\n **/\n void TerminateWorkflowExecution(1: shared.TerminateWorkflowExecutionRequest terminateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * ListOpenWorkflowExecutions is a visibility API to list the open executions in a specific domain.\n **/\n shared.ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions(1: shared.ListOpenWorkflowExecutionsRequest listRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * ListClosedWorkflowExecutions is a visibility API to list the closed executions in a specific domain.\n **/\n shared.ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions(1: shared.ListClosedWorkflowExecutionsRequest listRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondQueryTaskCompleted is called by application worker to complete a QueryTask (which is a DecisionTask for query)\n * as a result of 'PollForDecisionTask' API call. Completing a QueryTask will unblock the client call to 'QueryWorkflow'\n * API and return the query result to client as a response to 'QueryWorkflow' API call.\n **/\n void RespondQueryTaskCompleted(1: shared.RespondQueryTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * QueryWorkflow returns query result for a specified workflow execution\n **/\n shared.QueryWorkflowResponse QueryWorkflow(1: shared.QueryWorkflowRequest queryRequest)\n\tthrows (\n\t 1: shared.BadRequestError badRequestError,\n\t 2: shared.InternalServiceError internalServiceError,\n\t 3: shared.EntityNotExistsError entityNotExistError,\n\t 4: shared.QueryFailedError queryFailedError,\n\t)\n\n /**\n * DescribeWorkflowExecution returns information about the specified workflow execution.\n **/\n shared.DescribeWorkflowExecutionResponse DescribeWorkflowExecution(1: shared.DescribeWorkflowExecutionRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\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\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence\n\n/**\n* WorkflowService API is exposed to provide support for long running applications. Application is expected to call\n* StartWorkflowExecution to create an instance for each instance of long running workflow. Such applications are expected\n* to have a worker which regularly polls for DecisionTask and ActivityTask from the WorkflowService. For each\n* DecisionTask, application is expected to process the history of events for that session and respond back with next\n* decisions. For each ActivityTask, application is expected to execute the actual logic for that task and respond back\n* with completion or failure. Worker is expected to regularly heartbeat while activity task is running.\n**/\nservice WorkflowService {\n /**\n * RegisterDomain creates a new domain which can be used as a container for all resources. Domain is a top level\n * entity within Cadence, used as a container for all resources like workflow executions, tasklists, etc. Domain\n * acts as a sandbox and provides isolation for all resources within the domain. All resources belongs to exactly one\n * domain.\n **/\n void RegisterDomain(1: shared.RegisterDomainRequest registerRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.DomainAlreadyExistsError domainExistsError,\n )\n\n /**\n * DescribeDomain returns the information and configuration for a registered domain.\n **/\n shared.DescribeDomainResponse DescribeDomain(1: shared.DescribeDomainRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * UpdateDomain is used to update the information and configuration for a registered domain.\n **/\n shared.UpdateDomainResponse UpdateDomain(1: shared.UpdateDomainRequest updateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * DeprecateDomain us used to update status of a registered domain to DEPRECATED. Once the domain is deprecated\n * it cannot be used to start new workflow executions. Existing workflow executions will continue to run on\n * deprecated domains.\n **/\n void DeprecateDomain(1: shared.DeprecateDomainRequest deprecateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * StartWorkflowExecution starts a new long running workflow instance. It will create the instance with\n * 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for the worker to make the\n * first decision for this instance. It will return 'WorkflowExecutionAlreadyStartedError', if an instance already\n * exists with same workflowId.\n **/\n shared.StartWorkflowExecutionResponse StartWorkflowExecution(1: shared.StartWorkflowExecutionRequest startRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.WorkflowExecutionAlreadyStartedError sessionAlreadyExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * Returns the history of specified workflow execution. It fails with 'EntityNotExistError' if speficied workflow\n * execution in unknown to the service.\n **/\n shared.GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory(1: shared.GetWorkflowExecutionHistoryRequest getRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * PollForDecisionTask is called by application worker to process DecisionTask from a specific taskList. A\n * DecisionTask is dispatched to callers for active workflow executions, with pending decisions.\n * Application is then expected to call 'RespondDecisionTaskCompleted' API when it is done processing the DecisionTask.\n * It will also create a 'DecisionTaskStarted' event in the history for that session before handing off DecisionTask to\n * application worker.\n **/\n shared.PollForDecisionTaskResponse PollForDecisionTask(1: shared.PollForDecisionTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed as a result of\n * 'PollForDecisionTask' API call. Completing a DecisionTask will result in new events for the workflow execution and\n * potentially new ActivityTask being created for corresponding decisions. It will also create a DecisionTaskCompleted\n * event in the history for that session. Use the 'taskToken' provided as response of PollForDecisionTask API call\n * for completing the DecisionTask.\n **/\n void RespondDecisionTaskCompleted(1: shared.RespondDecisionTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondDecisionTaskFailed is called by application worker to indicate failure. This results in\n * DecisionTaskFailedEvent written to the history and a new DecisionTask created. This API can be used by client to\n * either clear sticky tasklist or report any panics during DecisionTask processing. Cadence will only append first\n * DecisionTaskFailed event to the history of workflow execution for consecutive failures.\n **/\n void RespondDecisionTaskFailed(1: shared.RespondDecisionTaskFailedRequest failedRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * PollForActivityTask is called by application worker to process ActivityTask from a specific taskList. ActivityTask\n * is dispatched to callers whenever a ScheduleTask decision is made for a workflow execution.\n * Application is expected to call 'RespondActivityTaskCompleted' or 'RespondActivityTaskFailed' once it is done\n * processing the task.\n * Application also needs to call 'RecordActivityTaskHeartbeat' API within 'heartbeatTimeoutSeconds' interval to\n * prevent the task from getting timed out. An event 'ActivityTaskStarted' event is also written to workflow execution\n * history before the ActivityTask is dispatched to application worker.\n **/\n shared.PollForActivityTaskResponse PollForActivityTask(1: shared.PollForActivityTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RecordActivityTaskHeartbeat is called by application worker while it is processing an ActivityTask. If worker fails\n * to heartbeat within 'heartbeatTimeoutSeconds' interval for the ActivityTask, then it will be marked as timedout and\n * 'ActivityTaskTimedOut' event will be written to the workflow history. Calling 'RecordActivityTaskHeartbeat' will\n * fail with 'EntityNotExistsError' in such situations. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for heartbeating.\n **/\n shared.RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(1: shared.RecordActivityTaskHeartbeatRequest heartbeatRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCompleted is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCompleted(1: shared.RespondActivityTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCompletedByID is called by application worker when it is done processing an ActivityTask.\n * It will result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Similar to RespondActivityTaskCompleted but use DomainID,\n * WorkflowID and ActivityID instead of 'taskToken' for completion. It fails with 'EntityNotExistsError'\n * if the these IDs are not valid anymore due to activity timeout.\n **/\n void RespondActivityTaskCompletedByID(1: shared.RespondActivityTaskCompletedByIDRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskFailed is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskFailed(1: shared.RespondActivityTaskFailedRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskFailedByID is called by application worker when it is done processing an ActivityTask.\n * It will result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Similar to RespondActivityTaskFailed but use\n * DomainID, WorkflowID and ActivityID instead of 'taskToken' for completion. It fails with 'EntityNotExistsError'\n * if the these IDs are not valid anymore due to activity timeout.\n **/\n void RespondActivityTaskFailedByID(1: shared.RespondActivityTaskFailedByIDRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an ActivityTask. It will\n * result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceled(1: shared.RespondActivityTaskCanceledRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCanceledByID is called by application worker when it is successfully canceled an ActivityTask.\n * It will result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Similar to RespondActivityTaskCanceled but use\n * DomainID, WorkflowID and ActivityID instead of 'taskToken' for completion. It fails with 'EntityNotExistsError'\n * if the these IDs are not valid anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceledByID(1: shared.RespondActivityTaskCanceledByIDRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RequestCancelWorkflowExecution is called by application worker when it wants to request cancellation of a workflow instance.\n * It will result in a new 'WorkflowExecutionCancelRequested' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. It fails with 'EntityNotExistsError' if the workflow is not valid\n * anymore due to completion or doesn't exist.\n **/\n void RequestCancelWorkflowExecution(1: shared.RequestCancelWorkflowExecutionRequest cancelRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.CancellationAlreadyRequestedError cancellationAlreadyRequestedError,\n 5: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in\n * WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.\n **/\n void SignalWorkflowExecution(1: shared.SignalWorkflowExecutionRequest signalRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event\n * in the history and immediately terminating the execution instance.\n **/\n void TerminateWorkflowExecution(1: shared.TerminateWorkflowExecutionRequest terminateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * ListOpenWorkflowExecutions is a visibility API to list the open executions in a specific domain.\n **/\n shared.ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions(1: shared.ListOpenWorkflowExecutionsRequest listRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * ListClosedWorkflowExecutions is a visibility API to list the closed executions in a specific domain.\n **/\n shared.ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions(1: shared.ListClosedWorkflowExecutionsRequest listRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondQueryTaskCompleted is called by application worker to complete a QueryTask (which is a DecisionTask for query)\n * as a result of 'PollForDecisionTask' API call. Completing a QueryTask will unblock the client call to 'QueryWorkflow'\n * API and return the query result to client as a response to 'QueryWorkflow' API call.\n **/\n void RespondQueryTaskCompleted(1: shared.RespondQueryTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * QueryWorkflow returns query result for a specified workflow execution\n **/\n shared.QueryWorkflowResponse QueryWorkflow(1: shared.QueryWorkflowRequest queryRequest)\n\tthrows (\n\t 1: shared.BadRequestError badRequestError,\n\t 2: shared.InternalServiceError internalServiceError,\n\t 3: shared.EntityNotExistsError entityNotExistError,\n\t 4: shared.QueryFailedError queryFailedError,\n\t)\n\n /**\n * DescribeWorkflowExecution returns information about the specified workflow execution.\n **/\n shared.DescribeWorkflowExecutionResponse DescribeWorkflowExecution(1: shared.DescribeWorkflowExecutionRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * GetPollerHistory returns pollers which poll from given tasklist in last few minutes.\n **/\n shared.GetPollerHistoryResponse GetPollerHistory(1: shared.GetPollerHistoryRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n}\n" diff --git a/.gen/go/cadence/workflowservice_getpollerhistory.go b/.gen/go/cadence/workflowservice_getpollerhistory.go new file mode 100644 index 00000000000..b2798eed837 --- /dev/null +++ b/.gen/go/cadence/workflowservice_getpollerhistory.go @@ -0,0 +1,501 @@ +// 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. + +// Code generated by thriftrw v1.8.0. DO NOT EDIT. +// @generated + +package cadence + +import ( + "errors" + "fmt" + "github.com/uber/cadence/.gen/go/shared" + "go.uber.org/thriftrw/wire" + "strings" +) + +// WorkflowService_GetPollerHistory_Args represents the arguments for the WorkflowService.GetPollerHistory function. +// +// The arguments for GetPollerHistory are sent and received over the wire as this struct. +type WorkflowService_GetPollerHistory_Args struct { + Request *shared.GetPollerHistoryRequest `json:"request,omitempty"` +} + +// ToWire translates a WorkflowService_GetPollerHistory_Args 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 *WorkflowService_GetPollerHistory_Args) ToWire() (wire.Value, error) { + var ( + fields [1]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.Request != nil { + w, err = v.Request.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 1, Value: w} + i++ + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +func _GetPollerHistoryRequest_Read(w wire.Value) (*shared.GetPollerHistoryRequest, error) { + var v shared.GetPollerHistoryRequest + err := v.FromWire(w) + return &v, err +} + +// FromWire deserializes a WorkflowService_GetPollerHistory_Args 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 WorkflowService_GetPollerHistory_Args struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v WorkflowService_GetPollerHistory_Args +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *WorkflowService_GetPollerHistory_Args) FromWire(w wire.Value) error { + var err error + + for _, field := range w.GetStruct().Fields { + switch field.ID { + case 1: + if field.Value.Type() == wire.TStruct { + v.Request, err = _GetPollerHistoryRequest_Read(field.Value) + if err != nil { + return err + } + + } + } + } + + return nil +} + +// String returns a readable string representation of a WorkflowService_GetPollerHistory_Args +// struct. +func (v *WorkflowService_GetPollerHistory_Args) String() string { + if v == nil { + return "" + } + + var fields [1]string + i := 0 + if v.Request != nil { + fields[i] = fmt.Sprintf("Request: %v", v.Request) + i++ + } + + return fmt.Sprintf("WorkflowService_GetPollerHistory_Args{%v}", strings.Join(fields[:i], ", ")) +} + +// Equals returns true if all the fields of this WorkflowService_GetPollerHistory_Args match the +// provided WorkflowService_GetPollerHistory_Args. +// +// This function performs a deep comparison. +func (v *WorkflowService_GetPollerHistory_Args) Equals(rhs *WorkflowService_GetPollerHistory_Args) bool { + if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) { + return false + } + + return true +} + +// MethodName returns the name of the Thrift function as specified in +// the IDL, for which this struct represent the arguments. +// +// This will always be "GetPollerHistory" for this struct. +func (v *WorkflowService_GetPollerHistory_Args) MethodName() string { + return "GetPollerHistory" +} + +// EnvelopeType returns the kind of value inside this struct. +// +// This will always be Call for this struct. +func (v *WorkflowService_GetPollerHistory_Args) EnvelopeType() wire.EnvelopeType { + return wire.Call +} + +// WorkflowService_GetPollerHistory_Helper provides functions that aid in handling the +// parameters and return values of the WorkflowService.GetPollerHistory +// function. +var WorkflowService_GetPollerHistory_Helper = struct { + // Args accepts the parameters of GetPollerHistory in-order and returns + // the arguments struct for the function. + Args func( + request *shared.GetPollerHistoryRequest, + ) *WorkflowService_GetPollerHistory_Args + + // IsException returns true if the given error can be thrown + // by GetPollerHistory. + // + // An error can be thrown by GetPollerHistory only if the + // corresponding exception type was mentioned in the 'throws' + // section for it in the Thrift file. + IsException func(error) bool + + // WrapResponse returns the result struct for GetPollerHistory + // given its return value and error. + // + // This allows mapping values and errors returned by + // GetPollerHistory into a serializable result struct. + // WrapResponse returns a non-nil error if the provided + // error cannot be thrown by GetPollerHistory + // + // value, err := GetPollerHistory(args) + // result, err := WorkflowService_GetPollerHistory_Helper.WrapResponse(value, err) + // if err != nil { + // return fmt.Errorf("unexpected error from GetPollerHistory: %v", err) + // } + // serialize(result) + WrapResponse func(*shared.GetPollerHistoryResponse, error) (*WorkflowService_GetPollerHistory_Result, error) + + // UnwrapResponse takes the result struct for GetPollerHistory + // and returns the value or error returned by it. + // + // The error is non-nil only if GetPollerHistory threw an + // exception. + // + // result := deserialize(bytes) + // value, err := WorkflowService_GetPollerHistory_Helper.UnwrapResponse(result) + UnwrapResponse func(*WorkflowService_GetPollerHistory_Result) (*shared.GetPollerHistoryResponse, error) +}{} + +func init() { + WorkflowService_GetPollerHistory_Helper.Args = func( + request *shared.GetPollerHistoryRequest, + ) *WorkflowService_GetPollerHistory_Args { + return &WorkflowService_GetPollerHistory_Args{ + Request: request, + } + } + + WorkflowService_GetPollerHistory_Helper.IsException = func(err error) bool { + switch err.(type) { + case *shared.BadRequestError: + return true + case *shared.InternalServiceError: + return true + case *shared.EntityNotExistsError: + return true + default: + return false + } + } + + WorkflowService_GetPollerHistory_Helper.WrapResponse = func(success *shared.GetPollerHistoryResponse, err error) (*WorkflowService_GetPollerHistory_Result, error) { + if err == nil { + return &WorkflowService_GetPollerHistory_Result{Success: success}, nil + } + + switch e := err.(type) { + case *shared.BadRequestError: + if e == nil { + return nil, errors.New("WrapResponse received non-nil error type with nil value for WorkflowService_GetPollerHistory_Result.BadRequestError") + } + return &WorkflowService_GetPollerHistory_Result{BadRequestError: e}, nil + case *shared.InternalServiceError: + if e == nil { + return nil, errors.New("WrapResponse received non-nil error type with nil value for WorkflowService_GetPollerHistory_Result.InternalServiceError") + } + return &WorkflowService_GetPollerHistory_Result{InternalServiceError: e}, nil + case *shared.EntityNotExistsError: + if e == nil { + return nil, errors.New("WrapResponse received non-nil error type with nil value for WorkflowService_GetPollerHistory_Result.EntityNotExistError") + } + return &WorkflowService_GetPollerHistory_Result{EntityNotExistError: e}, nil + } + + return nil, err + } + WorkflowService_GetPollerHistory_Helper.UnwrapResponse = func(result *WorkflowService_GetPollerHistory_Result) (success *shared.GetPollerHistoryResponse, err error) { + if result.BadRequestError != nil { + err = result.BadRequestError + return + } + if result.InternalServiceError != nil { + err = result.InternalServiceError + return + } + if result.EntityNotExistError != nil { + err = result.EntityNotExistError + return + } + + if result.Success != nil { + success = result.Success + return + } + + err = errors.New("expected a non-void result") + return + } + +} + +// WorkflowService_GetPollerHistory_Result represents the result of a WorkflowService.GetPollerHistory function call. +// +// The result of a GetPollerHistory execution is sent and received over the wire as this struct. +// +// Success is set only if the function did not throw an exception. +type WorkflowService_GetPollerHistory_Result struct { + // Value returned by GetPollerHistory after a successful execution. + Success *shared.GetPollerHistoryResponse `json:"success,omitempty"` + BadRequestError *shared.BadRequestError `json:"badRequestError,omitempty"` + InternalServiceError *shared.InternalServiceError `json:"internalServiceError,omitempty"` + EntityNotExistError *shared.EntityNotExistsError `json:"entityNotExistError,omitempty"` +} + +// ToWire translates a WorkflowService_GetPollerHistory_Result 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 *WorkflowService_GetPollerHistory_Result) ToWire() (wire.Value, error) { + var ( + fields [4]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.Success != nil { + w, err = v.Success.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 0, Value: w} + i++ + } + if v.BadRequestError != nil { + w, err = v.BadRequestError.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 1, Value: w} + i++ + } + if v.InternalServiceError != nil { + w, err = v.InternalServiceError.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 2, Value: w} + i++ + } + if v.EntityNotExistError != nil { + w, err = v.EntityNotExistError.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 3, Value: w} + i++ + } + + if i != 1 { + return wire.Value{}, fmt.Errorf("WorkflowService_GetPollerHistory_Result should have exactly one field: got %v fields", i) + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +func _GetPollerHistoryResponse_Read(w wire.Value) (*shared.GetPollerHistoryResponse, error) { + var v shared.GetPollerHistoryResponse + err := v.FromWire(w) + return &v, err +} + +// FromWire deserializes a WorkflowService_GetPollerHistory_Result 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 WorkflowService_GetPollerHistory_Result struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v WorkflowService_GetPollerHistory_Result +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *WorkflowService_GetPollerHistory_Result) FromWire(w wire.Value) error { + var err error + + for _, field := range w.GetStruct().Fields { + switch field.ID { + case 0: + if field.Value.Type() == wire.TStruct { + v.Success, err = _GetPollerHistoryResponse_Read(field.Value) + if err != nil { + return err + } + + } + case 1: + if field.Value.Type() == wire.TStruct { + v.BadRequestError, err = _BadRequestError_Read(field.Value) + if err != nil { + return err + } + + } + case 2: + if field.Value.Type() == wire.TStruct { + v.InternalServiceError, err = _InternalServiceError_Read(field.Value) + if err != nil { + return err + } + + } + case 3: + if field.Value.Type() == wire.TStruct { + v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value) + if err != nil { + return err + } + + } + } + } + + count := 0 + if v.Success != nil { + count++ + } + if v.BadRequestError != nil { + count++ + } + if v.InternalServiceError != nil { + count++ + } + if v.EntityNotExistError != nil { + count++ + } + if count != 1 { + return fmt.Errorf("WorkflowService_GetPollerHistory_Result should have exactly one field: got %v fields", count) + } + + return nil +} + +// String returns a readable string representation of a WorkflowService_GetPollerHistory_Result +// struct. +func (v *WorkflowService_GetPollerHistory_Result) String() string { + if v == nil { + return "" + } + + var fields [4]string + i := 0 + if v.Success != nil { + fields[i] = fmt.Sprintf("Success: %v", v.Success) + i++ + } + if v.BadRequestError != nil { + fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError) + i++ + } + if v.InternalServiceError != nil { + fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError) + i++ + } + if v.EntityNotExistError != nil { + fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError) + i++ + } + + return fmt.Sprintf("WorkflowService_GetPollerHistory_Result{%v}", strings.Join(fields[:i], ", ")) +} + +// Equals returns true if all the fields of this WorkflowService_GetPollerHistory_Result match the +// provided WorkflowService_GetPollerHistory_Result. +// +// This function performs a deep comparison. +func (v *WorkflowService_GetPollerHistory_Result) Equals(rhs *WorkflowService_GetPollerHistory_Result) bool { + if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) { + return false + } + if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) { + return false + } + if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) { + return false + } + if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) { + return false + } + + return true +} + +// MethodName returns the name of the Thrift function as specified in +// the IDL, for which this struct represent the result. +// +// This will always be "GetPollerHistory" for this struct. +func (v *WorkflowService_GetPollerHistory_Result) MethodName() string { + return "GetPollerHistory" +} + +// EnvelopeType returns the kind of value inside this struct. +// +// This will always be Reply for this struct. +func (v *WorkflowService_GetPollerHistory_Result) EnvelopeType() wire.EnvelopeType { + return wire.Reply +} diff --git a/.gen/go/cadence/workflowserviceclient/client.go b/.gen/go/cadence/workflowserviceclient/client.go index cf00d9538f5..2c3b1ae0f4d 100644 --- a/.gen/go/cadence/workflowserviceclient/client.go +++ b/.gen/go/cadence/workflowserviceclient/client.go @@ -54,6 +54,12 @@ type Interface interface { opts ...yarpc.CallOption, ) (*shared.DescribeWorkflowExecutionResponse, error) + GetPollerHistory( + ctx context.Context, + Request *shared.GetPollerHistoryRequest, + opts ...yarpc.CallOption, + ) (*shared.GetPollerHistoryResponse, error) + GetWorkflowExecutionHistory( ctx context.Context, GetRequest *shared.GetWorkflowExecutionHistoryRequest, @@ -280,6 +286,29 @@ func (c client) DescribeWorkflowExecution( return } +func (c client) GetPollerHistory( + ctx context.Context, + _Request *shared.GetPollerHistoryRequest, + opts ...yarpc.CallOption, +) (success *shared.GetPollerHistoryResponse, err error) { + + args := cadence.WorkflowService_GetPollerHistory_Helper.Args(_Request) + + var body wire.Value + body, err = c.c.Call(ctx, args, opts...) + if err != nil { + return + } + + var result cadence.WorkflowService_GetPollerHistory_Result + if err = result.FromWire(body); err != nil { + return + } + + success, err = cadence.WorkflowService_GetPollerHistory_Helper.UnwrapResponse(&result) + return +} + func (c client) GetWorkflowExecutionHistory( ctx context.Context, _GetRequest *shared.GetWorkflowExecutionHistoryRequest, diff --git a/.gen/go/cadence/workflowserviceserver/server.go b/.gen/go/cadence/workflowserviceserver/server.go index e4988c5b428..05af53644ef 100644 --- a/.gen/go/cadence/workflowserviceserver/server.go +++ b/.gen/go/cadence/workflowserviceserver/server.go @@ -49,6 +49,11 @@ type Interface interface { DescribeRequest *shared.DescribeWorkflowExecutionRequest, ) (*shared.DescribeWorkflowExecutionResponse, error) + GetPollerHistory( + ctx context.Context, + Request *shared.GetPollerHistoryRequest, + ) (*shared.GetPollerHistoryResponse, error) + GetWorkflowExecutionHistory( ctx context.Context, GetRequest *shared.GetWorkflowExecutionHistoryRequest, @@ -204,6 +209,17 @@ func New(impl Interface, opts ...thrift.RegisterOption) []transport.Procedure { ThriftModule: cadence.ThriftModule, }, + thrift.Method{ + Name: "GetPollerHistory", + HandlerSpec: thrift.HandlerSpec{ + + Type: transport.Unary, + Unary: thrift.UnaryHandler(h.GetPollerHistory), + }, + Signature: "GetPollerHistory(Request *shared.GetPollerHistoryRequest) (*shared.GetPollerHistoryResponse)", + ThriftModule: cadence.ThriftModule, + }, + thrift.Method{ Name: "GetWorkflowExecutionHistory", HandlerSpec: thrift.HandlerSpec{ @@ -448,7 +464,7 @@ func New(impl Interface, opts ...thrift.RegisterOption) []transport.Procedure { }, } - procedures := make([]transport.Procedure, 0, 25) + procedures := make([]transport.Procedure, 0, 26) procedures = append(procedures, thrift.BuildProcedures(service, opts...)...) return procedures } @@ -512,6 +528,25 @@ func (h handler) DescribeWorkflowExecution(ctx context.Context, body wire.Value) return response, err } +func (h handler) GetPollerHistory(ctx context.Context, body wire.Value) (thrift.Response, error) { + var args cadence.WorkflowService_GetPollerHistory_Args + if err := args.FromWire(body); err != nil { + return thrift.Response{}, err + } + + success, err := h.impl.GetPollerHistory(ctx, args.Request) + + hadError := err != nil + result, err := cadence.WorkflowService_GetPollerHistory_Helper.WrapResponse(success, err) + + var response thrift.Response + if err == nil { + response.IsApplicationError = hadError + response.Body = result + } + return response, err +} + func (h handler) GetWorkflowExecutionHistory(ctx context.Context, body wire.Value) (thrift.Response, error) { var args cadence.WorkflowService_GetWorkflowExecutionHistory_Args if err := args.FromWire(body); err != nil { diff --git a/.gen/go/cadence/workflowservicetest/client.go b/.gen/go/cadence/workflowservicetest/client.go index 0a0d60eb0c5..9cff175fe73 100644 --- a/.gen/go/cadence/workflowservicetest/client.go +++ b/.gen/go/cadence/workflowservicetest/client.go @@ -159,6 +159,39 @@ func (mr *_MockClientRecorder) DescribeWorkflowExecution( return mr.mock.ctrl.RecordCall(mr.mock, "DescribeWorkflowExecution", args...) } +// GetPollerHistory responds to a GetPollerHistory call based on the mock expectations. This +// call will fail if the mock does not expect this call. Use EXPECT to expect +// a call to this function. +// +// client.EXPECT().GetPollerHistory(gomock.Any(), ...).Return(...) +// ... := client.GetPollerHistory(...) +func (m *MockClient) GetPollerHistory( + ctx context.Context, + _Request *shared.GetPollerHistoryRequest, + opts ...yarpc.CallOption, +) (success *shared.GetPollerHistoryResponse, err error) { + + args := []interface{}{ctx, _Request} + for _, o := range opts { + args = append(args, o) + } + i := 0 + ret := m.ctrl.Call(m, "GetPollerHistory", args...) + success, _ = ret[i].(*shared.GetPollerHistoryResponse) + i++ + err, _ = ret[i].(error) + return +} + +func (mr *_MockClientRecorder) GetPollerHistory( + ctx interface{}, + _Request interface{}, + opts ...interface{}, +) *gomock.Call { + args := append([]interface{}{ctx, _Request}, opts...) + return mr.mock.ctrl.RecordCall(mr.mock, "GetPollerHistory", args...) +} + // GetWorkflowExecutionHistory responds to a GetWorkflowExecutionHistory call based on the mock expectations. This // call will fail if the mock does not expect this call. Use EXPECT to expect // a call to this function. diff --git a/.gen/go/matching/idl.go b/.gen/go/matching/idl.go index 50a65c1d283..26daa846658 100644 --- a/.gen/go/matching/idl.go +++ b/.gen/go/matching/idl.go @@ -33,11 +33,11 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "matching", Package: "github.com/uber/cadence/.gen/go/matching", FilePath: "matching.thrift", - SHA1: "62f0b6bfd139230541a6ba51852469cf0a68ea4c", + SHA1: "b08e6bd582787dc8c99e67a39673e77fe8df086b", Includes: []*thriftreflect.ThriftModule{ shared.ThriftModule, }, 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\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence.matching\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domainUUID\n 15: optional string pollerID\n 20: optional shared.PollForDecisionTaskRequest pollRequest\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional shared.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 60: optional i64 (js.type = \"Long\") nextEventId\n 65: optional i64 (js.type = \"Long\") backlogCountHint\n 70: optional bool stickyExecutionEnabled\n 80: optional shared.WorkflowQuery query\n 90: optional shared.TransientDecisionInfo decisionInfo\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domainUUID\n 15: optional string pollerID\n 20: optional shared.PollForActivityTaskRequest pollRequest\n}\n\nstruct AddDecisionTaskRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional shared.TaskList taskList\n 40: optional i64 (js.type = \"Long\") scheduleId\n 50: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct AddActivityTaskRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional string sourceDomainUUID\n 40: optional shared.TaskList taskList\n 50: optional i64 (js.type = \"Long\") scheduleId\n 60: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domainUUID\n 20: optional shared.TaskList taskList\n 30: optional shared.QueryWorkflowRequest queryRequest\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.TaskList taskList\n 30: optional string taskID\n 40: optional shared.RespondQueryTaskCompletedRequest completedRequest\n}\n\nstruct CancelOutstandingPollRequest {\n 10: optional string domainUUID\n 20: optional i32 taskListType\n 30: optional shared.TaskList taskList\n 40: optional string pollerID\n}\n\n/**\n* MatchingService API is exposed to provide support for polling from long running applications.\n* Such applications are expected to have a worker which regularly polls for DecisionTask and ActivityTask. For each\n* DecisionTask, application is expected to process the history of events for that session and respond back with next\n* decisions. For each ActivityTask, application is expected to execute the actual logic for that task and respond back\n* with completion or failure.\n**/\nservice MatchingService {\n /**\n * PollForDecisionTask is called by frontend to process DecisionTask from a specific taskList. A\n * DecisionTask is dispatched to callers for active workflow executions, with pending decisions.\n **/\n PollForDecisionTaskResponse PollForDecisionTask(1: PollForDecisionTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n )\n\n /**\n * PollForActivityTask is called by frontend to process ActivityTask from a specific taskList. ActivityTask\n * is dispatched to callers whenever a ScheduleTask decision is made for a workflow execution.\n **/\n shared.PollForActivityTaskResponse PollForActivityTask(1: PollForActivityTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n )\n\n /**\n * AddDecisionTask is called by the history service when a decision task is scheduled, so that it can be dispatched\n * by the MatchingEngine.\n **/\n void AddDecisionTask(1: AddDecisionTaskRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * AddActivityTask is called by the history service when a decision task is scheduled, so that it can be dispatched\n * by the MatchingEngine.\n **/\n void AddActivityTask(1: AddActivityTaskRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * QueryWorkflow is called by frontend to query a workflow.\n **/\n shared.QueryWorkflowResponse QueryWorkflow(1: QueryWorkflowRequest queryRequest)\n\tthrows (\n\t 1: shared.BadRequestError badRequestError,\n\t 2: shared.InternalServiceError internalServiceError,\n\t 3: shared.EntityNotExistsError entityNotExistError,\n\t 4: shared.QueryFailedError queryFailedError,\n\t)\n\n /**\n * RespondQueryTaskCompleted is called by frontend to respond query completed.\n **/\n void RespondQueryTaskCompleted(1: RespondQueryTaskCompletedRequest request)\n\tthrows (\n\t 1: shared.BadRequestError badRequestError,\n\t 2: shared.InternalServiceError internalServiceError,\n\t 3: shared.EntityNotExistsError entityNotExistError,\n\t)\n\n /**\n * CancelOutstandingPoll is called by frontend to unblock long polls on matching for zombie pollers.\n * Our rpc stack does not support context propagation, so when a client connection goes away frontend sees\n * cancellation of context for that handler, but any corresponding calls (long-poll) to matching service does not\n * see the cancellation propagated so it can unblock corresponding long-polls on its end. This results is tasks\n * being dispatched to zombie pollers in this situation. This API is added so everytime frontend makes a long-poll\n * api call to matching it passes in a pollerID and then calls this API when it detects client connection is closed\n * to unblock long polls for this poller and prevent tasks being sent to these zombie pollers.\n **/\n void CancelOutstandingPoll(1: CancelOutstandingPollRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n )\n\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\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence.matching\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domainUUID\n 15: optional string pollerID\n 20: optional shared.PollForDecisionTaskRequest pollRequest\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional shared.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 60: optional i64 (js.type = \"Long\") nextEventId\n 65: optional i64 (js.type = \"Long\") backlogCountHint\n 70: optional bool stickyExecutionEnabled\n 80: optional shared.WorkflowQuery query\n 90: optional shared.TransientDecisionInfo decisionInfo\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domainUUID\n 15: optional string pollerID\n 20: optional shared.PollForActivityTaskRequest pollRequest\n}\n\nstruct AddDecisionTaskRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional shared.TaskList taskList\n 40: optional i64 (js.type = \"Long\") scheduleId\n 50: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct AddActivityTaskRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional string sourceDomainUUID\n 40: optional shared.TaskList taskList\n 50: optional i64 (js.type = \"Long\") scheduleId\n 60: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domainUUID\n 20: optional shared.TaskList taskList\n 30: optional shared.QueryWorkflowRequest queryRequest\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.TaskList taskList\n 30: optional string taskID\n 40: optional shared.RespondQueryTaskCompletedRequest completedRequest\n}\n\nstruct CancelOutstandingPollRequest {\n 10: optional string domainUUID\n 20: optional i32 taskListType\n 30: optional shared.TaskList taskList\n 40: optional string pollerID\n}\n\nstruct GetPollerHistoryRequest {\n 10: optional string domainUUID\n 20: optional shared.GetPollerHistoryRequest getRequest\n}\n\n/**\n* MatchingService API is exposed to provide support for polling from long running applications.\n* Such applications are expected to have a worker which regularly polls for DecisionTask and ActivityTask. For each\n* DecisionTask, application is expected to process the history of events for that session and respond back with next\n* decisions. For each ActivityTask, application is expected to execute the actual logic for that task and respond back\n* with completion or failure.\n**/\nservice MatchingService {\n /**\n * PollForDecisionTask is called by frontend to process DecisionTask from a specific taskList. A\n * DecisionTask is dispatched to callers for active workflow executions, with pending decisions.\n **/\n PollForDecisionTaskResponse PollForDecisionTask(1: PollForDecisionTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n )\n\n /**\n * PollForActivityTask is called by frontend to process ActivityTask from a specific taskList. ActivityTask\n * is dispatched to callers whenever a ScheduleTask decision is made for a workflow execution.\n **/\n shared.PollForActivityTaskResponse PollForActivityTask(1: PollForActivityTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n )\n\n /**\n * AddDecisionTask is called by the history service when a decision task is scheduled, so that it can be dispatched\n * by the MatchingEngine.\n **/\n void AddDecisionTask(1: AddDecisionTaskRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * AddActivityTask is called by the history service when a decision task is scheduled, so that it can be dispatched\n * by the MatchingEngine.\n **/\n void AddActivityTask(1: AddActivityTaskRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * QueryWorkflow is called by frontend to query a workflow.\n **/\n shared.QueryWorkflowResponse QueryWorkflow(1: QueryWorkflowRequest queryRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.QueryFailedError queryFailedError,\n )\n\n /**\n * RespondQueryTaskCompleted is called by frontend to respond query completed.\n **/\n void RespondQueryTaskCompleted(1: RespondQueryTaskCompletedRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * CancelOutstandingPoll is called by frontend to unblock long polls on matching for zombie pollers.\n * Our rpc stack does not support context propagation, so when a client connection goes away frontend sees\n * cancellation of context for that handler, but any corresponding calls (long-poll) to matching service does not\n * see the cancellation propagated so it can unblock corresponding long-polls on its end. This results is tasks\n * being dispatched to zombie pollers in this situation. This API is added so everytime frontend makes a long-poll\n * api call to matching it passes in a pollerID and then calls this API when it detects client connection is closed\n * to unblock long polls for this poller and prevent tasks being sent to these zombie pollers.\n **/\n void CancelOutstandingPoll(1: CancelOutstandingPollRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n )\n\n /**\n * GetPollerHistory returns pollers which poll from given tasklist in last few minutes.\n **/\n shared.GetPollerHistoryResponse GetPollerHistory(1: GetPollerHistoryRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n}\n" diff --git a/.gen/go/matching/matchingservice_getpollerhistory.go b/.gen/go/matching/matchingservice_getpollerhistory.go new file mode 100644 index 00000000000..903d73007c0 --- /dev/null +++ b/.gen/go/matching/matchingservice_getpollerhistory.go @@ -0,0 +1,507 @@ +// 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. + +// Code generated by thriftrw v1.8.0. DO NOT EDIT. +// @generated + +package matching + +import ( + "errors" + "fmt" + "github.com/uber/cadence/.gen/go/shared" + "go.uber.org/thriftrw/wire" + "strings" +) + +// MatchingService_GetPollerHistory_Args represents the arguments for the MatchingService.GetPollerHistory function. +// +// The arguments for GetPollerHistory are sent and received over the wire as this struct. +type MatchingService_GetPollerHistory_Args struct { + Request *GetPollerHistoryRequest `json:"request,omitempty"` +} + +// ToWire translates a MatchingService_GetPollerHistory_Args 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 *MatchingService_GetPollerHistory_Args) ToWire() (wire.Value, error) { + var ( + fields [1]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.Request != nil { + w, err = v.Request.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 1, Value: w} + i++ + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +func _GetPollerHistoryRequest_1_Read(w wire.Value) (*GetPollerHistoryRequest, error) { + var v GetPollerHistoryRequest + err := v.FromWire(w) + return &v, err +} + +// FromWire deserializes a MatchingService_GetPollerHistory_Args 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 MatchingService_GetPollerHistory_Args struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v MatchingService_GetPollerHistory_Args +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *MatchingService_GetPollerHistory_Args) FromWire(w wire.Value) error { + var err error + + for _, field := range w.GetStruct().Fields { + switch field.ID { + case 1: + if field.Value.Type() == wire.TStruct { + v.Request, err = _GetPollerHistoryRequest_1_Read(field.Value) + if err != nil { + return err + } + + } + } + } + + return nil +} + +// String returns a readable string representation of a MatchingService_GetPollerHistory_Args +// struct. +func (v *MatchingService_GetPollerHistory_Args) String() string { + if v == nil { + return "" + } + + var fields [1]string + i := 0 + if v.Request != nil { + fields[i] = fmt.Sprintf("Request: %v", v.Request) + i++ + } + + return fmt.Sprintf("MatchingService_GetPollerHistory_Args{%v}", strings.Join(fields[:i], ", ")) +} + +// Equals returns true if all the fields of this MatchingService_GetPollerHistory_Args match the +// provided MatchingService_GetPollerHistory_Args. +// +// This function performs a deep comparison. +func (v *MatchingService_GetPollerHistory_Args) Equals(rhs *MatchingService_GetPollerHistory_Args) bool { + if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) { + return false + } + + return true +} + +// MethodName returns the name of the Thrift function as specified in +// the IDL, for which this struct represent the arguments. +// +// This will always be "GetPollerHistory" for this struct. +func (v *MatchingService_GetPollerHistory_Args) MethodName() string { + return "GetPollerHistory" +} + +// EnvelopeType returns the kind of value inside this struct. +// +// This will always be Call for this struct. +func (v *MatchingService_GetPollerHistory_Args) EnvelopeType() wire.EnvelopeType { + return wire.Call +} + +// MatchingService_GetPollerHistory_Helper provides functions that aid in handling the +// parameters and return values of the MatchingService.GetPollerHistory +// function. +var MatchingService_GetPollerHistory_Helper = struct { + // Args accepts the parameters of GetPollerHistory in-order and returns + // the arguments struct for the function. + Args func( + request *GetPollerHistoryRequest, + ) *MatchingService_GetPollerHistory_Args + + // IsException returns true if the given error can be thrown + // by GetPollerHistory. + // + // An error can be thrown by GetPollerHistory only if the + // corresponding exception type was mentioned in the 'throws' + // section for it in the Thrift file. + IsException func(error) bool + + // WrapResponse returns the result struct for GetPollerHistory + // given its return value and error. + // + // This allows mapping values and errors returned by + // GetPollerHistory into a serializable result struct. + // WrapResponse returns a non-nil error if the provided + // error cannot be thrown by GetPollerHistory + // + // value, err := GetPollerHistory(args) + // result, err := MatchingService_GetPollerHistory_Helper.WrapResponse(value, err) + // if err != nil { + // return fmt.Errorf("unexpected error from GetPollerHistory: %v", err) + // } + // serialize(result) + WrapResponse func(*shared.GetPollerHistoryResponse, error) (*MatchingService_GetPollerHistory_Result, error) + + // UnwrapResponse takes the result struct for GetPollerHistory + // and returns the value or error returned by it. + // + // The error is non-nil only if GetPollerHistory threw an + // exception. + // + // result := deserialize(bytes) + // value, err := MatchingService_GetPollerHistory_Helper.UnwrapResponse(result) + UnwrapResponse func(*MatchingService_GetPollerHistory_Result) (*shared.GetPollerHistoryResponse, error) +}{} + +func init() { + MatchingService_GetPollerHistory_Helper.Args = func( + request *GetPollerHistoryRequest, + ) *MatchingService_GetPollerHistory_Args { + return &MatchingService_GetPollerHistory_Args{ + Request: request, + } + } + + MatchingService_GetPollerHistory_Helper.IsException = func(err error) bool { + switch err.(type) { + case *shared.BadRequestError: + return true + case *shared.InternalServiceError: + return true + case *shared.EntityNotExistsError: + return true + default: + return false + } + } + + MatchingService_GetPollerHistory_Helper.WrapResponse = func(success *shared.GetPollerHistoryResponse, err error) (*MatchingService_GetPollerHistory_Result, error) { + if err == nil { + return &MatchingService_GetPollerHistory_Result{Success: success}, nil + } + + switch e := err.(type) { + case *shared.BadRequestError: + if e == nil { + return nil, errors.New("WrapResponse received non-nil error type with nil value for MatchingService_GetPollerHistory_Result.BadRequestError") + } + return &MatchingService_GetPollerHistory_Result{BadRequestError: e}, nil + case *shared.InternalServiceError: + if e == nil { + return nil, errors.New("WrapResponse received non-nil error type with nil value for MatchingService_GetPollerHistory_Result.InternalServiceError") + } + return &MatchingService_GetPollerHistory_Result{InternalServiceError: e}, nil + case *shared.EntityNotExistsError: + if e == nil { + return nil, errors.New("WrapResponse received non-nil error type with nil value for MatchingService_GetPollerHistory_Result.EntityNotExistError") + } + return &MatchingService_GetPollerHistory_Result{EntityNotExistError: e}, nil + } + + return nil, err + } + MatchingService_GetPollerHistory_Helper.UnwrapResponse = func(result *MatchingService_GetPollerHistory_Result) (success *shared.GetPollerHistoryResponse, err error) { + if result.BadRequestError != nil { + err = result.BadRequestError + return + } + if result.InternalServiceError != nil { + err = result.InternalServiceError + return + } + if result.EntityNotExistError != nil { + err = result.EntityNotExistError + return + } + + if result.Success != nil { + success = result.Success + return + } + + err = errors.New("expected a non-void result") + return + } + +} + +// MatchingService_GetPollerHistory_Result represents the result of a MatchingService.GetPollerHistory function call. +// +// The result of a GetPollerHistory execution is sent and received over the wire as this struct. +// +// Success is set only if the function did not throw an exception. +type MatchingService_GetPollerHistory_Result struct { + // Value returned by GetPollerHistory after a successful execution. + Success *shared.GetPollerHistoryResponse `json:"success,omitempty"` + BadRequestError *shared.BadRequestError `json:"badRequestError,omitempty"` + InternalServiceError *shared.InternalServiceError `json:"internalServiceError,omitempty"` + EntityNotExistError *shared.EntityNotExistsError `json:"entityNotExistError,omitempty"` +} + +// ToWire translates a MatchingService_GetPollerHistory_Result 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 *MatchingService_GetPollerHistory_Result) ToWire() (wire.Value, error) { + var ( + fields [4]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.Success != nil { + w, err = v.Success.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 0, Value: w} + i++ + } + if v.BadRequestError != nil { + w, err = v.BadRequestError.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 1, Value: w} + i++ + } + if v.InternalServiceError != nil { + w, err = v.InternalServiceError.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 2, Value: w} + i++ + } + if v.EntityNotExistError != nil { + w, err = v.EntityNotExistError.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 3, Value: w} + i++ + } + + if i != 1 { + return wire.Value{}, fmt.Errorf("MatchingService_GetPollerHistory_Result should have exactly one field: got %v fields", i) + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +func _GetPollerHistoryResponse_Read(w wire.Value) (*shared.GetPollerHistoryResponse, error) { + var v shared.GetPollerHistoryResponse + err := v.FromWire(w) + return &v, err +} + +func _EntityNotExistsError_Read(w wire.Value) (*shared.EntityNotExistsError, error) { + var v shared.EntityNotExistsError + err := v.FromWire(w) + return &v, err +} + +// FromWire deserializes a MatchingService_GetPollerHistory_Result 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 MatchingService_GetPollerHistory_Result struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v MatchingService_GetPollerHistory_Result +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *MatchingService_GetPollerHistory_Result) FromWire(w wire.Value) error { + var err error + + for _, field := range w.GetStruct().Fields { + switch field.ID { + case 0: + if field.Value.Type() == wire.TStruct { + v.Success, err = _GetPollerHistoryResponse_Read(field.Value) + if err != nil { + return err + } + + } + case 1: + if field.Value.Type() == wire.TStruct { + v.BadRequestError, err = _BadRequestError_Read(field.Value) + if err != nil { + return err + } + + } + case 2: + if field.Value.Type() == wire.TStruct { + v.InternalServiceError, err = _InternalServiceError_Read(field.Value) + if err != nil { + return err + } + + } + case 3: + if field.Value.Type() == wire.TStruct { + v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value) + if err != nil { + return err + } + + } + } + } + + count := 0 + if v.Success != nil { + count++ + } + if v.BadRequestError != nil { + count++ + } + if v.InternalServiceError != nil { + count++ + } + if v.EntityNotExistError != nil { + count++ + } + if count != 1 { + return fmt.Errorf("MatchingService_GetPollerHistory_Result should have exactly one field: got %v fields", count) + } + + return nil +} + +// String returns a readable string representation of a MatchingService_GetPollerHistory_Result +// struct. +func (v *MatchingService_GetPollerHistory_Result) String() string { + if v == nil { + return "" + } + + var fields [4]string + i := 0 + if v.Success != nil { + fields[i] = fmt.Sprintf("Success: %v", v.Success) + i++ + } + if v.BadRequestError != nil { + fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError) + i++ + } + if v.InternalServiceError != nil { + fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError) + i++ + } + if v.EntityNotExistError != nil { + fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError) + i++ + } + + return fmt.Sprintf("MatchingService_GetPollerHistory_Result{%v}", strings.Join(fields[:i], ", ")) +} + +// Equals returns true if all the fields of this MatchingService_GetPollerHistory_Result match the +// provided MatchingService_GetPollerHistory_Result. +// +// This function performs a deep comparison. +func (v *MatchingService_GetPollerHistory_Result) Equals(rhs *MatchingService_GetPollerHistory_Result) bool { + if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) { + return false + } + if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) { + return false + } + if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) { + return false + } + if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) { + return false + } + + return true +} + +// MethodName returns the name of the Thrift function as specified in +// the IDL, for which this struct represent the result. +// +// This will always be "GetPollerHistory" for this struct. +func (v *MatchingService_GetPollerHistory_Result) MethodName() string { + return "GetPollerHistory" +} + +// EnvelopeType returns the kind of value inside this struct. +// +// This will always be Reply for this struct. +func (v *MatchingService_GetPollerHistory_Result) EnvelopeType() wire.EnvelopeType { + return wire.Reply +} diff --git a/.gen/go/matching/matchingservice_queryworkflow.go b/.gen/go/matching/matchingservice_queryworkflow.go index db3b8a88e68..77396343af1 100644 --- a/.gen/go/matching/matchingservice_queryworkflow.go +++ b/.gen/go/matching/matchingservice_queryworkflow.go @@ -378,12 +378,6 @@ func _QueryWorkflowResponse_Read(w wire.Value) (*shared.QueryWorkflowResponse, e return &v, err } -func _EntityNotExistsError_Read(w wire.Value) (*shared.EntityNotExistsError, error) { - var v shared.EntityNotExistsError - err := v.FromWire(w) - return &v, err -} - func _QueryFailedError_Read(w wire.Value) (*shared.QueryFailedError, error) { var v shared.QueryFailedError err := v.FromWire(w) diff --git a/.gen/go/matching/matchingserviceclient/client.go b/.gen/go/matching/matchingserviceclient/client.go index d1088a748cf..05debbc41f4 100644 --- a/.gen/go/matching/matchingserviceclient/client.go +++ b/.gen/go/matching/matchingserviceclient/client.go @@ -54,6 +54,12 @@ type Interface interface { opts ...yarpc.CallOption, ) error + GetPollerHistory( + ctx context.Context, + Request *matching.GetPollerHistoryRequest, + opts ...yarpc.CallOption, + ) (*shared.GetPollerHistoryResponse, error) + PollForActivityTask( ctx context.Context, PollRequest *matching.PollForActivityTaskRequest, @@ -172,6 +178,29 @@ func (c client) CancelOutstandingPoll( return } +func (c client) GetPollerHistory( + ctx context.Context, + _Request *matching.GetPollerHistoryRequest, + opts ...yarpc.CallOption, +) (success *shared.GetPollerHistoryResponse, err error) { + + args := matching.MatchingService_GetPollerHistory_Helper.Args(_Request) + + var body wire.Value + body, err = c.c.Call(ctx, args, opts...) + if err != nil { + return + } + + var result matching.MatchingService_GetPollerHistory_Result + if err = result.FromWire(body); err != nil { + return + } + + success, err = matching.MatchingService_GetPollerHistory_Helper.UnwrapResponse(&result) + return +} + func (c client) PollForActivityTask( ctx context.Context, _PollRequest *matching.PollForActivityTaskRequest, diff --git a/.gen/go/matching/matchingserviceserver/server.go b/.gen/go/matching/matchingserviceserver/server.go index 686a8b0df1a..87879a5f490 100644 --- a/.gen/go/matching/matchingserviceserver/server.go +++ b/.gen/go/matching/matchingserviceserver/server.go @@ -49,6 +49,11 @@ type Interface interface { Request *matching.CancelOutstandingPollRequest, ) error + GetPollerHistory( + ctx context.Context, + Request *matching.GetPollerHistoryRequest, + ) (*shared.GetPollerHistoryResponse, error) + PollForActivityTask( ctx context.Context, PollRequest *matching.PollForActivityTaskRequest, @@ -114,6 +119,17 @@ func New(impl Interface, opts ...thrift.RegisterOption) []transport.Procedure { ThriftModule: matching.ThriftModule, }, + thrift.Method{ + Name: "GetPollerHistory", + HandlerSpec: thrift.HandlerSpec{ + + Type: transport.Unary, + Unary: thrift.UnaryHandler(h.GetPollerHistory), + }, + Signature: "GetPollerHistory(Request *matching.GetPollerHistoryRequest) (*shared.GetPollerHistoryResponse)", + ThriftModule: matching.ThriftModule, + }, + thrift.Method{ Name: "PollForActivityTask", HandlerSpec: thrift.HandlerSpec{ @@ -160,7 +176,7 @@ func New(impl Interface, opts ...thrift.RegisterOption) []transport.Procedure { }, } - procedures := make([]transport.Procedure, 0, 7) + procedures := make([]transport.Procedure, 0, 8) procedures = append(procedures, thrift.BuildProcedures(service, opts...)...) return procedures } @@ -224,6 +240,25 @@ func (h handler) CancelOutstandingPoll(ctx context.Context, body wire.Value) (th return response, err } +func (h handler) GetPollerHistory(ctx context.Context, body wire.Value) (thrift.Response, error) { + var args matching.MatchingService_GetPollerHistory_Args + if err := args.FromWire(body); err != nil { + return thrift.Response{}, err + } + + success, err := h.impl.GetPollerHistory(ctx, args.Request) + + hadError := err != nil + result, err := matching.MatchingService_GetPollerHistory_Helper.WrapResponse(success, err) + + var response thrift.Response + if err == nil { + response.IsApplicationError = hadError + response.Body = result + } + return response, err +} + func (h handler) PollForActivityTask(ctx context.Context, body wire.Value) (thrift.Response, error) { var args matching.MatchingService_PollForActivityTask_Args if err := args.FromWire(body); err != nil { diff --git a/.gen/go/matching/matchingservicetest/client.go b/.gen/go/matching/matchingservicetest/client.go index d19af0f3bde..f5fee34fe30 100644 --- a/.gen/go/matching/matchingservicetest/client.go +++ b/.gen/go/matching/matchingservicetest/client.go @@ -156,6 +156,39 @@ func (mr *_MockClientRecorder) CancelOutstandingPoll( return mr.mock.ctrl.RecordCall(mr.mock, "CancelOutstandingPoll", args...) } +// GetPollerHistory responds to a GetPollerHistory call based on the mock expectations. This +// call will fail if the mock does not expect this call. Use EXPECT to expect +// a call to this function. +// +// client.EXPECT().GetPollerHistory(gomock.Any(), ...).Return(...) +// ... := client.GetPollerHistory(...) +func (m *MockClient) GetPollerHistory( + ctx context.Context, + _Request *matching.GetPollerHistoryRequest, + opts ...yarpc.CallOption, +) (success *shared.GetPollerHistoryResponse, err error) { + + args := []interface{}{ctx, _Request} + for _, o := range opts { + args = append(args, o) + } + i := 0 + ret := m.ctrl.Call(m, "GetPollerHistory", args...) + success, _ = ret[i].(*shared.GetPollerHistoryResponse) + i++ + err, _ = ret[i].(error) + return +} + +func (mr *_MockClientRecorder) GetPollerHistory( + ctx interface{}, + _Request interface{}, + opts ...interface{}, +) *gomock.Call { + args := append([]interface{}{ctx, _Request}, opts...) + return mr.mock.ctrl.RecordCall(mr.mock, "GetPollerHistory", args...) +} + // PollForActivityTask responds to a PollForActivityTask call based on the mock expectations. This // call will fail if the mock does not expect this call. Use EXPECT to expect // a call to this function. diff --git a/.gen/go/matching/types.go b/.gen/go/matching/types.go index a3009ef31c2..1df0bd6db3c 100644 --- a/.gen/go/matching/types.go +++ b/.gen/go/matching/types.go @@ -793,6 +793,152 @@ func (v *CancelOutstandingPollRequest) GetPollerID() (o string) { return } +type GetPollerHistoryRequest struct { + DomainUUID *string `json:"domainUUID,omitempty"` + GetRequest *shared.GetPollerHistoryRequest `json:"getRequest,omitempty"` +} + +// ToWire translates a GetPollerHistoryRequest 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 *GetPollerHistoryRequest) ToWire() (wire.Value, error) { + var ( + fields [2]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.DomainUUID != nil { + w, err = wire.NewValueString(*(v.DomainUUID)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 10, Value: w} + i++ + } + if v.GetRequest != nil { + w, err = v.GetRequest.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 20, Value: w} + i++ + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +func _GetPollerHistoryRequest_Read(w wire.Value) (*shared.GetPollerHistoryRequest, error) { + var v shared.GetPollerHistoryRequest + err := v.FromWire(w) + return &v, err +} + +// FromWire deserializes a GetPollerHistoryRequest 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 GetPollerHistoryRequest struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v GetPollerHistoryRequest +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *GetPollerHistoryRequest) 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.DomainUUID = &x + if err != nil { + return err + } + + } + case 20: + if field.Value.Type() == wire.TStruct { + v.GetRequest, err = _GetPollerHistoryRequest_Read(field.Value) + if err != nil { + return err + } + + } + } + } + + return nil +} + +// String returns a readable string representation of a GetPollerHistoryRequest +// struct. +func (v *GetPollerHistoryRequest) String() string { + if v == nil { + return "" + } + + var fields [2]string + i := 0 + if v.DomainUUID != nil { + fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID)) + i++ + } + if v.GetRequest != nil { + fields[i] = fmt.Sprintf("GetRequest: %v", v.GetRequest) + i++ + } + + return fmt.Sprintf("GetPollerHistoryRequest{%v}", strings.Join(fields[:i], ", ")) +} + +// Equals returns true if all the fields of this GetPollerHistoryRequest match the +// provided GetPollerHistoryRequest. +// +// This function performs a deep comparison. +func (v *GetPollerHistoryRequest) Equals(rhs *GetPollerHistoryRequest) bool { + if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) { + return false + } + if !((v.GetRequest == nil && rhs.GetRequest == nil) || (v.GetRequest != nil && rhs.GetRequest != nil && v.GetRequest.Equals(rhs.GetRequest))) { + return false + } + + return true +} + +// GetDomainUUID returns the value of DomainUUID if it is set or its +// zero value if it is unset. +func (v *GetPollerHistoryRequest) GetDomainUUID() (o string) { + if v.DomainUUID != nil { + return *v.DomainUUID + } + + return +} + type PollForActivityTaskRequest struct { DomainUUID *string `json:"domainUUID,omitempty"` PollerID *string `json:"pollerID,omitempty"` diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index ace0c4bb7b1..fb97be53967 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "github.com/uber/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "b99e79243700c10b446aa60ecac70d4e1d567759", + SHA1: "c8e3b24f64d226104d5dbcd6ece100a756e869d5", 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\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\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}\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}\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}\n\nenum CancelExternalWorkflowExecutionFailedCause {\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\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}\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 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}\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}\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}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\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}\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}\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}\n\nstruct WorkflowExecutionStartedEventAttributes {\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 string identity\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\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}\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}\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}\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}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\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}\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}\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 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}\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 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}\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}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\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}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\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}\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}\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}\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}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: 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 domainID\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 domainID\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 domainID\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}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\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}\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 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 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 DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\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\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\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}\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}\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}\n\nenum CancelExternalWorkflowExecutionFailedCause {\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\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}\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 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}\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}\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}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\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}\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}\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}\n\nstruct WorkflowExecutionStartedEventAttributes {\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 string identity\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\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}\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}\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}\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}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\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}\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}\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 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}\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 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}\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}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\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}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\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}\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}\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}\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}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: 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 domainID\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 domainID\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 domainID\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}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\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}\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 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 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 DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n\nstruct GetPollerHistoryRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n}\n\nstruct GetPollerHistoryResponse {\n 10: optional list pollers\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 // ISO 8601 format\n 10: optional string timestamp\n 20: optional string identity\n}\n" diff --git a/.gen/go/shared/types.go b/.gen/go/shared/types.go index 995b826fa4e..9380dae7afb 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -8903,6 +8903,370 @@ func (v *FailWorkflowExecutionDecisionAttributes) GetReason() (o string) { return } +type GetPollerHistoryRequest struct { + Domain *string `json:"domain,omitempty"` + TaskList *TaskList `json:"taskList,omitempty"` + TaskListType *TaskListType `json:"taskListType,omitempty"` +} + +// ToWire translates a GetPollerHistoryRequest 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 *GetPollerHistoryRequest) ToWire() (wire.Value, error) { + var ( + fields [3]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.TaskList != nil { + w, err = v.TaskList.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 20, Value: w} + i++ + } + if v.TaskListType != nil { + w, err = v.TaskListType.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 30, Value: w} + i++ + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil +} + +func _TaskListType_Read(w wire.Value) (TaskListType, error) { + var v TaskListType + err := v.FromWire(w) + return v, err +} + +// FromWire deserializes a GetPollerHistoryRequest 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 GetPollerHistoryRequest struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v GetPollerHistoryRequest +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *GetPollerHistoryRequest) 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.TStruct { + v.TaskList, err = _TaskList_Read(field.Value) + if err != nil { + return err + } + + } + case 30: + if field.Value.Type() == wire.TI32 { + var x TaskListType + x, err = _TaskListType_Read(field.Value) + v.TaskListType = &x + if err != nil { + return err + } + + } + } + } + + return nil +} + +// String returns a readable string representation of a GetPollerHistoryRequest +// struct. +func (v *GetPollerHistoryRequest) String() string { + if v == nil { + return "" + } + + var fields [3]string + i := 0 + if v.Domain != nil { + fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) + i++ + } + if v.TaskList != nil { + fields[i] = fmt.Sprintf("TaskList: %v", v.TaskList) + i++ + } + if v.TaskListType != nil { + fields[i] = fmt.Sprintf("TaskListType: %v", *(v.TaskListType)) + i++ + } + + return fmt.Sprintf("GetPollerHistoryRequest{%v}", strings.Join(fields[:i], ", ")) +} + +func _TaskListType_EqualsPtr(lhs, rhs *TaskListType) bool { + if lhs != nil && rhs != nil { + + x := *lhs + y := *rhs + return x.Equals(y) + } + return lhs == nil && rhs == nil +} + +// Equals returns true if all the fields of this GetPollerHistoryRequest match the +// provided GetPollerHistoryRequest. +// +// This function performs a deep comparison. +func (v *GetPollerHistoryRequest) Equals(rhs *GetPollerHistoryRequest) bool { + if !_String_EqualsPtr(v.Domain, rhs.Domain) { + return false + } + if !((v.TaskList == nil && rhs.TaskList == nil) || (v.TaskList != nil && rhs.TaskList != nil && v.TaskList.Equals(rhs.TaskList))) { + return false + } + if !_TaskListType_EqualsPtr(v.TaskListType, rhs.TaskListType) { + return false + } + + return true +} + +// GetDomain returns the value of Domain if it is set or its +// zero value if it is unset. +func (v *GetPollerHistoryRequest) GetDomain() (o string) { + if v.Domain != nil { + return *v.Domain + } + + return +} + +// GetTaskListType returns the value of TaskListType if it is set or its +// zero value if it is unset. +func (v *GetPollerHistoryRequest) GetTaskListType() (o TaskListType) { + if v.TaskListType != nil { + return *v.TaskListType + } + + return +} + +type GetPollerHistoryResponse struct { + Pollers []*PollerInfo `json:"pollers,omitempty"` +} + +type _List_PollerInfo_ValueList []*PollerInfo + +func (v _List_PollerInfo_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_PollerInfo_ValueList) Size() int { + return len(v) +} + +func (_List_PollerInfo_ValueList) ValueType() wire.Type { + return wire.TStruct +} + +func (_List_PollerInfo_ValueList) Close() {} + +// ToWire translates a GetPollerHistoryResponse 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 *GetPollerHistoryResponse) ToWire() (wire.Value, error) { + var ( + fields [1]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.Pollers != nil { + w, err = wire.NewValueList(_List_PollerInfo_ValueList(v.Pollers)), 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 _PollerInfo_Read(w wire.Value) (*PollerInfo, error) { + var v PollerInfo + err := v.FromWire(w) + return &v, err +} + +func _List_PollerInfo_Read(l wire.ValueList) ([]*PollerInfo, error) { + if l.ValueType() != wire.TStruct { + return nil, nil + } + + o := make([]*PollerInfo, 0, l.Size()) + err := l.ForEach(func(x wire.Value) error { + i, err := _PollerInfo_Read(x) + if err != nil { + return err + } + o = append(o, i) + return nil + }) + l.Close() + return o, err +} + +// FromWire deserializes a GetPollerHistoryResponse 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 GetPollerHistoryResponse struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v GetPollerHistoryResponse +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *GetPollerHistoryResponse) 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.Pollers, err = _List_PollerInfo_Read(field.Value.GetList()) + if err != nil { + return err + } + + } + } + } + + return nil +} + +// String returns a readable string representation of a GetPollerHistoryResponse +// struct. +func (v *GetPollerHistoryResponse) String() string { + if v == nil { + return "" + } + + var fields [1]string + i := 0 + if v.Pollers != nil { + fields[i] = fmt.Sprintf("Pollers: %v", v.Pollers) + i++ + } + + return fmt.Sprintf("GetPollerHistoryResponse{%v}", strings.Join(fields[:i], ", ")) +} + +func _List_PollerInfo_Equals(lhs, rhs []*PollerInfo) 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 GetPollerHistoryResponse match the +// provided GetPollerHistoryResponse. +// +// This function performs a deep comparison. +func (v *GetPollerHistoryResponse) Equals(rhs *GetPollerHistoryResponse) bool { + if !((v.Pollers == nil && rhs.Pollers == nil) || (v.Pollers != nil && rhs.Pollers != nil && _List_PollerInfo_Equals(v.Pollers, rhs.Pollers))) { + return false + } + + return true +} + type GetWorkflowExecutionHistoryRequest struct { Domain *string `json:"domain,omitempty"` Execution *WorkflowExecution `json:"execution,omitempty"` @@ -13107,6 +13471,158 @@ func (v *PollForDecisionTaskResponse) GetBacklogCountHint() (o int64) { return } +type PollerInfo struct { + Timestamp *string `json:"timestamp,omitempty"` + Identity *string `json:"identity,omitempty"` +} + +// ToWire translates a PollerInfo 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 *PollerInfo) ToWire() (wire.Value, error) { + var ( + fields [2]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.Timestamp != nil { + w, err = wire.NewValueString(*(v.Timestamp)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 10, Value: w} + i++ + } + if v.Identity != nil { + w, err = wire.NewValueString(*(v.Identity)), 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 PollerInfo 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 PollerInfo struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v PollerInfo +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *PollerInfo) 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.Timestamp = &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.Identity = &x + if err != nil { + return err + } + + } + } + } + + return nil +} + +// String returns a readable string representation of a PollerInfo +// struct. +func (v *PollerInfo) String() string { + if v == nil { + return "" + } + + var fields [2]string + i := 0 + if v.Timestamp != nil { + fields[i] = fmt.Sprintf("Timestamp: %v", *(v.Timestamp)) + i++ + } + if v.Identity != nil { + fields[i] = fmt.Sprintf("Identity: %v", *(v.Identity)) + i++ + } + + return fmt.Sprintf("PollerInfo{%v}", strings.Join(fields[:i], ", ")) +} + +// Equals returns true if all the fields of this PollerInfo match the +// provided PollerInfo. +// +// This function performs a deep comparison. +func (v *PollerInfo) Equals(rhs *PollerInfo) bool { + if !_String_EqualsPtr(v.Timestamp, rhs.Timestamp) { + return false + } + if !_String_EqualsPtr(v.Identity, rhs.Identity) { + return false + } + + return true +} + +// GetTimestamp returns the value of Timestamp if it is set or its +// zero value if it is unset. +func (v *PollerInfo) GetTimestamp() (o string) { + if v.Timestamp != nil { + return *v.Timestamp + } + + return +} + +// GetIdentity returns the value of Identity if it is set or its +// zero value if it is unset. +func (v *PollerInfo) GetIdentity() (o string) { + if v.Identity != nil { + return *v.Identity + } + + return +} + type QueryFailedError struct { Message string `json:"message,required"` } @@ -20653,6 +21169,136 @@ func (v *TaskListMetadata) GetMaxTasksPerSecond() (o float64) { return } +type TaskListType int32 + +const ( + TaskListTypeDecision TaskListType = 0 + TaskListTypeActivity TaskListType = 1 +) + +// TaskListType_Values returns all recognized values of TaskListType. +func TaskListType_Values() []TaskListType { + return []TaskListType{ + TaskListTypeDecision, + TaskListTypeActivity, + } +} + +// UnmarshalText tries to decode TaskListType from a byte slice +// containing its name. +// +// var v TaskListType +// err := v.UnmarshalText([]byte("Decision")) +func (v *TaskListType) UnmarshalText(value []byte) error { + switch string(value) { + case "Decision": + *v = TaskListTypeDecision + return nil + case "Activity": + *v = TaskListTypeActivity + return nil + default: + return fmt.Errorf("unknown enum value %q for %q", value, "TaskListType") + } +} + +// ToWire translates TaskListType into a Thrift-level intermediate +// representation. This intermediate representation may be serialized +// into bytes using a ThriftRW protocol implementation. +// +// Enums are represented as 32-bit integers over the wire. +func (v TaskListType) ToWire() (wire.Value, error) { + return wire.NewValueI32(int32(v)), nil +} + +// FromWire deserializes TaskListType from its Thrift-level +// representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TI32) +// if err != nil { +// return TaskListType(0), err +// } +// +// var v TaskListType +// if err := v.FromWire(x); err != nil { +// return TaskListType(0), err +// } +// return v, nil +func (v *TaskListType) FromWire(w wire.Value) error { + *v = (TaskListType)(w.GetI32()) + return nil +} + +// String returns a readable string representation of TaskListType. +func (v TaskListType) String() string { + w := int32(v) + switch w { + case 0: + return "Decision" + case 1: + return "Activity" + } + return fmt.Sprintf("TaskListType(%d)", w) +} + +// Equals returns true if this TaskListType value matches the provided +// value. +func (v TaskListType) Equals(rhs TaskListType) bool { + return v == rhs +} + +// MarshalJSON serializes TaskListType into JSON. +// +// If the enum value is recognized, its name is returned. Otherwise, +// its integer value is returned. +// +// This implements json.Marshaler. +func (v TaskListType) MarshalJSON() ([]byte, error) { + switch int32(v) { + case 0: + return ([]byte)("\"Decision\""), nil + case 1: + return ([]byte)("\"Activity\""), nil + } + return ([]byte)(strconv.FormatInt(int64(v), 10)), nil +} + +// UnmarshalJSON attempts to decode TaskListType from its JSON +// representation. +// +// This implementation supports both, numeric and string inputs. If a +// string is provided, it must be a known enum name. +// +// This implements json.Unmarshaler. +func (v *TaskListType) UnmarshalJSON(text []byte) error { + d := json.NewDecoder(bytes.NewReader(text)) + d.UseNumber() + t, err := d.Token() + if err != nil { + return err + } + + switch w := t.(type) { + case json.Number: + x, err := w.Int64() + if err != nil { + return err + } + if x > math.MaxInt32 { + return fmt.Errorf("enum overflow from JSON %q for %q", text, "TaskListType") + } + if x < math.MinInt32 { + return fmt.Errorf("enum underflow from JSON %q for %q", text, "TaskListType") + } + *v = (TaskListType)(x) + return nil + case string: + return v.UnmarshalText([]byte(w)) + default: + return fmt.Errorf("invalid JSON value %q (%T) to unmarshal into %q", t, t, "TaskListType") + } +} + type TerminateWorkflowExecutionRequest struct { Domain *string `json:"domain,omitempty"` WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"` diff --git a/client/matching/client.go b/client/matching/client.go index 73f88df3441..12d94697f6c 100644 --- a/client/matching/client.go +++ b/client/matching/client.go @@ -146,6 +146,17 @@ func (c *clientImpl) CancelOutstandingPoll(ctx context.Context, request *m.Cance return client.CancelOutstandingPoll(ctx, request, opts...) } +func (c *clientImpl) GetPollerHistory(ctx context.Context, request *m.GetPollerHistoryRequest, opts ...yarpc.CallOption) (*workflow.GetPollerHistoryResponse, error) { + opts = common.AggregateYarpcOptions(ctx, opts...) + client, err := c.getHostForRequest(request.GetRequest.TaskList.GetName()) + if err != nil { + return nil, err + } + ctx, cancel := c.createContext(ctx) + defer cancel() + return client.GetPollerHistory(ctx, request, opts...) +} + func (c *clientImpl) getHostForRequest(key string) (matchingserviceclient.Interface, error) { host, err := c.resolver.Lookup(key) if err != nil { diff --git a/client/matching/metricClient.go b/client/matching/metricClient.go index 7caa8c9dbb2..526e4cea92a 100644 --- a/client/matching/metricClient.go +++ b/client/matching/metricClient.go @@ -162,3 +162,20 @@ func (c *metricClient) CancelOutstandingPoll( return err } + +func (c *metricClient) GetPollerHistory( + ctx context.Context, + request *m.GetPollerHistoryRequest, + opts ...yarpc.CallOption) (*workflow.GetPollerHistoryResponse, error) { + c.metricsClient.IncCounter(metrics.MatchingClientGetPollerHistoryScope, metrics.CadenceRequests) + + sw := c.metricsClient.StartTimer(metrics.MatchingClientGetPollerHistoryScope, metrics.CadenceLatency) + resp, err := c.client.GetPollerHistory(ctx, request, opts...) + sw.Stop() + + if err != nil { + c.metricsClient.IncCounter(metrics.MatchingClientGetPollerHistoryScope, metrics.CadenceFailures) + } + + return resp, err +} diff --git a/common/cache/cache.go b/common/cache/cache.go index a63d3f6d3f3..74c08e53384 100644 --- a/common/cache/cache.go +++ b/common/cache/cache.go @@ -44,6 +44,9 @@ type Cache interface { // drops to 0, the element can be evicted from the cache. Release(key interface{}) + // Iterator returns the iterator of the cache + Iterator() Iterator + // Size returns the number of entries currently stored in the Cache Size() int } @@ -70,3 +73,23 @@ type Options struct { // appropriate signature and i is the interface{} scheduled for // deletion, Cache calls go f(i) type RemovedFunc func(interface{}) + +// Iterator represents the interface for cache iterators +type Iterator interface { + // Close closes the iterator + // and releases any allocated resources + Close() + // Entries returns a channel of MapEntry + // objects that can be used in a range loop + Entries() <-chan Entry +} + +// Entry represents a key-value entry within the map +type Entry interface { + // Key represents the key + Key() interface{} + // Value represents the value + Value() interface{} + // Timestamp represents the time when the value is updated + Timestamp() time.Time +} diff --git a/common/cache/lru.go b/common/cache/lru.go index a6107dbdf12..d40e7603699 100644 --- a/common/cache/lru.go +++ b/common/cache/lru.go @@ -33,14 +33,90 @@ var ( ) // lru is a concurrent fixed size cache that evicts elements in lru order -type lru struct { - mut sync.Mutex - byAccess *list.List - byKey map[interface{}]*list.Element - maxSize int - ttl time.Duration - pin bool - rmFunc RemovedFunc +type ( + lru struct { + mut sync.Mutex + byAccess *list.List + byKey map[interface{}]*list.Element + maxSize int + ttl time.Duration + pin bool + rmFunc RemovedFunc + } + + iteratorImpl struct { + stopCh chan struct{} + dataCh chan Entry + } + + entryImpl struct { + key interface{} + timestamp time.Time + value interface{} + refCount int + } +) + +// Close closes the iterator +func (it *iteratorImpl) Close() { + close(it.stopCh) +} + +// Entries returns a channel of map entries +func (it *iteratorImpl) Entries() <-chan Entry { + return it.dataCh +} + +// Iterator returns an iterator to the map. This map +// does not use re-entrant locks, so access or modification +// to the map during iteration can cause a dead lock. +func (c *lru) Iterator() Iterator { + + iterator := &iteratorImpl{ + dataCh: make(chan Entry, 8), + stopCh: make(chan struct{}), + } + + go func(iterator *iteratorImpl) { + c.mut.Lock() + for _, element := range c.byKey { + entry := element.Value.(*entryImpl) + if c.isEntryExpired(entry) { + // Entry has expired + c.deleteInternal(element) + continue + } + // make a copy of the entry so there will be no concurrent access to this entry + entry = &entryImpl{ + key: entry.key, + value: entry.value, + timestamp: entry.timestamp, + } + select { + case iterator.dataCh <- entry: + case <-iterator.stopCh: + c.mut.Unlock() + close(iterator.dataCh) + return + } + } + c.mut.Unlock() + close(iterator.dataCh) + }(iterator) + + return iterator +} + +func (entry *entryImpl) Key() interface{} { + return entry.key +} + +func (entry *entryImpl) Value() interface{} { + return entry.value +} + +func (entry *entryImpl) Timestamp() time.Time { + return entry.timestamp } // New creates a new cache with the given options @@ -78,29 +154,25 @@ func (c *lru) Get(key interface{}) interface{} { c.mut.Lock() defer c.mut.Unlock() - elt := c.byKey[key] - if elt == nil { + element := c.byKey[key] + if element == nil { return nil } - cacheEntry := elt.Value.(*cacheEntry) + entry := element.Value.(*entryImpl) if c.pin { - cacheEntry.refCount++ + entry.refCount++ } - if cacheEntry.refCount == 0 && !cacheEntry.expiration.IsZero() && time.Now().After(cacheEntry.expiration) { + if c.isEntryExpired(entry) { // Entry has expired - if c.rmFunc != nil { - go c.rmFunc(cacheEntry.value) - } - c.byAccess.Remove(elt) - delete(c.byKey, cacheEntry.key) + c.deleteInternal(element) return nil } - c.byAccess.MoveToFront(elt) - return cacheEntry.value + c.byAccess.MoveToFront(element) + return entry.value } // Put puts a new value associated with a given key, returning the existing value (if present) @@ -132,13 +204,9 @@ func (c *lru) Delete(key interface{}) { c.mut.Lock() defer c.mut.Unlock() - elt := c.byKey[key] - if elt != nil { - entry := c.byAccess.Remove(elt).(*cacheEntry) - if c.rmFunc != nil { - go c.rmFunc(entry.value) - } - delete(c.byKey, key) + element := c.byKey[key] + if element != nil { + c.deleteInternal(element) } } @@ -148,8 +216,8 @@ func (c *lru) Release(key interface{}) { defer c.mut.Unlock() elt := c.byKey[key] - cacheEntry := elt.Value.(*cacheEntry) - cacheEntry.refCount-- + entry := elt.Value.(*entryImpl) + entry.refCount-- } // Size returns the number of entries currently in the lru, useful if cache is not full @@ -168,13 +236,13 @@ func (c *lru) putInternal(key interface{}, value interface{}, allowUpdate bool) elt := c.byKey[key] if elt != nil { - entry := elt.Value.(*cacheEntry) + entry := elt.Value.(*entryImpl) existing := entry.value if allowUpdate { entry.value = value } if c.ttl != 0 { - entry.expiration = time.Now().Add(c.ttl) + entry.timestamp = time.Now() } c.byAccess.MoveToFront(elt) if c.pin { @@ -183,7 +251,7 @@ func (c *lru) putInternal(key interface{}, value interface{}, allowUpdate bool) return existing, nil } - entry := &cacheEntry{ + entry := &entryImpl{ key: key, value: value, } @@ -193,34 +261,34 @@ func (c *lru) putInternal(key interface{}, value interface{}, allowUpdate bool) } if c.ttl != 0 { - entry.expiration = time.Now().Add(c.ttl) + entry.timestamp = time.Now() } c.byKey[key] = c.byAccess.PushFront(entry) if len(c.byKey) == c.maxSize { - oldest := c.byAccess.Back().Value.(*cacheEntry) + oldest := c.byAccess.Back().Value.(*entryImpl) if oldest.refCount > 0 { // Cache is full with pinned elements // revert the insert and return - c.byAccess.Remove(c.byAccess.Front()) - delete(c.byKey, key) + c.deleteInternal(c.byAccess.Front()) return nil, ErrCacheFull } - c.byAccess.Remove(c.byAccess.Back()) - if c.rmFunc != nil { - go c.rmFunc(oldest.value) - } - delete(c.byKey, oldest.key) + c.deleteInternal(c.byAccess.Back()) } return nil, nil } -type cacheEntry struct { - key interface{} - expiration time.Time - value interface{} - refCount int +func (c *lru) deleteInternal(element *list.Element) { + entry := c.byAccess.Remove(element).(*entryImpl) + if c.rmFunc != nil { + go c.rmFunc(entry.value) + } + delete(c.byKey, entry.key) +} + +func (c *lru) isEntryExpired(entry *entryImpl) bool { + return entry.refCount == 0 && !entry.timestamp.IsZero() && time.Now().After(entry.timestamp.Add(c.ttl)) } diff --git a/common/cache/lru_test.go b/common/cache/lru_test.go index 328f6887287..b7e898120d9 100644 --- a/common/cache/lru_test.go +++ b/common/cache/lru_test.go @@ -116,8 +116,9 @@ func TestLRUCacheConcurrentAccess(t *testing.T) { start := make(chan struct{}) var wg sync.WaitGroup for i := 0; i < 20; i++ { - wg.Add(1) + wg.Add(2) + // concurrent get and put go func() { defer wg.Done() @@ -125,6 +126,23 @@ func TestLRUCacheConcurrentAccess(t *testing.T) { for j := 0; j < 1000; j++ { cache.Get("A") + cache.Put("A", "fooo") + } + }() + + // confurrent iteration + go func() { + defer wg.Done() + + <-start + + for j := 0; j < 50; j++ { + result := []Entry{} + it := cache.Iterator() + defer it.Close() + for entry := range it.Entries() { + result = append(result, entry) + } } }() } @@ -180,3 +198,28 @@ func TestRemovedFuncWithTTL(t *testing.T) { t.Error("RemovedFunc did not send true on channel ch") } } + +func TestIterator(t *testing.T) { + expected := map[string]string{ + "A": "Alpha", + "B": "Beta", + "G": "Gamma", + "D": "Delta", + } + + cache := NewLRU(5) + + for k, v := range expected { + cache.Put(k, v) + } + + actual := map[string]string{} + + ite := cache.Iterator() + defer ite.Close() + for entry := range ite.Entries() { + actual[entry.Key().(string)] = entry.Value().(string) + } + + assert.Equal(t, expected, actual) +} diff --git a/common/convert.go b/common/convert.go index 90dda0331ce..4346ba596e8 100644 --- a/common/convert.go +++ b/common/convert.go @@ -20,7 +20,11 @@ package common -import s "github.com/uber/cadence/.gen/go/shared" +import ( + "time" + + s "github.com/uber/cadence/.gen/go/shared" +) // IntPtr makes a copy and returns the pointer to an int. func IntPtr(v int) *int { @@ -57,6 +61,12 @@ func BoolPtr(v bool) *bool { return &v } +// TimePtr makes a copy and returns the pointer to a string for time.Time, as ISO 8601 format. +func TimePtr(v time.Time) *string { + time := v.UTC().Format(time.RFC3339) + return &time +} + // StringPtr makes a copy and returns the pointer to a string. func StringPtr(v string) *string { return &v diff --git a/common/metrics/defs.go b/common/metrics/defs.go index f44c5686056..f40d9dec154 100644 --- a/common/metrics/defs.go +++ b/common/metrics/defs.go @@ -207,6 +207,8 @@ const ( MatchingClientRespondQueryTaskCompletedScope // MatchingClientCancelOutstandingPollScope tracks RPC calls to matching service MatchingClientCancelOutstandingPollScope + // MatchingClientGetPollerHistoryScope tracks RPC calls to matching service + MatchingClientGetPollerHistoryScope NumCommonScopes ) @@ -263,6 +265,8 @@ const ( FrontendQueryWorkflowScope // FrontendDescribeWorkflowExecutionScope is the metric scope for frontend.DescribeWorkflowExecution FrontendDescribeWorkflowExecutionScope + // FrontendGetPollerHistoryScope is the metric scope for frontend.GetPollerHistory + FrontendGetPollerHistoryScope NumFrontendScopes ) @@ -351,6 +355,8 @@ const ( MatchingRespondQueryTaskCompletedScope // MatchingCancelOutstandingPollScope tracks CancelOutstandingPoll API calls received by service MatchingCancelOutstandingPollScope + // MatchingGetPollerHistoryScope tracks GetPollerHistory API calls received by service + MatchingGetPollerHistoryScope NumMatchingScopes ) @@ -408,6 +414,7 @@ var ScopeDefs = map[ServiceIdx]map[int]scopeDefinition{ MatchingClientQueryWorkflowScope: {operation: "MatchingClientQueryWorkflow"}, MatchingClientRespondQueryTaskCompletedScope: {operation: "MatchingClientRespondQueryTaskCompleted"}, MatchingClientCancelOutstandingPollScope: {operation: "MatchingClientCancelOutstandingPoll"}, + MatchingClientGetPollerHistoryScope: {operation: "MatchingClientGetPollerHistory"}, }, // Frontend Scope Names Frontend: { @@ -436,6 +443,7 @@ var ScopeDefs = map[ServiceIdx]map[int]scopeDefinition{ FrontendDeprecateDomainScope: {operation: "DeprecateDomain"}, FrontendQueryWorkflowScope: {operation: "QueryWorkflow"}, FrontendDescribeWorkflowExecutionScope: {operation: "DescribeWorkflowExecution"}, + FrontendGetPollerHistoryScope: {operation: "GetPollerHistory"}, }, // History Scope Names History: { @@ -480,6 +488,7 @@ var ScopeDefs = map[ServiceIdx]map[int]scopeDefinition{ MatchingQueryWorkflowScope: {operation: "QueryWorkflow"}, MatchingRespondQueryTaskCompletedScope: {operation: "RespondQueryTaskCompleted"}, MatchingCancelOutstandingPollScope: {operation: "CancelOutstandingPoll"}, + MatchingGetPollerHistoryScope: {operation: "GetPollerHistory"}, }, } diff --git a/common/mocks/MatchingClient.go b/common/mocks/MatchingClient.go index 95a3277f198..b40f33b2d1e 100644 --- a/common/mocks/MatchingClient.go +++ b/common/mocks/MatchingClient.go @@ -164,3 +164,27 @@ func (_m *MatchingClient) CancelOutstandingPoll(ctx context.Context, return r0 } + +// GetPollerHistory provides a mock function with given fields: ctx, request +func (_m *MatchingClient) GetPollerHistory(ctx context.Context, + request *matching.GetPollerHistoryRequest, opts ...yarpc.CallOption) (*shared.GetPollerHistoryResponse, error) { + ret := _m.Called(ctx, request) + + var r0 *shared.GetPollerHistoryResponse + if rf, ok := ret.Get(0).(func(context.Context, *matching.GetPollerHistoryRequest) *shared.GetPollerHistoryResponse); ok { + r0 = rf(ctx, request) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*shared.GetPollerHistoryResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *matching.GetPollerHistoryRequest) error); ok { + r1 = rf(ctx, request) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} diff --git a/host/integration_test.go b/host/integration_test.go index ee4ce1c8554..a7391295945 100644 --- a/host/integration_test.go +++ b/host/integration_test.go @@ -3621,6 +3621,129 @@ func (s *integrationSuite) TestGetWorkflowExecutionHistoryLongPoll() { s.Equal(11, len(allEvents)) } +func (s *integrationSuite) TestGetPollerHistory() { + workflowID := "interation-get-poller-history" + identity := "worker1" + activityName := "activity_type1" + + workflowType := &workflow.WorkflowType{} + workflowType.Name = common.StringPtr("interation-get-poller-history-type") + + taskList := &workflow.TaskList{} + taskList.Name = common.StringPtr("interation-get-poller-history-tasklist") + + // Start workflow execution + request := &workflow.StartWorkflowExecutionRequest{ + RequestId: common.StringPtr(uuid.New()), + Domain: common.StringPtr(s.domainName), + WorkflowId: common.StringPtr(workflowID), + WorkflowType: workflowType, + TaskList: taskList, + Input: nil, + ExecutionStartToCloseTimeoutSeconds: common.Int32Ptr(100), + TaskStartToCloseTimeoutSeconds: common.Int32Ptr(1), + Identity: common.StringPtr(identity), + } + + we, err0 := s.engine.StartWorkflowExecution(createContext(), request) + s.Nil(err0) + + s.logger.Infof("StartWorkflowExecution: response: %v \n", *we.RunId) + + // decider logic + workflowComplete := false + activityScheduled := false + activityData := int32(1) + // var signalEvent *workflow.HistoryEvent + dtHandler := func(execution *workflow.WorkflowExecution, wt *workflow.WorkflowType, + previousStartedEventID, startedEventID int64, history *workflow.History) ([]byte, []*workflow.Decision, error) { + + if !activityScheduled { + activityScheduled = true + buf := new(bytes.Buffer) + s.Nil(binary.Write(buf, binary.LittleEndian, activityData)) + + return nil, []*workflow.Decision{{ + DecisionType: common.DecisionTypePtr(workflow.DecisionTypeScheduleActivityTask), + ScheduleActivityTaskDecisionAttributes: &workflow.ScheduleActivityTaskDecisionAttributes{ + ActivityId: common.StringPtr(strconv.Itoa(int(1))), + ActivityType: &workflow.ActivityType{Name: common.StringPtr(activityName)}, + TaskList: taskList, + Input: buf.Bytes(), + ScheduleToCloseTimeoutSeconds: common.Int32Ptr(100), + ScheduleToStartTimeoutSeconds: common.Int32Ptr(25), + StartToCloseTimeoutSeconds: common.Int32Ptr(50), + HeartbeatTimeoutSeconds: common.Int32Ptr(25), + }, + }}, nil + } + + workflowComplete = true + return nil, []*workflow.Decision{{ + DecisionType: common.DecisionTypePtr(workflow.DecisionTypeCompleteWorkflowExecution), + CompleteWorkflowExecutionDecisionAttributes: &workflow.CompleteWorkflowExecutionDecisionAttributes{ + Result: []byte("Done."), + }, + }}, nil + } + + // activity handler + atHandler := func(execution *workflow.WorkflowExecution, activityType *workflow.ActivityType, + activityID string, input []byte, taskToken []byte) ([]byte, bool, error) { + + return []byte("Activity Result."), false, nil + } + + poller := &taskPoller{ + engine: s.engine, + domain: s.domainName, + taskList: taskList, + identity: identity, + decisionHandler: dtHandler, + activityHandler: atHandler, + logger: s.logger, + suite: s, + } + + // this function poll events from history side + testGetPollerHistory := func(domain string, tasklist *workflow.TaskList, tasklistType workflow.TaskListType) []*workflow.PollerInfo { + responseInner, errInner := s.engine.GetPollerHistory(createContext(), &workflow.GetPollerHistoryRequest{ + Domain: common.StringPtr(domain), + TaskList: taskList, + TaskListType: &tasklistType, + }) + + s.Nil(errInner) + return responseInner.Pollers + } + + // when no one polling on the tasklist (activity or decition), there shall be no poller information + pollerInfos := testGetPollerHistory(s.domainName, taskList, workflow.TaskListTypeActivity) + s.Empty(pollerInfos) + pollerInfos = testGetPollerHistory(s.domainName, taskList, workflow.TaskListTypeDecision) + s.Empty(pollerInfos) + + _, errDecision := poller.pollAndProcessDecisionTask(false, false) + s.Nil(errDecision) + pollerInfos = testGetPollerHistory(s.domainName, taskList, workflow.TaskListTypeActivity) + s.Empty(pollerInfos) + pollerInfos = testGetPollerHistory(s.domainName, taskList, workflow.TaskListTypeDecision) + s.Equal(1, len(pollerInfos)) + s.Equal(identity, pollerInfos[0].GetIdentity()) + s.NotEmpty(pollerInfos[0].GetTimestamp()) + + errActivity := poller.pollAndProcessActivityTask(false) + s.Nil(errActivity) + pollerInfos = testGetPollerHistory(s.domainName, taskList, workflow.TaskListTypeActivity) + s.Equal(1, len(pollerInfos)) + s.Equal(identity, pollerInfos[0].GetIdentity()) + s.NotEmpty(pollerInfos[0].GetTimestamp()) + pollerInfos = testGetPollerHistory(s.domainName, taskList, workflow.TaskListTypeDecision) + s.Equal(1, len(pollerInfos)) + s.Equal(identity, pollerInfos[0].GetIdentity()) + s.NotEmpty(pollerInfos[0].GetTimestamp()) +} + func (s *integrationSuite) setupShards() { // shard 0 is always created, we create additional shards if needed for shardID := 1; shardID < testNumberOfHistoryShards; shardID++ { diff --git a/idl/github.com/uber/cadence/cadence.thrift b/idl/github.com/uber/cadence/cadence.thrift index ee3362ea2cd..466a822abef 100644 --- a/idl/github.com/uber/cadence/cadence.thrift +++ b/idl/github.com/uber/cadence/cadence.thrift @@ -351,4 +351,14 @@ service WorkflowService { 3: shared.EntityNotExistsError entityNotExistError, ) + /** + * GetPollerHistory returns pollers which poll from given tasklist in last few minutes. + **/ + shared.GetPollerHistoryResponse GetPollerHistory(1: shared.GetPollerHistoryRequest request) + throws ( + 1: shared.BadRequestError badRequestError, + 2: shared.InternalServiceError internalServiceError, + 3: shared.EntityNotExistsError entityNotExistError, + ) + } diff --git a/idl/github.com/uber/cadence/matching.thrift b/idl/github.com/uber/cadence/matching.thrift index ad1e829e234..c557befd9d6 100644 --- a/idl/github.com/uber/cadence/matching.thrift +++ b/idl/github.com/uber/cadence/matching.thrift @@ -85,6 +85,11 @@ struct CancelOutstandingPollRequest { 40: optional string pollerID } +struct GetPollerHistoryRequest { + 10: optional string domainUUID + 20: optional shared.GetPollerHistoryRequest getRequest +} + /** * MatchingService API is exposed to provide support for polling from long running applications. * Such applications are expected to have a worker which regularly polls for DecisionTask and ActivityTask. For each @@ -139,22 +144,22 @@ service MatchingService { * QueryWorkflow is called by frontend to query a workflow. **/ shared.QueryWorkflowResponse QueryWorkflow(1: QueryWorkflowRequest queryRequest) - throws ( - 1: shared.BadRequestError badRequestError, - 2: shared.InternalServiceError internalServiceError, - 3: shared.EntityNotExistsError entityNotExistError, - 4: shared.QueryFailedError queryFailedError, - ) + throws ( + 1: shared.BadRequestError badRequestError, + 2: shared.InternalServiceError internalServiceError, + 3: shared.EntityNotExistsError entityNotExistError, + 4: shared.QueryFailedError queryFailedError, + ) /** * RespondQueryTaskCompleted is called by frontend to respond query completed. **/ void RespondQueryTaskCompleted(1: RespondQueryTaskCompletedRequest request) - throws ( - 1: shared.BadRequestError badRequestError, - 2: shared.InternalServiceError internalServiceError, - 3: shared.EntityNotExistsError entityNotExistError, - ) + throws ( + 1: shared.BadRequestError badRequestError, + 2: shared.InternalServiceError internalServiceError, + 3: shared.EntityNotExistsError entityNotExistError, + ) /** * CancelOutstandingPoll is called by frontend to unblock long polls on matching for zombie pollers. @@ -171,4 +176,13 @@ service MatchingService { 2: shared.InternalServiceError internalServiceError, ) + /** + * GetPollerHistory returns pollers which poll from given tasklist in last few minutes. + **/ + shared.GetPollerHistoryResponse GetPollerHistory(1: GetPollerHistoryRequest request) + throws ( + 1: shared.BadRequestError badRequestError, + 2: shared.InternalServiceError internalServiceError, + 3: shared.EntityNotExistsError entityNotExistError, + ) } diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index 9784dd219cb..d05c99cd8c6 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -930,3 +930,30 @@ struct DescribeWorkflowExecutionResponse { 10: optional WorkflowExecutionConfiguration executionConfiguration 20: optional WorkflowExecutionInfo workflowExecutionInfo } + +struct GetPollerHistoryRequest { + 10: optional string domain + 20: optional TaskList taskList + 30: optional TaskListType taskListType +} + +struct GetPollerHistoryResponse { + 10: optional list pollers +} + +enum TaskListType { + /* + * Decision type of tasklist + */ + Decision, + /* + * Activity type of tasklist + */ + Activity, +} + +struct PollerInfo { + // ISO 8601 format + 10: optional string timestamp + 20: optional string identity +} diff --git a/service/frontend/handler.go b/service/frontend/handler.go index e7a8223780d..4ff45b979f6 100644 --- a/service/frontend/handler.go +++ b/service/frontend/handler.go @@ -81,6 +81,7 @@ var ( errInvalidTaskToken = &gen.BadRequestError{Message: "Invalid TaskToken."} errInvalidRequestType = &gen.BadRequestError{Message: "Invalid request type."} errTaskListNotSet = &gen.BadRequestError{Message: "TaskList is not set on request."} + errTaskListTypeNotSet = &gen.BadRequestError{Message: "TaskListType is not set on request."} errExecutionNotSet = &gen.BadRequestError{Message: "Execution is not set on request."} errWorkflowIDNotSet = &gen.BadRequestError{Message: "WorkflowId is not set on request."} errRunIDNotSet = &gen.BadRequestError{Message: "RunId is not set on request."} @@ -1422,6 +1423,45 @@ func (wh *WorkflowHandler) DescribeWorkflowExecution(ctx context.Context, reques return response, nil } +// GetPollerHistory get poller information for given tasklist +func (wh *WorkflowHandler) GetPollerHistory(ctx context.Context, request *gen.GetPollerHistoryRequest) (*gen.GetPollerHistoryResponse, error) { + + scope := metrics.FrontendGetPollerHistoryScope + sw := wh.startRequestProfile(scope) + defer sw.Stop() + + if ok, _ := wh.rateLimiter.TryConsume(1); !ok { + return nil, wh.error(createServiceBusyError(), scope) + } + + if request.Domain == nil { + return nil, wh.error(errDomainNotSet, scope) + } + domainInfo, _, err := wh.domainCache.GetDomain(request.GetDomain()) + if err != nil { + return nil, wh.error(err, scope) + } + + if err := wh.validateTaskList(request.TaskList, scope); err != nil { + return nil, err + } + + if err := wh.validateTaskListType(request.TaskListType, scope); err != nil { + return nil, err + } + + response, err := wh.matching.GetPollerHistory(ctx, &m.GetPollerHistoryRequest{ + DomainUUID: common.StringPtr(domainInfo.ID), + GetRequest: request, + }) + + if err != nil { + return nil, wh.error(err, scope) + } + + return response, nil +} + func (wh *WorkflowHandler) getHistory(domainID string, execution gen.WorkflowExecution, firstEventID, nextEventID int64, pageSize int32, nextPageToken []byte, transientDecision *gen.TransientDecisionInfo) (*gen.History, []byte, error) { @@ -1527,6 +1567,13 @@ func (wh *WorkflowHandler) error(err error, scope int) error { } } +func (wh *WorkflowHandler) validateTaskListType(t *gen.TaskListType, scope int) error { + if t == nil { + return wh.error(errTaskListTypeNotSet, scope) + } + return nil +} + func (wh *WorkflowHandler) validateTaskList(t *gen.TaskList, scope int) error { if t == nil || t.Name == nil || *t.Name == "" { return wh.error(errTaskListNotSet, scope) diff --git a/service/matching/handler.go b/service/matching/handler.go index d346fa229ba..3c2a996882a 100644 --- a/service/matching/handler.go +++ b/service/matching/handler.go @@ -169,6 +169,16 @@ func (h *Handler) CancelOutstandingPoll(ctx context.Context, return h.handleErr(err, scope) } +// GetPollerHistory get poller information for given tasklist +func (h *Handler) GetPollerHistory(ctx context.Context, request *m.GetPollerHistoryRequest) (*gen.GetPollerHistoryResponse, error) { + scope := metrics.MatchingGetPollerHistoryScope + sw := h.startRequestProfile("GetPollerHistory", scope) + defer sw.Stop() + + response, err := h.engine.GetPollerHistory(ctx, request) + return response, h.handleErr(err, scope) +} + func (h *Handler) handleErr(err error, scope int) error { if err == nil { diff --git a/service/matching/matchingEngine.go b/service/matching/matchingEngine.go index 1ca93c8d859..5cf8f4a75ef 100644 --- a/service/matching/matchingEngine.go +++ b/service/matching/matchingEngine.go @@ -65,6 +65,7 @@ type taskListID struct { } type pollerIDCtxKey string +type identityCtxKey string var ( // EmptyPollForDecisionTaskResponse is the response when there are no decision tasks to hand out @@ -79,6 +80,7 @@ var ( errPumpClosed = errors.New("Task list pump closed its channel") pollerIDKey pollerIDCtxKey = "pollerID" + identityKey identityCtxKey = "identity" ) func (t *taskListID) String() string { @@ -246,6 +248,7 @@ pollLoop: // Add frontend generated pollerID to context so tasklistMgr can support cancellation of // long-poll when frontend calls CancelOutstandingPoll API pollerCtx := context.WithValue(ctx, pollerIDKey, pollerID) + pollerCtx = context.WithValue(pollerCtx, identityKey, request.GetIdentity()) taskList := newTaskListID(domainID, taskListName, persistence.TaskListTypeDecision) tCtx, err := e.getTask(pollerCtx, taskList) if err != nil { @@ -344,6 +347,7 @@ pollLoop: // Add frontend generated pollerID to context so tasklistMgr can support cancellation of // long-poll when frontend calls CancelOutstandingPoll API pollerCtx := context.WithValue(ctx, pollerIDKey, pollerID) + pollerCtx = context.WithValue(pollerCtx, identityKey, request.GetIdentity()) tCtx, err := e.getTask(pollerCtx, taskList) if err != nil { // TODO: Is empty poll the best reply for errPumpClosed? @@ -449,6 +453,30 @@ func (e *matchingEngineImpl) CancelOutstandingPoll(ctx context.Context, request return nil } +func (e *matchingEngineImpl) GetPollerHistory(ctx context.Context, request *m.GetPollerHistoryRequest) (*workflow.GetPollerHistoryResponse, error) { + domainID := request.GetDomainUUID() + taskListType := persistence.TaskListTypeDecision + if request.GetRequest.GetTaskListType() == workflow.TaskListTypeActivity { + taskListType = persistence.TaskListTypeActivity + } + taskListName := request.GetRequest.TaskList.GetName() + + taskList := newTaskListID(domainID, taskListName, taskListType) + tlMgr, err := e.getTaskListManager(taskList) + if err != nil { + return nil, err + } + + pollers := []*workflow.PollerInfo{} + for _, poller := range tlMgr.GetAllPollerInfo() { + pollers = append(pollers, &workflow.PollerInfo{ + Identity: common.StringPtr(poller.identity), + Timestamp: common.TimePtr(poller.timestamp), + }) + } + return &workflow.GetPollerHistoryResponse{Pollers: pollers}, nil +} + // Loads a task from persistence and wraps it in a task context func (e *matchingEngineImpl) getTask(ctx context.Context, taskList *taskListID) (*taskContext, error) { tlMgr, err := e.getTaskListManager(taskList) diff --git a/service/matching/matchingEngineInterfaces.go b/service/matching/matchingEngineInterfaces.go index a011a7f512e..7844682e55e 100644 --- a/service/matching/matchingEngineInterfaces.go +++ b/service/matching/matchingEngineInterfaces.go @@ -38,5 +38,6 @@ type ( QueryWorkflow(ctx context.Context, request *m.QueryWorkflowRequest) (*workflow.QueryWorkflowResponse, error) RespondQueryTaskCompleted(ctx context.Context, request *m.RespondQueryTaskCompletedRequest) error CancelOutstandingPoll(ctx context.Context, request *m.CancelOutstandingPollRequest) error + GetPollerHistory(ctx context.Context, request *m.GetPollerHistoryRequest) (*workflow.GetPollerHistoryResponse, error) } ) diff --git a/service/matching/matchingEngine_test.go b/service/matching/matchingEngine_test.go index 8f047024ac2..301908e182d 100644 --- a/service/matching/matchingEngine_test.go +++ b/service/matching/matchingEngine_test.go @@ -193,19 +193,23 @@ func (s *matchingEngineSuite) PollForTasksEmptyResultTest(taskType int) { taskList := &workflow.TaskList{} taskList.Name = &tl + tasklistType := workflow.TaskListTypeDecision tlID := newTaskListID(domainID, tl, taskType) //const rangeID = 123 const pollCount = 10 for i := 0; i < pollCount; i++ { if taskType == persistence.TaskListTypeActivity { - resp, err := s.matchingEngine.PollForActivityTask(s.callContext, &matching.PollForActivityTaskRequest{ + pollResp, err := s.matchingEngine.PollForActivityTask(s.callContext, &matching.PollForActivityTaskRequest{ DomainUUID: common.StringPtr(domainID), PollRequest: &workflow.PollForActivityTaskRequest{ TaskList: taskList, - Identity: &identity}, + Identity: &identity, + }, }) s.NoError(err) - s.Equal(emptyPollForActivityTaskResponse, resp) + s.Equal(emptyPollForActivityTaskResponse, pollResp) + + tasklistType = workflow.TaskListTypeActivity } else { resp, err := s.matchingEngine.PollForDecisionTask(s.callContext, &matching.PollForDecisionTaskRequest{ DomainUUID: common.StringPtr(domainID), @@ -215,7 +219,21 @@ func (s *matchingEngineSuite) PollForTasksEmptyResultTest(taskType int) { }) s.NoError(err) s.Equal(emptyPollForDecisionTaskResponse, resp) + + tasklistType = workflow.TaskListTypeDecision } + // check the poller information + getResp, err := s.matchingEngine.GetPollerHistory(s.callContext, &matching.GetPollerHistoryRequest{ + DomainUUID: common.StringPtr(domainID), + GetRequest: &workflow.GetPollerHistoryRequest{ + TaskList: taskList, + TaskListType: &tasklistType, + }, + }) + s.NoError(err) + s.Equal(1, len(getResp.Pollers)) + s.Equal(identity, getResp.Pollers[0].GetIdentity()) + s.NotEmpty(getResp.Pollers[0].GetTimestamp()) } s.EqualValues(1, s.taskManager.taskLists[*tlID].rangeID) } diff --git a/service/matching/pollerHistory.go b/service/matching/pollerHistory.go new file mode 100644 index 00000000000..910558087e2 --- /dev/null +++ b/service/matching/pollerHistory.go @@ -0,0 +1,85 @@ +// 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 matching + +import ( + "time" + + "github.com/uber/cadence/common/cache" +) + +const ( + pollerHistoryInitSize = 0 + pollerHistoryInitMaxSize = 1000 + pollerHistoryTTL = 5 * time.Minute +) + +type ( + pollerIdentity struct { + identity string + // TODO add IP, T1396795 + } + + pollerInfo struct { + identity string + // TODO add IP, T1396795 + timestamp time.Time + } +) + +type pollerHistory struct { + // // poller ID -> last access time + // pollers map[pollerID]time.Time + history cache.Cache +} + +func newPollerHistory() *pollerHistory { + opts := &cache.Options{} + opts.InitialCapacity = pollerHistoryInitSize + opts.TTL = pollerHistoryTTL + opts.Pin = false + + return &pollerHistory{ + history: cache.New(pollerHistoryInitMaxSize, opts), + } +} + +func (pollers *pollerHistory) updatePollerInfo(id pollerIdentity) { + pollers.history.Put(id, nil) +} + +func (pollers *pollerHistory) getAllPollerInfo() []*pollerInfo { + result := []*pollerInfo{} + + ite := pollers.history.Iterator() + defer ite.Close() + for entry := range ite.Entries() { + key := entry.Key().(pollerIdentity) + timestamp := entry.Timestamp() + result = append(result, &pollerInfo{ + identity: key.identity, + // TODO add IP, T1396795 + timestamp: timestamp, + }) + } + + return result +} diff --git a/service/matching/taskListManager.go b/service/matching/taskListManager.go index b7082a882b9..379c0c877df 100644 --- a/service/matching/taskListManager.go +++ b/service/matching/taskListManager.go @@ -49,6 +49,7 @@ type taskListManager interface { GetTaskContext(ctx context.Context) (*taskContext, error) SyncMatchQueryTask(ctx context.Context, queryTask *queryTaskInfo) error CancelPoller(pollerID string) + GetAllPollerInfo() []*pollerInfo String() string } @@ -70,6 +71,7 @@ func newTaskListManager(e *matchingEngineImpl, taskList *taskListID, config *Con taskAckManager: newAckManager(e.logger), syncMatch: make(chan *getTaskResult), config: config, + pollerHistory: newPollerHistory(), outstandingPollsMap: make(map[string]context.CancelFunc), } tlMgr.taskWriter = newTaskWriter(tlMgr) @@ -99,6 +101,10 @@ type taskListManagerImpl struct { metricsClient metrics.Client engine *matchingEngineImpl config *Config + + // pollerHistory stores poller which poll from this tasklist in last few minutes + pollerHistory *pollerHistory + // serializes all writes to persistence // This is needed because of a known Cassandra issue where concurrent LWT to the same partition // cause timeout errors. @@ -323,6 +329,13 @@ func (c *taskListManagerImpl) getTask(ctx context.Context) (*getTaskResult, erro }() } + identity, ok := ctx.Value(identityKey).(string) + if ok && identity != "" { + c.pollerHistory.updatePollerInfo(pollerIdentity{ + identity: identity, + }) + } + select { case task, ok := <-c.taskBuffer: if !ok { // Task list getTasks pump is shutdown @@ -464,6 +477,16 @@ func (c *taskListManagerImpl) String() string { return r } +// updatePollerInfo update the poller information for this tasklist +func (c *taskListManagerImpl) updatePollerInfo(id pollerIdentity) { + c.pollerHistory.updatePollerInfo(id) +} + +// getAllPollerInfo return poller which poll from this tasklist in last few minutes +func (c *taskListManagerImpl) GetAllPollerInfo() []*pollerInfo { + return c.pollerHistory.getAllPollerInfo() +} + // Tries to match task to a poller that is already waiting on getTask. // When this method returns non nil response without error it is guaranteed that the task is started // and sent to a poller. So it not necessary to persist it. From 86d437a1018a1ca80ba49adc92c680e1217e27ad Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Fri, 5 Jan 2018 10:50:54 -0800 Subject: [PATCH 3/8] rename GetPollerHistory to DescribeTaskList --- .gen/go/cadence/idl.go | 4 +- ...go => workflowservice_describetasklist.go} | 164 +- .../cadence/workflowserviceclient/client.go | 36 +- .../cadence/workflowserviceserver/server.go | 38 +- .gen/go/cadence/workflowservicetest/client.go | 52 +- .gen/go/matching/idl.go | 4 +- ...go => matchingservice_describetasklist.go} | 164 +- .../matching/matchingserviceclient/client.go | 18 +- .../matching/matchingserviceserver/server.go | 20 +- .../go/matching/matchingservicetest/client.go | 20 +- .gen/go/matching/types.go | 48 +- .gen/go/shared/idl.go | 4 +- .gen/go/shared/types.go | 2470 ++++++++--------- client/matching/client.go | 20 +- client/matching/metricClient.go | 14 +- common/convert.go | 4 +- common/metrics/defs.go | 18 +- common/mocks/MatchingClient.go | 14 +- host/integration_test.go | 23 +- idl/github.com/uber/cadence/cadence.thrift | 5 +- idl/github.com/uber/cadence/matching.thrift | 9 +- idl/github.com/uber/cadence/shared.thrift | 8 +- service/frontend/handler.go | 13 +- service/matching/handler.go | 11 +- service/matching/matchingEngine.go | 8 +- service/matching/matchingEngineInterfaces.go | 2 +- service/matching/matchingEngine_test.go | 10 +- 27 files changed, 1605 insertions(+), 1596 deletions(-) rename .gen/go/cadence/{workflowservice_getpollerhistory.go => workflowservice_describetasklist.go} (66%) rename .gen/go/matching/{matchingservice_getpollerhistory.go => matchingservice_describetasklist.go} (67%) diff --git a/.gen/go/cadence/idl.go b/.gen/go/cadence/idl.go index ed899bf2526..1fcfa11c3ae 100644 --- a/.gen/go/cadence/idl.go +++ b/.gen/go/cadence/idl.go @@ -33,11 +33,11 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "cadence", Package: "github.com/uber/cadence/.gen/go/cadence", FilePath: "cadence.thrift", - SHA1: "f5cf46872436104150b2c697241f4b3abfd9405d", + SHA1: "dcfa696d300ae99e35d4c50f149b11dfd0c98fbd", Includes: []*thriftreflect.ThriftModule{ shared.ThriftModule, }, 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\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence\n\n/**\n* WorkflowService API is exposed to provide support for long running applications. Application is expected to call\n* StartWorkflowExecution to create an instance for each instance of long running workflow. Such applications are expected\n* to have a worker which regularly polls for DecisionTask and ActivityTask from the WorkflowService. For each\n* DecisionTask, application is expected to process the history of events for that session and respond back with next\n* decisions. For each ActivityTask, application is expected to execute the actual logic for that task and respond back\n* with completion or failure. Worker is expected to regularly heartbeat while activity task is running.\n**/\nservice WorkflowService {\n /**\n * RegisterDomain creates a new domain which can be used as a container for all resources. Domain is a top level\n * entity within Cadence, used as a container for all resources like workflow executions, tasklists, etc. Domain\n * acts as a sandbox and provides isolation for all resources within the domain. All resources belongs to exactly one\n * domain.\n **/\n void RegisterDomain(1: shared.RegisterDomainRequest registerRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.DomainAlreadyExistsError domainExistsError,\n )\n\n /**\n * DescribeDomain returns the information and configuration for a registered domain.\n **/\n shared.DescribeDomainResponse DescribeDomain(1: shared.DescribeDomainRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * UpdateDomain is used to update the information and configuration for a registered domain.\n **/\n shared.UpdateDomainResponse UpdateDomain(1: shared.UpdateDomainRequest updateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * DeprecateDomain us used to update status of a registered domain to DEPRECATED. Once the domain is deprecated\n * it cannot be used to start new workflow executions. Existing workflow executions will continue to run on\n * deprecated domains.\n **/\n void DeprecateDomain(1: shared.DeprecateDomainRequest deprecateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * StartWorkflowExecution starts a new long running workflow instance. It will create the instance with\n * 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for the worker to make the\n * first decision for this instance. It will return 'WorkflowExecutionAlreadyStartedError', if an instance already\n * exists with same workflowId.\n **/\n shared.StartWorkflowExecutionResponse StartWorkflowExecution(1: shared.StartWorkflowExecutionRequest startRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.WorkflowExecutionAlreadyStartedError sessionAlreadyExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * Returns the history of specified workflow execution. It fails with 'EntityNotExistError' if speficied workflow\n * execution in unknown to the service.\n **/\n shared.GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory(1: shared.GetWorkflowExecutionHistoryRequest getRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * PollForDecisionTask is called by application worker to process DecisionTask from a specific taskList. A\n * DecisionTask is dispatched to callers for active workflow executions, with pending decisions.\n * Application is then expected to call 'RespondDecisionTaskCompleted' API when it is done processing the DecisionTask.\n * It will also create a 'DecisionTaskStarted' event in the history for that session before handing off DecisionTask to\n * application worker.\n **/\n shared.PollForDecisionTaskResponse PollForDecisionTask(1: shared.PollForDecisionTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed as a result of\n * 'PollForDecisionTask' API call. Completing a DecisionTask will result in new events for the workflow execution and\n * potentially new ActivityTask being created for corresponding decisions. It will also create a DecisionTaskCompleted\n * event in the history for that session. Use the 'taskToken' provided as response of PollForDecisionTask API call\n * for completing the DecisionTask.\n **/\n void RespondDecisionTaskCompleted(1: shared.RespondDecisionTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondDecisionTaskFailed is called by application worker to indicate failure. This results in\n * DecisionTaskFailedEvent written to the history and a new DecisionTask created. This API can be used by client to\n * either clear sticky tasklist or report any panics during DecisionTask processing. Cadence will only append first\n * DecisionTaskFailed event to the history of workflow execution for consecutive failures.\n **/\n void RespondDecisionTaskFailed(1: shared.RespondDecisionTaskFailedRequest failedRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * PollForActivityTask is called by application worker to process ActivityTask from a specific taskList. ActivityTask\n * is dispatched to callers whenever a ScheduleTask decision is made for a workflow execution.\n * Application is expected to call 'RespondActivityTaskCompleted' or 'RespondActivityTaskFailed' once it is done\n * processing the task.\n * Application also needs to call 'RecordActivityTaskHeartbeat' API within 'heartbeatTimeoutSeconds' interval to\n * prevent the task from getting timed out. An event 'ActivityTaskStarted' event is also written to workflow execution\n * history before the ActivityTask is dispatched to application worker.\n **/\n shared.PollForActivityTaskResponse PollForActivityTask(1: shared.PollForActivityTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RecordActivityTaskHeartbeat is called by application worker while it is processing an ActivityTask. If worker fails\n * to heartbeat within 'heartbeatTimeoutSeconds' interval for the ActivityTask, then it will be marked as timedout and\n * 'ActivityTaskTimedOut' event will be written to the workflow history. Calling 'RecordActivityTaskHeartbeat' will\n * fail with 'EntityNotExistsError' in such situations. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for heartbeating.\n **/\n shared.RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(1: shared.RecordActivityTaskHeartbeatRequest heartbeatRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCompleted is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCompleted(1: shared.RespondActivityTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCompletedByID is called by application worker when it is done processing an ActivityTask.\n * It will result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Similar to RespondActivityTaskCompleted but use DomainID,\n * WorkflowID and ActivityID instead of 'taskToken' for completion. It fails with 'EntityNotExistsError'\n * if the these IDs are not valid anymore due to activity timeout.\n **/\n void RespondActivityTaskCompletedByID(1: shared.RespondActivityTaskCompletedByIDRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskFailed is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskFailed(1: shared.RespondActivityTaskFailedRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskFailedByID is called by application worker when it is done processing an ActivityTask.\n * It will result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Similar to RespondActivityTaskFailed but use\n * DomainID, WorkflowID and ActivityID instead of 'taskToken' for completion. It fails with 'EntityNotExistsError'\n * if the these IDs are not valid anymore due to activity timeout.\n **/\n void RespondActivityTaskFailedByID(1: shared.RespondActivityTaskFailedByIDRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an ActivityTask. It will\n * result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceled(1: shared.RespondActivityTaskCanceledRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCanceledByID is called by application worker when it is successfully canceled an ActivityTask.\n * It will result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Similar to RespondActivityTaskCanceled but use\n * DomainID, WorkflowID and ActivityID instead of 'taskToken' for completion. It fails with 'EntityNotExistsError'\n * if the these IDs are not valid anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceledByID(1: shared.RespondActivityTaskCanceledByIDRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RequestCancelWorkflowExecution is called by application worker when it wants to request cancellation of a workflow instance.\n * It will result in a new 'WorkflowExecutionCancelRequested' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. It fails with 'EntityNotExistsError' if the workflow is not valid\n * anymore due to completion or doesn't exist.\n **/\n void RequestCancelWorkflowExecution(1: shared.RequestCancelWorkflowExecutionRequest cancelRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.CancellationAlreadyRequestedError cancellationAlreadyRequestedError,\n 5: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in\n * WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.\n **/\n void SignalWorkflowExecution(1: shared.SignalWorkflowExecutionRequest signalRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event\n * in the history and immediately terminating the execution instance.\n **/\n void TerminateWorkflowExecution(1: shared.TerminateWorkflowExecutionRequest terminateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * ListOpenWorkflowExecutions is a visibility API to list the open executions in a specific domain.\n **/\n shared.ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions(1: shared.ListOpenWorkflowExecutionsRequest listRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * ListClosedWorkflowExecutions is a visibility API to list the closed executions in a specific domain.\n **/\n shared.ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions(1: shared.ListClosedWorkflowExecutionsRequest listRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondQueryTaskCompleted is called by application worker to complete a QueryTask (which is a DecisionTask for query)\n * as a result of 'PollForDecisionTask' API call. Completing a QueryTask will unblock the client call to 'QueryWorkflow'\n * API and return the query result to client as a response to 'QueryWorkflow' API call.\n **/\n void RespondQueryTaskCompleted(1: shared.RespondQueryTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * QueryWorkflow returns query result for a specified workflow execution\n **/\n shared.QueryWorkflowResponse QueryWorkflow(1: shared.QueryWorkflowRequest queryRequest)\n\tthrows (\n\t 1: shared.BadRequestError badRequestError,\n\t 2: shared.InternalServiceError internalServiceError,\n\t 3: shared.EntityNotExistsError entityNotExistError,\n\t 4: shared.QueryFailedError queryFailedError,\n\t)\n\n /**\n * DescribeWorkflowExecution returns information about the specified workflow execution.\n **/\n shared.DescribeWorkflowExecutionResponse DescribeWorkflowExecution(1: shared.DescribeWorkflowExecutionRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * GetPollerHistory returns pollers which poll from given tasklist in last few minutes.\n **/\n shared.GetPollerHistoryResponse GetPollerHistory(1: shared.GetPollerHistoryRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\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\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence\n\n/**\n* WorkflowService API is exposed to provide support for long running applications. Application is expected to call\n* StartWorkflowExecution to create an instance for each instance of long running workflow. Such applications are expected\n* to have a worker which regularly polls for DecisionTask and ActivityTask from the WorkflowService. For each\n* DecisionTask, application is expected to process the history of events for that session and respond back with next\n* decisions. For each ActivityTask, application is expected to execute the actual logic for that task and respond back\n* with completion or failure. Worker is expected to regularly heartbeat while activity task is running.\n**/\nservice WorkflowService {\n /**\n * RegisterDomain creates a new domain which can be used as a container for all resources. Domain is a top level\n * entity within Cadence, used as a container for all resources like workflow executions, tasklists, etc. Domain\n * acts as a sandbox and provides isolation for all resources within the domain. All resources belongs to exactly one\n * domain.\n **/\n void RegisterDomain(1: shared.RegisterDomainRequest registerRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.DomainAlreadyExistsError domainExistsError,\n )\n\n /**\n * DescribeDomain returns the information and configuration for a registered domain.\n **/\n shared.DescribeDomainResponse DescribeDomain(1: shared.DescribeDomainRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * UpdateDomain is used to update the information and configuration for a registered domain.\n **/\n shared.UpdateDomainResponse UpdateDomain(1: shared.UpdateDomainRequest updateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * DeprecateDomain us used to update status of a registered domain to DEPRECATED. Once the domain is deprecated\n * it cannot be used to start new workflow executions. Existing workflow executions will continue to run on\n * deprecated domains.\n **/\n void DeprecateDomain(1: shared.DeprecateDomainRequest deprecateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * StartWorkflowExecution starts a new long running workflow instance. It will create the instance with\n * 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for the worker to make the\n * first decision for this instance. It will return 'WorkflowExecutionAlreadyStartedError', if an instance already\n * exists with same workflowId.\n **/\n shared.StartWorkflowExecutionResponse StartWorkflowExecution(1: shared.StartWorkflowExecutionRequest startRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.WorkflowExecutionAlreadyStartedError sessionAlreadyExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * Returns the history of specified workflow execution. It fails with 'EntityNotExistError' if speficied workflow\n * execution in unknown to the service.\n **/\n shared.GetWorkflowExecutionHistoryResponse GetWorkflowExecutionHistory(1: shared.GetWorkflowExecutionHistoryRequest getRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * PollForDecisionTask is called by application worker to process DecisionTask from a specific taskList. A\n * DecisionTask is dispatched to callers for active workflow executions, with pending decisions.\n * Application is then expected to call 'RespondDecisionTaskCompleted' API when it is done processing the DecisionTask.\n * It will also create a 'DecisionTaskStarted' event in the history for that session before handing off DecisionTask to\n * application worker.\n **/\n shared.PollForDecisionTaskResponse PollForDecisionTask(1: shared.PollForDecisionTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed as a result of\n * 'PollForDecisionTask' API call. Completing a DecisionTask will result in new events for the workflow execution and\n * potentially new ActivityTask being created for corresponding decisions. It will also create a DecisionTaskCompleted\n * event in the history for that session. Use the 'taskToken' provided as response of PollForDecisionTask API call\n * for completing the DecisionTask.\n **/\n void RespondDecisionTaskCompleted(1: shared.RespondDecisionTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondDecisionTaskFailed is called by application worker to indicate failure. This results in\n * DecisionTaskFailedEvent written to the history and a new DecisionTask created. This API can be used by client to\n * either clear sticky tasklist or report any panics during DecisionTask processing. Cadence will only append first\n * DecisionTaskFailed event to the history of workflow execution for consecutive failures.\n **/\n void RespondDecisionTaskFailed(1: shared.RespondDecisionTaskFailedRequest failedRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * PollForActivityTask is called by application worker to process ActivityTask from a specific taskList. ActivityTask\n * is dispatched to callers whenever a ScheduleTask decision is made for a workflow execution.\n * Application is expected to call 'RespondActivityTaskCompleted' or 'RespondActivityTaskFailed' once it is done\n * processing the task.\n * Application also needs to call 'RecordActivityTaskHeartbeat' API within 'heartbeatTimeoutSeconds' interval to\n * prevent the task from getting timed out. An event 'ActivityTaskStarted' event is also written to workflow execution\n * history before the ActivityTask is dispatched to application worker.\n **/\n shared.PollForActivityTaskResponse PollForActivityTask(1: shared.PollForActivityTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RecordActivityTaskHeartbeat is called by application worker while it is processing an ActivityTask. If worker fails\n * to heartbeat within 'heartbeatTimeoutSeconds' interval for the ActivityTask, then it will be marked as timedout and\n * 'ActivityTaskTimedOut' event will be written to the workflow history. Calling 'RecordActivityTaskHeartbeat' will\n * fail with 'EntityNotExistsError' in such situations. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for heartbeating.\n **/\n shared.RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(1: shared.RecordActivityTaskHeartbeatRequest heartbeatRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCompleted is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCompleted(1: shared.RespondActivityTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCompletedByID is called by application worker when it is done processing an ActivityTask.\n * It will result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n * created for the workflow so new decisions could be made. Similar to RespondActivityTaskCompleted but use DomainID,\n * WorkflowID and ActivityID instead of 'taskToken' for completion. It fails with 'EntityNotExistsError'\n * if the these IDs are not valid anymore due to activity timeout.\n **/\n void RespondActivityTaskCompletedByID(1: shared.RespondActivityTaskCompletedByIDRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskFailed is called by application worker when it is done processing an ActivityTask. It will\n * result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskFailed(1: shared.RespondActivityTaskFailedRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskFailedByID is called by application worker when it is done processing an ActivityTask.\n * It will result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Similar to RespondActivityTaskFailed but use\n * DomainID, WorkflowID and ActivityID instead of 'taskToken' for completion. It fails with 'EntityNotExistsError'\n * if the these IDs are not valid anymore due to activity timeout.\n **/\n void RespondActivityTaskFailedByID(1: shared.RespondActivityTaskFailedByIDRequest failRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an ActivityTask. It will\n * result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Use the 'taskToken' provided as response of\n * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n * anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceled(1: shared.RespondActivityTaskCanceledRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RespondActivityTaskCanceledByID is called by application worker when it is successfully canceled an ActivityTask.\n * It will result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. Similar to RespondActivityTaskCanceled but use\n * DomainID, WorkflowID and ActivityID instead of 'taskToken' for completion. It fails with 'EntityNotExistsError'\n * if the these IDs are not valid anymore due to activity timeout.\n **/\n void RespondActivityTaskCanceledByID(1: shared.RespondActivityTaskCanceledByIDRequest canceledRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * RequestCancelWorkflowExecution is called by application worker when it wants to request cancellation of a workflow instance.\n * It will result in a new 'WorkflowExecutionCancelRequested' event being written to the workflow history and a new DecisionTask\n * created for the workflow instance so new decisions could be made. It fails with 'EntityNotExistsError' if the workflow is not valid\n * anymore due to completion or doesn't exist.\n **/\n void RequestCancelWorkflowExecution(1: shared.RequestCancelWorkflowExecutionRequest cancelRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.CancellationAlreadyRequestedError cancellationAlreadyRequestedError,\n 5: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in\n * WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.\n **/\n void SignalWorkflowExecution(1: shared.SignalWorkflowExecutionRequest signalRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event\n * in the history and immediately terminating the execution instance.\n **/\n void TerminateWorkflowExecution(1: shared.TerminateWorkflowExecutionRequest terminateRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * ListOpenWorkflowExecutions is a visibility API to list the open executions in a specific domain.\n **/\n shared.ListOpenWorkflowExecutionsResponse ListOpenWorkflowExecutions(1: shared.ListOpenWorkflowExecutionsRequest listRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * ListClosedWorkflowExecutions is a visibility API to list the closed executions in a specific domain.\n **/\n shared.ListClosedWorkflowExecutionsResponse ListClosedWorkflowExecutions(1: shared.ListClosedWorkflowExecutionsRequest listRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * RespondQueryTaskCompleted is called by application worker to complete a QueryTask (which is a DecisionTask for query)\n * as a result of 'PollForDecisionTask' API call. Completing a QueryTask will unblock the client call to 'QueryWorkflow'\n * API and return the query result to client as a response to 'QueryWorkflow' API call.\n **/\n void RespondQueryTaskCompleted(1: shared.RespondQueryTaskCompletedRequest completeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * QueryWorkflow returns query result for a specified workflow execution\n **/\n shared.QueryWorkflowResponse QueryWorkflow(1: shared.QueryWorkflowRequest queryRequest)\n\tthrows (\n\t 1: shared.BadRequestError badRequestError,\n\t 2: shared.InternalServiceError internalServiceError,\n\t 3: shared.EntityNotExistsError entityNotExistError,\n\t 4: shared.QueryFailedError queryFailedError,\n\t)\n\n /**\n * DescribeWorkflowExecution returns information about the specified workflow execution.\n **/\n shared.DescribeWorkflowExecutionResponse DescribeWorkflowExecution(1: shared.DescribeWorkflowExecutionRequest describeRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * DescribeTaskList returns information about the target tasklist, right now this API returns the\n * pollers which polled this tasklist in last few minutes.\n **/\n shared.DescribeTaskListResponse DescribeTaskList(1: shared.DescribeTaskListRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n}\n" diff --git a/.gen/go/cadence/workflowservice_getpollerhistory.go b/.gen/go/cadence/workflowservice_describetasklist.go similarity index 66% rename from .gen/go/cadence/workflowservice_getpollerhistory.go rename to .gen/go/cadence/workflowservice_describetasklist.go index b2798eed837..c11feb58717 100644 --- a/.gen/go/cadence/workflowservice_getpollerhistory.go +++ b/.gen/go/cadence/workflowservice_describetasklist.go @@ -31,14 +31,14 @@ import ( "strings" ) -// WorkflowService_GetPollerHistory_Args represents the arguments for the WorkflowService.GetPollerHistory function. +// WorkflowService_DescribeTaskList_Args represents the arguments for the WorkflowService.DescribeTaskList function. // -// The arguments for GetPollerHistory are sent and received over the wire as this struct. -type WorkflowService_GetPollerHistory_Args struct { - Request *shared.GetPollerHistoryRequest `json:"request,omitempty"` +// The arguments for DescribeTaskList are sent and received over the wire as this struct. +type WorkflowService_DescribeTaskList_Args struct { + Request *shared.DescribeTaskListRequest `json:"request,omitempty"` } -// ToWire translates a WorkflowService_GetPollerHistory_Args struct into a Thrift-level intermediate +// ToWire translates a WorkflowService_DescribeTaskList_Args struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -53,7 +53,7 @@ type WorkflowService_GetPollerHistory_Args struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *WorkflowService_GetPollerHistory_Args) ToWire() (wire.Value, error) { +func (v *WorkflowService_DescribeTaskList_Args) ToWire() (wire.Value, error) { var ( fields [1]wire.Field i int = 0 @@ -73,17 +73,17 @@ func (v *WorkflowService_GetPollerHistory_Args) ToWire() (wire.Value, error) { return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -func _GetPollerHistoryRequest_Read(w wire.Value) (*shared.GetPollerHistoryRequest, error) { - var v shared.GetPollerHistoryRequest +func _DescribeTaskListRequest_Read(w wire.Value) (*shared.DescribeTaskListRequest, error) { + var v shared.DescribeTaskListRequest err := v.FromWire(w) return &v, err } -// FromWire deserializes a WorkflowService_GetPollerHistory_Args struct from its Thrift-level +// FromWire deserializes a WorkflowService_DescribeTaskList_Args 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 WorkflowService_GetPollerHistory_Args struct +// An error is returned if we were unable to build a WorkflowService_DescribeTaskList_Args struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -91,19 +91,19 @@ func _GetPollerHistoryRequest_Read(w wire.Value) (*shared.GetPollerHistoryReques // return nil, err // } // -// var v WorkflowService_GetPollerHistory_Args +// var v WorkflowService_DescribeTaskList_Args // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *WorkflowService_GetPollerHistory_Args) FromWire(w wire.Value) error { +func (v *WorkflowService_DescribeTaskList_Args) FromWire(w wire.Value) error { var err error for _, field := range w.GetStruct().Fields { switch field.ID { case 1: if field.Value.Type() == wire.TStruct { - v.Request, err = _GetPollerHistoryRequest_Read(field.Value) + v.Request, err = _DescribeTaskListRequest_Read(field.Value) if err != nil { return err } @@ -115,9 +115,9 @@ func (v *WorkflowService_GetPollerHistory_Args) FromWire(w wire.Value) error { return nil } -// String returns a readable string representation of a WorkflowService_GetPollerHistory_Args +// String returns a readable string representation of a WorkflowService_DescribeTaskList_Args // struct. -func (v *WorkflowService_GetPollerHistory_Args) String() string { +func (v *WorkflowService_DescribeTaskList_Args) String() string { if v == nil { return "" } @@ -129,14 +129,14 @@ func (v *WorkflowService_GetPollerHistory_Args) String() string { i++ } - return fmt.Sprintf("WorkflowService_GetPollerHistory_Args{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("WorkflowService_DescribeTaskList_Args{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this WorkflowService_GetPollerHistory_Args match the -// provided WorkflowService_GetPollerHistory_Args. +// Equals returns true if all the fields of this WorkflowService_DescribeTaskList_Args match the +// provided WorkflowService_DescribeTaskList_Args. // // This function performs a deep comparison. -func (v *WorkflowService_GetPollerHistory_Args) Equals(rhs *WorkflowService_GetPollerHistory_Args) bool { +func (v *WorkflowService_DescribeTaskList_Args) Equals(rhs *WorkflowService_DescribeTaskList_Args) bool { if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) { return false } @@ -147,73 +147,73 @@ func (v *WorkflowService_GetPollerHistory_Args) Equals(rhs *WorkflowService_GetP // MethodName returns the name of the Thrift function as specified in // the IDL, for which this struct represent the arguments. // -// This will always be "GetPollerHistory" for this struct. -func (v *WorkflowService_GetPollerHistory_Args) MethodName() string { - return "GetPollerHistory" +// This will always be "DescribeTaskList" for this struct. +func (v *WorkflowService_DescribeTaskList_Args) MethodName() string { + return "DescribeTaskList" } // EnvelopeType returns the kind of value inside this struct. // // This will always be Call for this struct. -func (v *WorkflowService_GetPollerHistory_Args) EnvelopeType() wire.EnvelopeType { +func (v *WorkflowService_DescribeTaskList_Args) EnvelopeType() wire.EnvelopeType { return wire.Call } -// WorkflowService_GetPollerHistory_Helper provides functions that aid in handling the -// parameters and return values of the WorkflowService.GetPollerHistory +// WorkflowService_DescribeTaskList_Helper provides functions that aid in handling the +// parameters and return values of the WorkflowService.DescribeTaskList // function. -var WorkflowService_GetPollerHistory_Helper = struct { - // Args accepts the parameters of GetPollerHistory in-order and returns +var WorkflowService_DescribeTaskList_Helper = struct { + // Args accepts the parameters of DescribeTaskList in-order and returns // the arguments struct for the function. Args func( - request *shared.GetPollerHistoryRequest, - ) *WorkflowService_GetPollerHistory_Args + request *shared.DescribeTaskListRequest, + ) *WorkflowService_DescribeTaskList_Args // IsException returns true if the given error can be thrown - // by GetPollerHistory. + // by DescribeTaskList. // - // An error can be thrown by GetPollerHistory only if the + // An error can be thrown by DescribeTaskList only if the // corresponding exception type was mentioned in the 'throws' // section for it in the Thrift file. IsException func(error) bool - // WrapResponse returns the result struct for GetPollerHistory + // WrapResponse returns the result struct for DescribeTaskList // given its return value and error. // // This allows mapping values and errors returned by - // GetPollerHistory into a serializable result struct. + // DescribeTaskList into a serializable result struct. // WrapResponse returns a non-nil error if the provided - // error cannot be thrown by GetPollerHistory + // error cannot be thrown by DescribeTaskList // - // value, err := GetPollerHistory(args) - // result, err := WorkflowService_GetPollerHistory_Helper.WrapResponse(value, err) + // value, err := DescribeTaskList(args) + // result, err := WorkflowService_DescribeTaskList_Helper.WrapResponse(value, err) // if err != nil { - // return fmt.Errorf("unexpected error from GetPollerHistory: %v", err) + // return fmt.Errorf("unexpected error from DescribeTaskList: %v", err) // } // serialize(result) - WrapResponse func(*shared.GetPollerHistoryResponse, error) (*WorkflowService_GetPollerHistory_Result, error) + WrapResponse func(*shared.DescribeTaskListResponse, error) (*WorkflowService_DescribeTaskList_Result, error) - // UnwrapResponse takes the result struct for GetPollerHistory + // UnwrapResponse takes the result struct for DescribeTaskList // and returns the value or error returned by it. // - // The error is non-nil only if GetPollerHistory threw an + // The error is non-nil only if DescribeTaskList threw an // exception. // // result := deserialize(bytes) - // value, err := WorkflowService_GetPollerHistory_Helper.UnwrapResponse(result) - UnwrapResponse func(*WorkflowService_GetPollerHistory_Result) (*shared.GetPollerHistoryResponse, error) + // value, err := WorkflowService_DescribeTaskList_Helper.UnwrapResponse(result) + UnwrapResponse func(*WorkflowService_DescribeTaskList_Result) (*shared.DescribeTaskListResponse, error) }{} func init() { - WorkflowService_GetPollerHistory_Helper.Args = func( - request *shared.GetPollerHistoryRequest, - ) *WorkflowService_GetPollerHistory_Args { - return &WorkflowService_GetPollerHistory_Args{ + WorkflowService_DescribeTaskList_Helper.Args = func( + request *shared.DescribeTaskListRequest, + ) *WorkflowService_DescribeTaskList_Args { + return &WorkflowService_DescribeTaskList_Args{ Request: request, } } - WorkflowService_GetPollerHistory_Helper.IsException = func(err error) bool { + WorkflowService_DescribeTaskList_Helper.IsException = func(err error) bool { switch err.(type) { case *shared.BadRequestError: return true @@ -226,32 +226,32 @@ func init() { } } - WorkflowService_GetPollerHistory_Helper.WrapResponse = func(success *shared.GetPollerHistoryResponse, err error) (*WorkflowService_GetPollerHistory_Result, error) { + WorkflowService_DescribeTaskList_Helper.WrapResponse = func(success *shared.DescribeTaskListResponse, err error) (*WorkflowService_DescribeTaskList_Result, error) { if err == nil { - return &WorkflowService_GetPollerHistory_Result{Success: success}, nil + return &WorkflowService_DescribeTaskList_Result{Success: success}, nil } switch e := err.(type) { case *shared.BadRequestError: if e == nil { - return nil, errors.New("WrapResponse received non-nil error type with nil value for WorkflowService_GetPollerHistory_Result.BadRequestError") + return nil, errors.New("WrapResponse received non-nil error type with nil value for WorkflowService_DescribeTaskList_Result.BadRequestError") } - return &WorkflowService_GetPollerHistory_Result{BadRequestError: e}, nil + return &WorkflowService_DescribeTaskList_Result{BadRequestError: e}, nil case *shared.InternalServiceError: if e == nil { - return nil, errors.New("WrapResponse received non-nil error type with nil value for WorkflowService_GetPollerHistory_Result.InternalServiceError") + return nil, errors.New("WrapResponse received non-nil error type with nil value for WorkflowService_DescribeTaskList_Result.InternalServiceError") } - return &WorkflowService_GetPollerHistory_Result{InternalServiceError: e}, nil + return &WorkflowService_DescribeTaskList_Result{InternalServiceError: e}, nil case *shared.EntityNotExistsError: if e == nil { - return nil, errors.New("WrapResponse received non-nil error type with nil value for WorkflowService_GetPollerHistory_Result.EntityNotExistError") + return nil, errors.New("WrapResponse received non-nil error type with nil value for WorkflowService_DescribeTaskList_Result.EntityNotExistError") } - return &WorkflowService_GetPollerHistory_Result{EntityNotExistError: e}, nil + return &WorkflowService_DescribeTaskList_Result{EntityNotExistError: e}, nil } return nil, err } - WorkflowService_GetPollerHistory_Helper.UnwrapResponse = func(result *WorkflowService_GetPollerHistory_Result) (success *shared.GetPollerHistoryResponse, err error) { + WorkflowService_DescribeTaskList_Helper.UnwrapResponse = func(result *WorkflowService_DescribeTaskList_Result) (success *shared.DescribeTaskListResponse, err error) { if result.BadRequestError != nil { err = result.BadRequestError return @@ -276,20 +276,20 @@ func init() { } -// WorkflowService_GetPollerHistory_Result represents the result of a WorkflowService.GetPollerHistory function call. +// WorkflowService_DescribeTaskList_Result represents the result of a WorkflowService.DescribeTaskList function call. // -// The result of a GetPollerHistory execution is sent and received over the wire as this struct. +// The result of a DescribeTaskList execution is sent and received over the wire as this struct. // // Success is set only if the function did not throw an exception. -type WorkflowService_GetPollerHistory_Result struct { - // Value returned by GetPollerHistory after a successful execution. - Success *shared.GetPollerHistoryResponse `json:"success,omitempty"` +type WorkflowService_DescribeTaskList_Result struct { + // Value returned by DescribeTaskList after a successful execution. + Success *shared.DescribeTaskListResponse `json:"success,omitempty"` BadRequestError *shared.BadRequestError `json:"badRequestError,omitempty"` InternalServiceError *shared.InternalServiceError `json:"internalServiceError,omitempty"` EntityNotExistError *shared.EntityNotExistsError `json:"entityNotExistError,omitempty"` } -// ToWire translates a WorkflowService_GetPollerHistory_Result struct into a Thrift-level intermediate +// ToWire translates a WorkflowService_DescribeTaskList_Result struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -304,7 +304,7 @@ type WorkflowService_GetPollerHistory_Result struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *WorkflowService_GetPollerHistory_Result) ToWire() (wire.Value, error) { +func (v *WorkflowService_DescribeTaskList_Result) ToWire() (wire.Value, error) { var ( fields [4]wire.Field i int = 0 @@ -346,23 +346,23 @@ func (v *WorkflowService_GetPollerHistory_Result) ToWire() (wire.Value, error) { } if i != 1 { - return wire.Value{}, fmt.Errorf("WorkflowService_GetPollerHistory_Result should have exactly one field: got %v fields", i) + return wire.Value{}, fmt.Errorf("WorkflowService_DescribeTaskList_Result should have exactly one field: got %v fields", i) } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -func _GetPollerHistoryResponse_Read(w wire.Value) (*shared.GetPollerHistoryResponse, error) { - var v shared.GetPollerHistoryResponse +func _DescribeTaskListResponse_Read(w wire.Value) (*shared.DescribeTaskListResponse, error) { + var v shared.DescribeTaskListResponse err := v.FromWire(w) return &v, err } -// FromWire deserializes a WorkflowService_GetPollerHistory_Result struct from its Thrift-level +// FromWire deserializes a WorkflowService_DescribeTaskList_Result 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 WorkflowService_GetPollerHistory_Result struct +// An error is returned if we were unable to build a WorkflowService_DescribeTaskList_Result struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -370,19 +370,19 @@ func _GetPollerHistoryResponse_Read(w wire.Value) (*shared.GetPollerHistoryRespo // return nil, err // } // -// var v WorkflowService_GetPollerHistory_Result +// var v WorkflowService_DescribeTaskList_Result // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *WorkflowService_GetPollerHistory_Result) FromWire(w wire.Value) error { +func (v *WorkflowService_DescribeTaskList_Result) FromWire(w wire.Value) error { var err error for _, field := range w.GetStruct().Fields { switch field.ID { case 0: if field.Value.Type() == wire.TStruct { - v.Success, err = _GetPollerHistoryResponse_Read(field.Value) + v.Success, err = _DescribeTaskListResponse_Read(field.Value) if err != nil { return err } @@ -429,15 +429,15 @@ func (v *WorkflowService_GetPollerHistory_Result) FromWire(w wire.Value) error { count++ } if count != 1 { - return fmt.Errorf("WorkflowService_GetPollerHistory_Result should have exactly one field: got %v fields", count) + return fmt.Errorf("WorkflowService_DescribeTaskList_Result should have exactly one field: got %v fields", count) } return nil } -// String returns a readable string representation of a WorkflowService_GetPollerHistory_Result +// String returns a readable string representation of a WorkflowService_DescribeTaskList_Result // struct. -func (v *WorkflowService_GetPollerHistory_Result) String() string { +func (v *WorkflowService_DescribeTaskList_Result) String() string { if v == nil { return "" } @@ -461,14 +461,14 @@ func (v *WorkflowService_GetPollerHistory_Result) String() string { i++ } - return fmt.Sprintf("WorkflowService_GetPollerHistory_Result{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("WorkflowService_DescribeTaskList_Result{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this WorkflowService_GetPollerHistory_Result match the -// provided WorkflowService_GetPollerHistory_Result. +// Equals returns true if all the fields of this WorkflowService_DescribeTaskList_Result match the +// provided WorkflowService_DescribeTaskList_Result. // // This function performs a deep comparison. -func (v *WorkflowService_GetPollerHistory_Result) Equals(rhs *WorkflowService_GetPollerHistory_Result) bool { +func (v *WorkflowService_DescribeTaskList_Result) Equals(rhs *WorkflowService_DescribeTaskList_Result) bool { if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) { return false } @@ -488,14 +488,14 @@ func (v *WorkflowService_GetPollerHistory_Result) Equals(rhs *WorkflowService_Ge // MethodName returns the name of the Thrift function as specified in // the IDL, for which this struct represent the result. // -// This will always be "GetPollerHistory" for this struct. -func (v *WorkflowService_GetPollerHistory_Result) MethodName() string { - return "GetPollerHistory" +// This will always be "DescribeTaskList" for this struct. +func (v *WorkflowService_DescribeTaskList_Result) MethodName() string { + return "DescribeTaskList" } // EnvelopeType returns the kind of value inside this struct. // // This will always be Reply for this struct. -func (v *WorkflowService_GetPollerHistory_Result) EnvelopeType() wire.EnvelopeType { +func (v *WorkflowService_DescribeTaskList_Result) EnvelopeType() wire.EnvelopeType { return wire.Reply } diff --git a/.gen/go/cadence/workflowserviceclient/client.go b/.gen/go/cadence/workflowserviceclient/client.go index 2c3b1ae0f4d..acaab2682f9 100644 --- a/.gen/go/cadence/workflowserviceclient/client.go +++ b/.gen/go/cadence/workflowserviceclient/client.go @@ -48,17 +48,17 @@ type Interface interface { opts ...yarpc.CallOption, ) (*shared.DescribeDomainResponse, error) - DescribeWorkflowExecution( + DescribeTaskList( ctx context.Context, - DescribeRequest *shared.DescribeWorkflowExecutionRequest, + Request *shared.DescribeTaskListRequest, opts ...yarpc.CallOption, - ) (*shared.DescribeWorkflowExecutionResponse, error) + ) (*shared.DescribeTaskListResponse, error) - GetPollerHistory( + DescribeWorkflowExecution( ctx context.Context, - Request *shared.GetPollerHistoryRequest, + DescribeRequest *shared.DescribeWorkflowExecutionRequest, opts ...yarpc.CallOption, - ) (*shared.GetPollerHistoryResponse, error) + ) (*shared.DescribeWorkflowExecutionResponse, error) GetWorkflowExecutionHistory( ctx context.Context, @@ -263,13 +263,13 @@ func (c client) DescribeDomain( return } -func (c client) DescribeWorkflowExecution( +func (c client) DescribeTaskList( ctx context.Context, - _DescribeRequest *shared.DescribeWorkflowExecutionRequest, + _Request *shared.DescribeTaskListRequest, opts ...yarpc.CallOption, -) (success *shared.DescribeWorkflowExecutionResponse, err error) { +) (success *shared.DescribeTaskListResponse, err error) { - args := cadence.WorkflowService_DescribeWorkflowExecution_Helper.Args(_DescribeRequest) + args := cadence.WorkflowService_DescribeTaskList_Helper.Args(_Request) var body wire.Value body, err = c.c.Call(ctx, args, opts...) @@ -277,22 +277,22 @@ func (c client) DescribeWorkflowExecution( return } - var result cadence.WorkflowService_DescribeWorkflowExecution_Result + var result cadence.WorkflowService_DescribeTaskList_Result if err = result.FromWire(body); err != nil { return } - success, err = cadence.WorkflowService_DescribeWorkflowExecution_Helper.UnwrapResponse(&result) + success, err = cadence.WorkflowService_DescribeTaskList_Helper.UnwrapResponse(&result) return } -func (c client) GetPollerHistory( +func (c client) DescribeWorkflowExecution( ctx context.Context, - _Request *shared.GetPollerHistoryRequest, + _DescribeRequest *shared.DescribeWorkflowExecutionRequest, opts ...yarpc.CallOption, -) (success *shared.GetPollerHistoryResponse, err error) { +) (success *shared.DescribeWorkflowExecutionResponse, err error) { - args := cadence.WorkflowService_GetPollerHistory_Helper.Args(_Request) + args := cadence.WorkflowService_DescribeWorkflowExecution_Helper.Args(_DescribeRequest) var body wire.Value body, err = c.c.Call(ctx, args, opts...) @@ -300,12 +300,12 @@ func (c client) GetPollerHistory( return } - var result cadence.WorkflowService_GetPollerHistory_Result + var result cadence.WorkflowService_DescribeWorkflowExecution_Result if err = result.FromWire(body); err != nil { return } - success, err = cadence.WorkflowService_GetPollerHistory_Helper.UnwrapResponse(&result) + success, err = cadence.WorkflowService_DescribeWorkflowExecution_Helper.UnwrapResponse(&result) return } diff --git a/.gen/go/cadence/workflowserviceserver/server.go b/.gen/go/cadence/workflowserviceserver/server.go index 05af53644ef..fc08d5400e5 100644 --- a/.gen/go/cadence/workflowserviceserver/server.go +++ b/.gen/go/cadence/workflowserviceserver/server.go @@ -44,16 +44,16 @@ type Interface interface { DescribeRequest *shared.DescribeDomainRequest, ) (*shared.DescribeDomainResponse, error) + DescribeTaskList( + ctx context.Context, + Request *shared.DescribeTaskListRequest, + ) (*shared.DescribeTaskListResponse, error) + DescribeWorkflowExecution( ctx context.Context, DescribeRequest *shared.DescribeWorkflowExecutionRequest, ) (*shared.DescribeWorkflowExecutionResponse, error) - GetPollerHistory( - ctx context.Context, - Request *shared.GetPollerHistoryRequest, - ) (*shared.GetPollerHistoryResponse, error) - GetWorkflowExecutionHistory( ctx context.Context, GetRequest *shared.GetWorkflowExecutionHistoryRequest, @@ -199,24 +199,24 @@ func New(impl Interface, opts ...thrift.RegisterOption) []transport.Procedure { }, thrift.Method{ - Name: "DescribeWorkflowExecution", + Name: "DescribeTaskList", HandlerSpec: thrift.HandlerSpec{ Type: transport.Unary, - Unary: thrift.UnaryHandler(h.DescribeWorkflowExecution), + Unary: thrift.UnaryHandler(h.DescribeTaskList), }, - Signature: "DescribeWorkflowExecution(DescribeRequest *shared.DescribeWorkflowExecutionRequest) (*shared.DescribeWorkflowExecutionResponse)", + Signature: "DescribeTaskList(Request *shared.DescribeTaskListRequest) (*shared.DescribeTaskListResponse)", ThriftModule: cadence.ThriftModule, }, thrift.Method{ - Name: "GetPollerHistory", + Name: "DescribeWorkflowExecution", HandlerSpec: thrift.HandlerSpec{ Type: transport.Unary, - Unary: thrift.UnaryHandler(h.GetPollerHistory), + Unary: thrift.UnaryHandler(h.DescribeWorkflowExecution), }, - Signature: "GetPollerHistory(Request *shared.GetPollerHistoryRequest) (*shared.GetPollerHistoryResponse)", + Signature: "DescribeWorkflowExecution(DescribeRequest *shared.DescribeWorkflowExecutionRequest) (*shared.DescribeWorkflowExecutionResponse)", ThriftModule: cadence.ThriftModule, }, @@ -509,16 +509,16 @@ func (h handler) DescribeDomain(ctx context.Context, body wire.Value) (thrift.Re return response, err } -func (h handler) DescribeWorkflowExecution(ctx context.Context, body wire.Value) (thrift.Response, error) { - var args cadence.WorkflowService_DescribeWorkflowExecution_Args +func (h handler) DescribeTaskList(ctx context.Context, body wire.Value) (thrift.Response, error) { + var args cadence.WorkflowService_DescribeTaskList_Args if err := args.FromWire(body); err != nil { return thrift.Response{}, err } - success, err := h.impl.DescribeWorkflowExecution(ctx, args.DescribeRequest) + success, err := h.impl.DescribeTaskList(ctx, args.Request) hadError := err != nil - result, err := cadence.WorkflowService_DescribeWorkflowExecution_Helper.WrapResponse(success, err) + result, err := cadence.WorkflowService_DescribeTaskList_Helper.WrapResponse(success, err) var response thrift.Response if err == nil { @@ -528,16 +528,16 @@ func (h handler) DescribeWorkflowExecution(ctx context.Context, body wire.Value) return response, err } -func (h handler) GetPollerHistory(ctx context.Context, body wire.Value) (thrift.Response, error) { - var args cadence.WorkflowService_GetPollerHistory_Args +func (h handler) DescribeWorkflowExecution(ctx context.Context, body wire.Value) (thrift.Response, error) { + var args cadence.WorkflowService_DescribeWorkflowExecution_Args if err := args.FromWire(body); err != nil { return thrift.Response{}, err } - success, err := h.impl.GetPollerHistory(ctx, args.Request) + success, err := h.impl.DescribeWorkflowExecution(ctx, args.DescribeRequest) hadError := err != nil - result, err := cadence.WorkflowService_GetPollerHistory_Helper.WrapResponse(success, err) + result, err := cadence.WorkflowService_DescribeWorkflowExecution_Helper.WrapResponse(success, err) var response thrift.Response if err == nil { diff --git a/.gen/go/cadence/workflowservicetest/client.go b/.gen/go/cadence/workflowservicetest/client.go index 9cff175fe73..6b30d283b10 100644 --- a/.gen/go/cadence/workflowservicetest/client.go +++ b/.gen/go/cadence/workflowservicetest/client.go @@ -126,70 +126,70 @@ func (mr *_MockClientRecorder) DescribeDomain( return mr.mock.ctrl.RecordCall(mr.mock, "DescribeDomain", args...) } -// DescribeWorkflowExecution responds to a DescribeWorkflowExecution call based on the mock expectations. This +// DescribeTaskList responds to a DescribeTaskList call based on the mock expectations. This // call will fail if the mock does not expect this call. Use EXPECT to expect // a call to this function. // -// client.EXPECT().DescribeWorkflowExecution(gomock.Any(), ...).Return(...) -// ... := client.DescribeWorkflowExecution(...) -func (m *MockClient) DescribeWorkflowExecution( +// client.EXPECT().DescribeTaskList(gomock.Any(), ...).Return(...) +// ... := client.DescribeTaskList(...) +func (m *MockClient) DescribeTaskList( ctx context.Context, - _DescribeRequest *shared.DescribeWorkflowExecutionRequest, + _Request *shared.DescribeTaskListRequest, opts ...yarpc.CallOption, -) (success *shared.DescribeWorkflowExecutionResponse, err error) { +) (success *shared.DescribeTaskListResponse, err error) { - args := []interface{}{ctx, _DescribeRequest} + args := []interface{}{ctx, _Request} for _, o := range opts { args = append(args, o) } i := 0 - ret := m.ctrl.Call(m, "DescribeWorkflowExecution", args...) - success, _ = ret[i].(*shared.DescribeWorkflowExecutionResponse) + ret := m.ctrl.Call(m, "DescribeTaskList", args...) + success, _ = ret[i].(*shared.DescribeTaskListResponse) i++ err, _ = ret[i].(error) return } -func (mr *_MockClientRecorder) DescribeWorkflowExecution( +func (mr *_MockClientRecorder) DescribeTaskList( ctx interface{}, - _DescribeRequest interface{}, + _Request interface{}, opts ...interface{}, ) *gomock.Call { - args := append([]interface{}{ctx, _DescribeRequest}, opts...) - return mr.mock.ctrl.RecordCall(mr.mock, "DescribeWorkflowExecution", args...) + args := append([]interface{}{ctx, _Request}, opts...) + return mr.mock.ctrl.RecordCall(mr.mock, "DescribeTaskList", args...) } -// GetPollerHistory responds to a GetPollerHistory call based on the mock expectations. This +// DescribeWorkflowExecution responds to a DescribeWorkflowExecution call based on the mock expectations. This // call will fail if the mock does not expect this call. Use EXPECT to expect // a call to this function. // -// client.EXPECT().GetPollerHistory(gomock.Any(), ...).Return(...) -// ... := client.GetPollerHistory(...) -func (m *MockClient) GetPollerHistory( +// client.EXPECT().DescribeWorkflowExecution(gomock.Any(), ...).Return(...) +// ... := client.DescribeWorkflowExecution(...) +func (m *MockClient) DescribeWorkflowExecution( ctx context.Context, - _Request *shared.GetPollerHistoryRequest, + _DescribeRequest *shared.DescribeWorkflowExecutionRequest, opts ...yarpc.CallOption, -) (success *shared.GetPollerHistoryResponse, err error) { +) (success *shared.DescribeWorkflowExecutionResponse, err error) { - args := []interface{}{ctx, _Request} + args := []interface{}{ctx, _DescribeRequest} for _, o := range opts { args = append(args, o) } i := 0 - ret := m.ctrl.Call(m, "GetPollerHistory", args...) - success, _ = ret[i].(*shared.GetPollerHistoryResponse) + ret := m.ctrl.Call(m, "DescribeWorkflowExecution", args...) + success, _ = ret[i].(*shared.DescribeWorkflowExecutionResponse) i++ err, _ = ret[i].(error) return } -func (mr *_MockClientRecorder) GetPollerHistory( +func (mr *_MockClientRecorder) DescribeWorkflowExecution( ctx interface{}, - _Request interface{}, + _DescribeRequest interface{}, opts ...interface{}, ) *gomock.Call { - args := append([]interface{}{ctx, _Request}, opts...) - return mr.mock.ctrl.RecordCall(mr.mock, "GetPollerHistory", args...) + args := append([]interface{}{ctx, _DescribeRequest}, opts...) + return mr.mock.ctrl.RecordCall(mr.mock, "DescribeWorkflowExecution", args...) } // GetWorkflowExecutionHistory responds to a GetWorkflowExecutionHistory call based on the mock expectations. This diff --git a/.gen/go/matching/idl.go b/.gen/go/matching/idl.go index 26daa846658..fea40675cd6 100644 --- a/.gen/go/matching/idl.go +++ b/.gen/go/matching/idl.go @@ -33,11 +33,11 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "matching", Package: "github.com/uber/cadence/.gen/go/matching", FilePath: "matching.thrift", - SHA1: "b08e6bd582787dc8c99e67a39673e77fe8df086b", + SHA1: "fd8da2f11240e27375e4fc9d55252b17d3bde9c6", Includes: []*thriftreflect.ThriftModule{ shared.ThriftModule, }, 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\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence.matching\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domainUUID\n 15: optional string pollerID\n 20: optional shared.PollForDecisionTaskRequest pollRequest\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional shared.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 60: optional i64 (js.type = \"Long\") nextEventId\n 65: optional i64 (js.type = \"Long\") backlogCountHint\n 70: optional bool stickyExecutionEnabled\n 80: optional shared.WorkflowQuery query\n 90: optional shared.TransientDecisionInfo decisionInfo\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domainUUID\n 15: optional string pollerID\n 20: optional shared.PollForActivityTaskRequest pollRequest\n}\n\nstruct AddDecisionTaskRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional shared.TaskList taskList\n 40: optional i64 (js.type = \"Long\") scheduleId\n 50: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct AddActivityTaskRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional string sourceDomainUUID\n 40: optional shared.TaskList taskList\n 50: optional i64 (js.type = \"Long\") scheduleId\n 60: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domainUUID\n 20: optional shared.TaskList taskList\n 30: optional shared.QueryWorkflowRequest queryRequest\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.TaskList taskList\n 30: optional string taskID\n 40: optional shared.RespondQueryTaskCompletedRequest completedRequest\n}\n\nstruct CancelOutstandingPollRequest {\n 10: optional string domainUUID\n 20: optional i32 taskListType\n 30: optional shared.TaskList taskList\n 40: optional string pollerID\n}\n\nstruct GetPollerHistoryRequest {\n 10: optional string domainUUID\n 20: optional shared.GetPollerHistoryRequest getRequest\n}\n\n/**\n* MatchingService API is exposed to provide support for polling from long running applications.\n* Such applications are expected to have a worker which regularly polls for DecisionTask and ActivityTask. For each\n* DecisionTask, application is expected to process the history of events for that session and respond back with next\n* decisions. For each ActivityTask, application is expected to execute the actual logic for that task and respond back\n* with completion or failure.\n**/\nservice MatchingService {\n /**\n * PollForDecisionTask is called by frontend to process DecisionTask from a specific taskList. A\n * DecisionTask is dispatched to callers for active workflow executions, with pending decisions.\n **/\n PollForDecisionTaskResponse PollForDecisionTask(1: PollForDecisionTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n )\n\n /**\n * PollForActivityTask is called by frontend to process ActivityTask from a specific taskList. ActivityTask\n * is dispatched to callers whenever a ScheduleTask decision is made for a workflow execution.\n **/\n shared.PollForActivityTaskResponse PollForActivityTask(1: PollForActivityTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n )\n\n /**\n * AddDecisionTask is called by the history service when a decision task is scheduled, so that it can be dispatched\n * by the MatchingEngine.\n **/\n void AddDecisionTask(1: AddDecisionTaskRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * AddActivityTask is called by the history service when a decision task is scheduled, so that it can be dispatched\n * by the MatchingEngine.\n **/\n void AddActivityTask(1: AddActivityTaskRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * QueryWorkflow is called by frontend to query a workflow.\n **/\n shared.QueryWorkflowResponse QueryWorkflow(1: QueryWorkflowRequest queryRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.QueryFailedError queryFailedError,\n )\n\n /**\n * RespondQueryTaskCompleted is called by frontend to respond query completed.\n **/\n void RespondQueryTaskCompleted(1: RespondQueryTaskCompletedRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * CancelOutstandingPoll is called by frontend to unblock long polls on matching for zombie pollers.\n * Our rpc stack does not support context propagation, so when a client connection goes away frontend sees\n * cancellation of context for that handler, but any corresponding calls (long-poll) to matching service does not\n * see the cancellation propagated so it can unblock corresponding long-polls on its end. This results is tasks\n * being dispatched to zombie pollers in this situation. This API is added so everytime frontend makes a long-poll\n * api call to matching it passes in a pollerID and then calls this API when it detects client connection is closed\n * to unblock long polls for this poller and prevent tasks being sent to these zombie pollers.\n **/\n void CancelOutstandingPoll(1: CancelOutstandingPollRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n )\n\n /**\n * GetPollerHistory returns pollers which poll from given tasklist in last few minutes.\n **/\n shared.GetPollerHistoryResponse GetPollerHistory(1: GetPollerHistoryRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\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\ninclude \"shared.thrift\"\n\nnamespace java com.uber.cadence.matching\n\nstruct PollForDecisionTaskRequest {\n 10: optional string domainUUID\n 15: optional string pollerID\n 20: optional shared.PollForDecisionTaskRequest pollRequest\n}\n\nstruct PollForDecisionTaskResponse {\n 10: optional binary taskToken\n 20: optional shared.WorkflowExecution workflowExecution\n 30: optional shared.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 60: optional i64 (js.type = \"Long\") nextEventId\n 65: optional i64 (js.type = \"Long\") backlogCountHint\n 70: optional bool stickyExecutionEnabled\n 80: optional shared.WorkflowQuery query\n 90: optional shared.TransientDecisionInfo decisionInfo\n}\n\nstruct PollForActivityTaskRequest {\n 10: optional string domainUUID\n 15: optional string pollerID\n 20: optional shared.PollForActivityTaskRequest pollRequest\n}\n\nstruct AddDecisionTaskRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional shared.TaskList taskList\n 40: optional i64 (js.type = \"Long\") scheduleId\n 50: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct AddActivityTaskRequest {\n 10: optional string domainUUID\n 20: optional shared.WorkflowExecution execution\n 30: optional string sourceDomainUUID\n 40: optional shared.TaskList taskList\n 50: optional i64 (js.type = \"Long\") scheduleId\n 60: optional i32 scheduleToStartTimeoutSeconds\n}\n\nstruct QueryWorkflowRequest {\n 10: optional string domainUUID\n 20: optional shared.TaskList taskList\n 30: optional shared.QueryWorkflowRequest queryRequest\n}\n\nstruct RespondQueryTaskCompletedRequest {\n 10: optional string domainUUID\n 20: optional shared.TaskList taskList\n 30: optional string taskID\n 40: optional shared.RespondQueryTaskCompletedRequest completedRequest\n}\n\nstruct CancelOutstandingPollRequest {\n 10: optional string domainUUID\n 20: optional i32 taskListType\n 30: optional shared.TaskList taskList\n 40: optional string pollerID\n}\n\nstruct DescribeTaskListRequest {\n 10: optional string domainUUID\n 20: optional shared.DescribeTaskListRequest descRequest\n}\n\n/**\n* MatchingService API is exposed to provide support for polling from long running applications.\n* Such applications are expected to have a worker which regularly polls for DecisionTask and ActivityTask. For each\n* DecisionTask, application is expected to process the history of events for that session and respond back with next\n* decisions. For each ActivityTask, application is expected to execute the actual logic for that task and respond back\n* with completion or failure.\n**/\nservice MatchingService {\n /**\n * PollForDecisionTask is called by frontend to process DecisionTask from a specific taskList. A\n * DecisionTask is dispatched to callers for active workflow executions, with pending decisions.\n **/\n PollForDecisionTaskResponse PollForDecisionTask(1: PollForDecisionTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n )\n\n /**\n * PollForActivityTask is called by frontend to process ActivityTask from a specific taskList. ActivityTask\n * is dispatched to callers whenever a ScheduleTask decision is made for a workflow execution.\n **/\n shared.PollForActivityTaskResponse PollForActivityTask(1: PollForActivityTaskRequest pollRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n )\n\n /**\n * AddDecisionTask is called by the history service when a decision task is scheduled, so that it can be dispatched\n * by the MatchingEngine.\n **/\n void AddDecisionTask(1: AddDecisionTaskRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * AddActivityTask is called by the history service when a decision task is scheduled, so that it can be dispatched\n * by the MatchingEngine.\n **/\n void AddActivityTask(1: AddActivityTaskRequest addRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.ServiceBusyError serviceBusyError,\n )\n\n /**\n * QueryWorkflow is called by frontend to query a workflow.\n **/\n shared.QueryWorkflowResponse QueryWorkflow(1: QueryWorkflowRequest queryRequest)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n 4: shared.QueryFailedError queryFailedError,\n )\n\n /**\n * RespondQueryTaskCompleted is called by frontend to respond query completed.\n **/\n void RespondQueryTaskCompleted(1: RespondQueryTaskCompletedRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n\n /**\n * CancelOutstandingPoll is called by frontend to unblock long polls on matching for zombie pollers.\n * Our rpc stack does not support context propagation, so when a client connection goes away frontend sees\n * cancellation of context for that handler, but any corresponding calls (long-poll) to matching service does not\n * see the cancellation propagated so it can unblock corresponding long-polls on its end. This results is tasks\n * being dispatched to zombie pollers in this situation. This API is added so everytime frontend makes a long-poll\n * api call to matching it passes in a pollerID and then calls this API when it detects client connection is closed\n * to unblock long polls for this poller and prevent tasks being sent to these zombie pollers.\n **/\n void CancelOutstandingPoll(1: CancelOutstandingPollRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n )\n\n /**\n * DescribeTaskList returns information about the target tasklist, right now this API returns the\n * pollers which polled this tasklist in last few minutes.\n **/\n shared.DescribeTaskListResponse DescribeTaskList(1: DescribeTaskListRequest request)\n throws (\n 1: shared.BadRequestError badRequestError,\n 2: shared.InternalServiceError internalServiceError,\n 3: shared.EntityNotExistsError entityNotExistError,\n )\n}\n" diff --git a/.gen/go/matching/matchingservice_getpollerhistory.go b/.gen/go/matching/matchingservice_describetasklist.go similarity index 67% rename from .gen/go/matching/matchingservice_getpollerhistory.go rename to .gen/go/matching/matchingservice_describetasklist.go index 903d73007c0..d420a8cb369 100644 --- a/.gen/go/matching/matchingservice_getpollerhistory.go +++ b/.gen/go/matching/matchingservice_describetasklist.go @@ -31,14 +31,14 @@ import ( "strings" ) -// MatchingService_GetPollerHistory_Args represents the arguments for the MatchingService.GetPollerHistory function. +// MatchingService_DescribeTaskList_Args represents the arguments for the MatchingService.DescribeTaskList function. // -// The arguments for GetPollerHistory are sent and received over the wire as this struct. -type MatchingService_GetPollerHistory_Args struct { - Request *GetPollerHistoryRequest `json:"request,omitempty"` +// The arguments for DescribeTaskList are sent and received over the wire as this struct. +type MatchingService_DescribeTaskList_Args struct { + Request *DescribeTaskListRequest `json:"request,omitempty"` } -// ToWire translates a MatchingService_GetPollerHistory_Args struct into a Thrift-level intermediate +// ToWire translates a MatchingService_DescribeTaskList_Args struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -53,7 +53,7 @@ type MatchingService_GetPollerHistory_Args struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *MatchingService_GetPollerHistory_Args) ToWire() (wire.Value, error) { +func (v *MatchingService_DescribeTaskList_Args) ToWire() (wire.Value, error) { var ( fields [1]wire.Field i int = 0 @@ -73,17 +73,17 @@ func (v *MatchingService_GetPollerHistory_Args) ToWire() (wire.Value, error) { return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -func _GetPollerHistoryRequest_1_Read(w wire.Value) (*GetPollerHistoryRequest, error) { - var v GetPollerHistoryRequest +func _DescribeTaskListRequest_1_Read(w wire.Value) (*DescribeTaskListRequest, error) { + var v DescribeTaskListRequest err := v.FromWire(w) return &v, err } -// FromWire deserializes a MatchingService_GetPollerHistory_Args struct from its Thrift-level +// FromWire deserializes a MatchingService_DescribeTaskList_Args 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 MatchingService_GetPollerHistory_Args struct +// An error is returned if we were unable to build a MatchingService_DescribeTaskList_Args struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -91,19 +91,19 @@ func _GetPollerHistoryRequest_1_Read(w wire.Value) (*GetPollerHistoryRequest, er // return nil, err // } // -// var v MatchingService_GetPollerHistory_Args +// var v MatchingService_DescribeTaskList_Args // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *MatchingService_GetPollerHistory_Args) FromWire(w wire.Value) error { +func (v *MatchingService_DescribeTaskList_Args) FromWire(w wire.Value) error { var err error for _, field := range w.GetStruct().Fields { switch field.ID { case 1: if field.Value.Type() == wire.TStruct { - v.Request, err = _GetPollerHistoryRequest_1_Read(field.Value) + v.Request, err = _DescribeTaskListRequest_1_Read(field.Value) if err != nil { return err } @@ -115,9 +115,9 @@ func (v *MatchingService_GetPollerHistory_Args) FromWire(w wire.Value) error { return nil } -// String returns a readable string representation of a MatchingService_GetPollerHistory_Args +// String returns a readable string representation of a MatchingService_DescribeTaskList_Args // struct. -func (v *MatchingService_GetPollerHistory_Args) String() string { +func (v *MatchingService_DescribeTaskList_Args) String() string { if v == nil { return "" } @@ -129,14 +129,14 @@ func (v *MatchingService_GetPollerHistory_Args) String() string { i++ } - return fmt.Sprintf("MatchingService_GetPollerHistory_Args{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("MatchingService_DescribeTaskList_Args{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this MatchingService_GetPollerHistory_Args match the -// provided MatchingService_GetPollerHistory_Args. +// Equals returns true if all the fields of this MatchingService_DescribeTaskList_Args match the +// provided MatchingService_DescribeTaskList_Args. // // This function performs a deep comparison. -func (v *MatchingService_GetPollerHistory_Args) Equals(rhs *MatchingService_GetPollerHistory_Args) bool { +func (v *MatchingService_DescribeTaskList_Args) Equals(rhs *MatchingService_DescribeTaskList_Args) bool { if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) { return false } @@ -147,73 +147,73 @@ func (v *MatchingService_GetPollerHistory_Args) Equals(rhs *MatchingService_GetP // MethodName returns the name of the Thrift function as specified in // the IDL, for which this struct represent the arguments. // -// This will always be "GetPollerHistory" for this struct. -func (v *MatchingService_GetPollerHistory_Args) MethodName() string { - return "GetPollerHistory" +// This will always be "DescribeTaskList" for this struct. +func (v *MatchingService_DescribeTaskList_Args) MethodName() string { + return "DescribeTaskList" } // EnvelopeType returns the kind of value inside this struct. // // This will always be Call for this struct. -func (v *MatchingService_GetPollerHistory_Args) EnvelopeType() wire.EnvelopeType { +func (v *MatchingService_DescribeTaskList_Args) EnvelopeType() wire.EnvelopeType { return wire.Call } -// MatchingService_GetPollerHistory_Helper provides functions that aid in handling the -// parameters and return values of the MatchingService.GetPollerHistory +// MatchingService_DescribeTaskList_Helper provides functions that aid in handling the +// parameters and return values of the MatchingService.DescribeTaskList // function. -var MatchingService_GetPollerHistory_Helper = struct { - // Args accepts the parameters of GetPollerHistory in-order and returns +var MatchingService_DescribeTaskList_Helper = struct { + // Args accepts the parameters of DescribeTaskList in-order and returns // the arguments struct for the function. Args func( - request *GetPollerHistoryRequest, - ) *MatchingService_GetPollerHistory_Args + request *DescribeTaskListRequest, + ) *MatchingService_DescribeTaskList_Args // IsException returns true if the given error can be thrown - // by GetPollerHistory. + // by DescribeTaskList. // - // An error can be thrown by GetPollerHistory only if the + // An error can be thrown by DescribeTaskList only if the // corresponding exception type was mentioned in the 'throws' // section for it in the Thrift file. IsException func(error) bool - // WrapResponse returns the result struct for GetPollerHistory + // WrapResponse returns the result struct for DescribeTaskList // given its return value and error. // // This allows mapping values and errors returned by - // GetPollerHistory into a serializable result struct. + // DescribeTaskList into a serializable result struct. // WrapResponse returns a non-nil error if the provided - // error cannot be thrown by GetPollerHistory + // error cannot be thrown by DescribeTaskList // - // value, err := GetPollerHistory(args) - // result, err := MatchingService_GetPollerHistory_Helper.WrapResponse(value, err) + // value, err := DescribeTaskList(args) + // result, err := MatchingService_DescribeTaskList_Helper.WrapResponse(value, err) // if err != nil { - // return fmt.Errorf("unexpected error from GetPollerHistory: %v", err) + // return fmt.Errorf("unexpected error from DescribeTaskList: %v", err) // } // serialize(result) - WrapResponse func(*shared.GetPollerHistoryResponse, error) (*MatchingService_GetPollerHistory_Result, error) + WrapResponse func(*shared.DescribeTaskListResponse, error) (*MatchingService_DescribeTaskList_Result, error) - // UnwrapResponse takes the result struct for GetPollerHistory + // UnwrapResponse takes the result struct for DescribeTaskList // and returns the value or error returned by it. // - // The error is non-nil only if GetPollerHistory threw an + // The error is non-nil only if DescribeTaskList threw an // exception. // // result := deserialize(bytes) - // value, err := MatchingService_GetPollerHistory_Helper.UnwrapResponse(result) - UnwrapResponse func(*MatchingService_GetPollerHistory_Result) (*shared.GetPollerHistoryResponse, error) + // value, err := MatchingService_DescribeTaskList_Helper.UnwrapResponse(result) + UnwrapResponse func(*MatchingService_DescribeTaskList_Result) (*shared.DescribeTaskListResponse, error) }{} func init() { - MatchingService_GetPollerHistory_Helper.Args = func( - request *GetPollerHistoryRequest, - ) *MatchingService_GetPollerHistory_Args { - return &MatchingService_GetPollerHistory_Args{ + MatchingService_DescribeTaskList_Helper.Args = func( + request *DescribeTaskListRequest, + ) *MatchingService_DescribeTaskList_Args { + return &MatchingService_DescribeTaskList_Args{ Request: request, } } - MatchingService_GetPollerHistory_Helper.IsException = func(err error) bool { + MatchingService_DescribeTaskList_Helper.IsException = func(err error) bool { switch err.(type) { case *shared.BadRequestError: return true @@ -226,32 +226,32 @@ func init() { } } - MatchingService_GetPollerHistory_Helper.WrapResponse = func(success *shared.GetPollerHistoryResponse, err error) (*MatchingService_GetPollerHistory_Result, error) { + MatchingService_DescribeTaskList_Helper.WrapResponse = func(success *shared.DescribeTaskListResponse, err error) (*MatchingService_DescribeTaskList_Result, error) { if err == nil { - return &MatchingService_GetPollerHistory_Result{Success: success}, nil + return &MatchingService_DescribeTaskList_Result{Success: success}, nil } switch e := err.(type) { case *shared.BadRequestError: if e == nil { - return nil, errors.New("WrapResponse received non-nil error type with nil value for MatchingService_GetPollerHistory_Result.BadRequestError") + return nil, errors.New("WrapResponse received non-nil error type with nil value for MatchingService_DescribeTaskList_Result.BadRequestError") } - return &MatchingService_GetPollerHistory_Result{BadRequestError: e}, nil + return &MatchingService_DescribeTaskList_Result{BadRequestError: e}, nil case *shared.InternalServiceError: if e == nil { - return nil, errors.New("WrapResponse received non-nil error type with nil value for MatchingService_GetPollerHistory_Result.InternalServiceError") + return nil, errors.New("WrapResponse received non-nil error type with nil value for MatchingService_DescribeTaskList_Result.InternalServiceError") } - return &MatchingService_GetPollerHistory_Result{InternalServiceError: e}, nil + return &MatchingService_DescribeTaskList_Result{InternalServiceError: e}, nil case *shared.EntityNotExistsError: if e == nil { - return nil, errors.New("WrapResponse received non-nil error type with nil value for MatchingService_GetPollerHistory_Result.EntityNotExistError") + return nil, errors.New("WrapResponse received non-nil error type with nil value for MatchingService_DescribeTaskList_Result.EntityNotExistError") } - return &MatchingService_GetPollerHistory_Result{EntityNotExistError: e}, nil + return &MatchingService_DescribeTaskList_Result{EntityNotExistError: e}, nil } return nil, err } - MatchingService_GetPollerHistory_Helper.UnwrapResponse = func(result *MatchingService_GetPollerHistory_Result) (success *shared.GetPollerHistoryResponse, err error) { + MatchingService_DescribeTaskList_Helper.UnwrapResponse = func(result *MatchingService_DescribeTaskList_Result) (success *shared.DescribeTaskListResponse, err error) { if result.BadRequestError != nil { err = result.BadRequestError return @@ -276,20 +276,20 @@ func init() { } -// MatchingService_GetPollerHistory_Result represents the result of a MatchingService.GetPollerHistory function call. +// MatchingService_DescribeTaskList_Result represents the result of a MatchingService.DescribeTaskList function call. // -// The result of a GetPollerHistory execution is sent and received over the wire as this struct. +// The result of a DescribeTaskList execution is sent and received over the wire as this struct. // // Success is set only if the function did not throw an exception. -type MatchingService_GetPollerHistory_Result struct { - // Value returned by GetPollerHistory after a successful execution. - Success *shared.GetPollerHistoryResponse `json:"success,omitempty"` +type MatchingService_DescribeTaskList_Result struct { + // Value returned by DescribeTaskList after a successful execution. + Success *shared.DescribeTaskListResponse `json:"success,omitempty"` BadRequestError *shared.BadRequestError `json:"badRequestError,omitempty"` InternalServiceError *shared.InternalServiceError `json:"internalServiceError,omitempty"` EntityNotExistError *shared.EntityNotExistsError `json:"entityNotExistError,omitempty"` } -// ToWire translates a MatchingService_GetPollerHistory_Result struct into a Thrift-level intermediate +// ToWire translates a MatchingService_DescribeTaskList_Result struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -304,7 +304,7 @@ type MatchingService_GetPollerHistory_Result struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *MatchingService_GetPollerHistory_Result) ToWire() (wire.Value, error) { +func (v *MatchingService_DescribeTaskList_Result) ToWire() (wire.Value, error) { var ( fields [4]wire.Field i int = 0 @@ -346,14 +346,14 @@ func (v *MatchingService_GetPollerHistory_Result) ToWire() (wire.Value, error) { } if i != 1 { - return wire.Value{}, fmt.Errorf("MatchingService_GetPollerHistory_Result should have exactly one field: got %v fields", i) + return wire.Value{}, fmt.Errorf("MatchingService_DescribeTaskList_Result should have exactly one field: got %v fields", i) } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -func _GetPollerHistoryResponse_Read(w wire.Value) (*shared.GetPollerHistoryResponse, error) { - var v shared.GetPollerHistoryResponse +func _DescribeTaskListResponse_Read(w wire.Value) (*shared.DescribeTaskListResponse, error) { + var v shared.DescribeTaskListResponse err := v.FromWire(w) return &v, err } @@ -364,11 +364,11 @@ func _EntityNotExistsError_Read(w wire.Value) (*shared.EntityNotExistsError, err return &v, err } -// FromWire deserializes a MatchingService_GetPollerHistory_Result struct from its Thrift-level +// FromWire deserializes a MatchingService_DescribeTaskList_Result 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 MatchingService_GetPollerHistory_Result struct +// An error is returned if we were unable to build a MatchingService_DescribeTaskList_Result struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -376,19 +376,19 @@ func _EntityNotExistsError_Read(w wire.Value) (*shared.EntityNotExistsError, err // return nil, err // } // -// var v MatchingService_GetPollerHistory_Result +// var v MatchingService_DescribeTaskList_Result // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *MatchingService_GetPollerHistory_Result) FromWire(w wire.Value) error { +func (v *MatchingService_DescribeTaskList_Result) FromWire(w wire.Value) error { var err error for _, field := range w.GetStruct().Fields { switch field.ID { case 0: if field.Value.Type() == wire.TStruct { - v.Success, err = _GetPollerHistoryResponse_Read(field.Value) + v.Success, err = _DescribeTaskListResponse_Read(field.Value) if err != nil { return err } @@ -435,15 +435,15 @@ func (v *MatchingService_GetPollerHistory_Result) FromWire(w wire.Value) error { count++ } if count != 1 { - return fmt.Errorf("MatchingService_GetPollerHistory_Result should have exactly one field: got %v fields", count) + return fmt.Errorf("MatchingService_DescribeTaskList_Result should have exactly one field: got %v fields", count) } return nil } -// String returns a readable string representation of a MatchingService_GetPollerHistory_Result +// String returns a readable string representation of a MatchingService_DescribeTaskList_Result // struct. -func (v *MatchingService_GetPollerHistory_Result) String() string { +func (v *MatchingService_DescribeTaskList_Result) String() string { if v == nil { return "" } @@ -467,14 +467,14 @@ func (v *MatchingService_GetPollerHistory_Result) String() string { i++ } - return fmt.Sprintf("MatchingService_GetPollerHistory_Result{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("MatchingService_DescribeTaskList_Result{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this MatchingService_GetPollerHistory_Result match the -// provided MatchingService_GetPollerHistory_Result. +// Equals returns true if all the fields of this MatchingService_DescribeTaskList_Result match the +// provided MatchingService_DescribeTaskList_Result. // // This function performs a deep comparison. -func (v *MatchingService_GetPollerHistory_Result) Equals(rhs *MatchingService_GetPollerHistory_Result) bool { +func (v *MatchingService_DescribeTaskList_Result) Equals(rhs *MatchingService_DescribeTaskList_Result) bool { if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) { return false } @@ -494,14 +494,14 @@ func (v *MatchingService_GetPollerHistory_Result) Equals(rhs *MatchingService_Ge // MethodName returns the name of the Thrift function as specified in // the IDL, for which this struct represent the result. // -// This will always be "GetPollerHistory" for this struct. -func (v *MatchingService_GetPollerHistory_Result) MethodName() string { - return "GetPollerHistory" +// This will always be "DescribeTaskList" for this struct. +func (v *MatchingService_DescribeTaskList_Result) MethodName() string { + return "DescribeTaskList" } // EnvelopeType returns the kind of value inside this struct. // // This will always be Reply for this struct. -func (v *MatchingService_GetPollerHistory_Result) EnvelopeType() wire.EnvelopeType { +func (v *MatchingService_DescribeTaskList_Result) EnvelopeType() wire.EnvelopeType { return wire.Reply } diff --git a/.gen/go/matching/matchingserviceclient/client.go b/.gen/go/matching/matchingserviceclient/client.go index 05debbc41f4..aca632218bf 100644 --- a/.gen/go/matching/matchingserviceclient/client.go +++ b/.gen/go/matching/matchingserviceclient/client.go @@ -54,11 +54,11 @@ type Interface interface { opts ...yarpc.CallOption, ) error - GetPollerHistory( + DescribeTaskList( ctx context.Context, - Request *matching.GetPollerHistoryRequest, + Request *matching.DescribeTaskListRequest, opts ...yarpc.CallOption, - ) (*shared.GetPollerHistoryResponse, error) + ) (*shared.DescribeTaskListResponse, error) PollForActivityTask( ctx context.Context, @@ -178,13 +178,13 @@ func (c client) CancelOutstandingPoll( return } -func (c client) GetPollerHistory( +func (c client) DescribeTaskList( ctx context.Context, - _Request *matching.GetPollerHistoryRequest, + _Request *matching.DescribeTaskListRequest, opts ...yarpc.CallOption, -) (success *shared.GetPollerHistoryResponse, err error) { +) (success *shared.DescribeTaskListResponse, err error) { - args := matching.MatchingService_GetPollerHistory_Helper.Args(_Request) + args := matching.MatchingService_DescribeTaskList_Helper.Args(_Request) var body wire.Value body, err = c.c.Call(ctx, args, opts...) @@ -192,12 +192,12 @@ func (c client) GetPollerHistory( return } - var result matching.MatchingService_GetPollerHistory_Result + var result matching.MatchingService_DescribeTaskList_Result if err = result.FromWire(body); err != nil { return } - success, err = matching.MatchingService_GetPollerHistory_Helper.UnwrapResponse(&result) + success, err = matching.MatchingService_DescribeTaskList_Helper.UnwrapResponse(&result) return } diff --git a/.gen/go/matching/matchingserviceserver/server.go b/.gen/go/matching/matchingserviceserver/server.go index 87879a5f490..a1071325c75 100644 --- a/.gen/go/matching/matchingserviceserver/server.go +++ b/.gen/go/matching/matchingserviceserver/server.go @@ -49,10 +49,10 @@ type Interface interface { Request *matching.CancelOutstandingPollRequest, ) error - GetPollerHistory( + DescribeTaskList( ctx context.Context, - Request *matching.GetPollerHistoryRequest, - ) (*shared.GetPollerHistoryResponse, error) + Request *matching.DescribeTaskListRequest, + ) (*shared.DescribeTaskListResponse, error) PollForActivityTask( ctx context.Context, @@ -120,13 +120,13 @@ func New(impl Interface, opts ...thrift.RegisterOption) []transport.Procedure { }, thrift.Method{ - Name: "GetPollerHistory", + Name: "DescribeTaskList", HandlerSpec: thrift.HandlerSpec{ Type: transport.Unary, - Unary: thrift.UnaryHandler(h.GetPollerHistory), + Unary: thrift.UnaryHandler(h.DescribeTaskList), }, - Signature: "GetPollerHistory(Request *matching.GetPollerHistoryRequest) (*shared.GetPollerHistoryResponse)", + Signature: "DescribeTaskList(Request *matching.DescribeTaskListRequest) (*shared.DescribeTaskListResponse)", ThriftModule: matching.ThriftModule, }, @@ -240,16 +240,16 @@ func (h handler) CancelOutstandingPoll(ctx context.Context, body wire.Value) (th return response, err } -func (h handler) GetPollerHistory(ctx context.Context, body wire.Value) (thrift.Response, error) { - var args matching.MatchingService_GetPollerHistory_Args +func (h handler) DescribeTaskList(ctx context.Context, body wire.Value) (thrift.Response, error) { + var args matching.MatchingService_DescribeTaskList_Args if err := args.FromWire(body); err != nil { return thrift.Response{}, err } - success, err := h.impl.GetPollerHistory(ctx, args.Request) + success, err := h.impl.DescribeTaskList(ctx, args.Request) hadError := err != nil - result, err := matching.MatchingService_GetPollerHistory_Helper.WrapResponse(success, err) + result, err := matching.MatchingService_DescribeTaskList_Helper.WrapResponse(success, err) var response thrift.Response if err == nil { diff --git a/.gen/go/matching/matchingservicetest/client.go b/.gen/go/matching/matchingservicetest/client.go index f5fee34fe30..b2325447b61 100644 --- a/.gen/go/matching/matchingservicetest/client.go +++ b/.gen/go/matching/matchingservicetest/client.go @@ -156,37 +156,37 @@ func (mr *_MockClientRecorder) CancelOutstandingPoll( return mr.mock.ctrl.RecordCall(mr.mock, "CancelOutstandingPoll", args...) } -// GetPollerHistory responds to a GetPollerHistory call based on the mock expectations. This +// DescribeTaskList responds to a DescribeTaskList call based on the mock expectations. This // call will fail if the mock does not expect this call. Use EXPECT to expect // a call to this function. // -// client.EXPECT().GetPollerHistory(gomock.Any(), ...).Return(...) -// ... := client.GetPollerHistory(...) -func (m *MockClient) GetPollerHistory( +// client.EXPECT().DescribeTaskList(gomock.Any(), ...).Return(...) +// ... := client.DescribeTaskList(...) +func (m *MockClient) DescribeTaskList( ctx context.Context, - _Request *matching.GetPollerHistoryRequest, + _Request *matching.DescribeTaskListRequest, opts ...yarpc.CallOption, -) (success *shared.GetPollerHistoryResponse, err error) { +) (success *shared.DescribeTaskListResponse, err error) { args := []interface{}{ctx, _Request} for _, o := range opts { args = append(args, o) } i := 0 - ret := m.ctrl.Call(m, "GetPollerHistory", args...) - success, _ = ret[i].(*shared.GetPollerHistoryResponse) + ret := m.ctrl.Call(m, "DescribeTaskList", args...) + success, _ = ret[i].(*shared.DescribeTaskListResponse) i++ err, _ = ret[i].(error) return } -func (mr *_MockClientRecorder) GetPollerHistory( +func (mr *_MockClientRecorder) DescribeTaskList( ctx interface{}, _Request interface{}, opts ...interface{}, ) *gomock.Call { args := append([]interface{}{ctx, _Request}, opts...) - return mr.mock.ctrl.RecordCall(mr.mock, "GetPollerHistory", args...) + return mr.mock.ctrl.RecordCall(mr.mock, "DescribeTaskList", args...) } // PollForActivityTask responds to a PollForActivityTask call based on the mock expectations. This diff --git a/.gen/go/matching/types.go b/.gen/go/matching/types.go index 1df0bd6db3c..63ac6d416ca 100644 --- a/.gen/go/matching/types.go +++ b/.gen/go/matching/types.go @@ -793,12 +793,12 @@ func (v *CancelOutstandingPollRequest) GetPollerID() (o string) { return } -type GetPollerHistoryRequest struct { - DomainUUID *string `json:"domainUUID,omitempty"` - GetRequest *shared.GetPollerHistoryRequest `json:"getRequest,omitempty"` +type DescribeTaskListRequest struct { + DomainUUID *string `json:"domainUUID,omitempty"` + DescRequest *shared.DescribeTaskListRequest `json:"descRequest,omitempty"` } -// ToWire translates a GetPollerHistoryRequest struct into a Thrift-level intermediate +// ToWire translates a DescribeTaskListRequest struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -813,7 +813,7 @@ type GetPollerHistoryRequest struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *GetPollerHistoryRequest) ToWire() (wire.Value, error) { +func (v *DescribeTaskListRequest) ToWire() (wire.Value, error) { var ( fields [2]wire.Field i int = 0 @@ -829,8 +829,8 @@ func (v *GetPollerHistoryRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 10, Value: w} i++ } - if v.GetRequest != nil { - w, err = v.GetRequest.ToWire() + if v.DescRequest != nil { + w, err = v.DescRequest.ToWire() if err != nil { return w, err } @@ -841,17 +841,17 @@ func (v *GetPollerHistoryRequest) ToWire() (wire.Value, error) { return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -func _GetPollerHistoryRequest_Read(w wire.Value) (*shared.GetPollerHistoryRequest, error) { - var v shared.GetPollerHistoryRequest +func _DescribeTaskListRequest_Read(w wire.Value) (*shared.DescribeTaskListRequest, error) { + var v shared.DescribeTaskListRequest err := v.FromWire(w) return &v, err } -// FromWire deserializes a GetPollerHistoryRequest struct from its Thrift-level +// FromWire deserializes a DescribeTaskListRequest 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 GetPollerHistoryRequest struct +// An error is returned if we were unable to build a DescribeTaskListRequest struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -859,12 +859,12 @@ func _GetPollerHistoryRequest_Read(w wire.Value) (*shared.GetPollerHistoryReques // return nil, err // } // -// var v GetPollerHistoryRequest +// var v DescribeTaskListRequest // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *GetPollerHistoryRequest) FromWire(w wire.Value) error { +func (v *DescribeTaskListRequest) FromWire(w wire.Value) error { var err error for _, field := range w.GetStruct().Fields { @@ -881,7 +881,7 @@ func (v *GetPollerHistoryRequest) FromWire(w wire.Value) error { } case 20: if field.Value.Type() == wire.TStruct { - v.GetRequest, err = _GetPollerHistoryRequest_Read(field.Value) + v.DescRequest, err = _DescribeTaskListRequest_Read(field.Value) if err != nil { return err } @@ -893,9 +893,9 @@ func (v *GetPollerHistoryRequest) FromWire(w wire.Value) error { return nil } -// String returns a readable string representation of a GetPollerHistoryRequest +// String returns a readable string representation of a DescribeTaskListRequest // struct. -func (v *GetPollerHistoryRequest) String() string { +func (v *DescribeTaskListRequest) String() string { if v == nil { return "" } @@ -906,23 +906,23 @@ func (v *GetPollerHistoryRequest) String() string { fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID)) i++ } - if v.GetRequest != nil { - fields[i] = fmt.Sprintf("GetRequest: %v", v.GetRequest) + if v.DescRequest != nil { + fields[i] = fmt.Sprintf("DescRequest: %v", v.DescRequest) i++ } - return fmt.Sprintf("GetPollerHistoryRequest{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("DescribeTaskListRequest{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this GetPollerHistoryRequest match the -// provided GetPollerHistoryRequest. +// Equals returns true if all the fields of this DescribeTaskListRequest match the +// provided DescribeTaskListRequest. // // This function performs a deep comparison. -func (v *GetPollerHistoryRequest) Equals(rhs *GetPollerHistoryRequest) bool { +func (v *DescribeTaskListRequest) Equals(rhs *DescribeTaskListRequest) bool { if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) { return false } - if !((v.GetRequest == nil && rhs.GetRequest == nil) || (v.GetRequest != nil && rhs.GetRequest != nil && v.GetRequest.Equals(rhs.GetRequest))) { + if !((v.DescRequest == nil && rhs.DescRequest == nil) || (v.DescRequest != nil && rhs.DescRequest != nil && v.DescRequest.Equals(rhs.DescRequest))) { return false } @@ -931,7 +931,7 @@ func (v *GetPollerHistoryRequest) Equals(rhs *GetPollerHistoryRequest) bool { // GetDomainUUID returns the value of DomainUUID if it is set or its // zero value if it is unset. -func (v *GetPollerHistoryRequest) GetDomainUUID() (o string) { +func (v *DescribeTaskListRequest) GetDomainUUID() (o string) { if v.DomainUUID != nil { return *v.DomainUUID } diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index fb97be53967..a1b6ff2dc44 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "github.com/uber/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "c8e3b24f64d226104d5dbcd6ece100a756e869d5", + SHA1: "16e6a5553742142373900f3ff51dcae8c8b38fa4", 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\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\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}\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}\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}\n\nenum CancelExternalWorkflowExecutionFailedCause {\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\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}\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 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}\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}\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}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\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}\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}\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}\n\nstruct WorkflowExecutionStartedEventAttributes {\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 string identity\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\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}\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}\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}\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}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\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}\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}\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 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}\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 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}\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}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\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}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\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}\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}\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}\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}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: 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 domainID\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 domainID\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 domainID\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}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\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}\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 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 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 DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n\nstruct GetPollerHistoryRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n}\n\nstruct GetPollerHistoryResponse {\n 10: optional list pollers\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 // ISO 8601 format\n 10: optional string timestamp\n 20: optional string identity\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\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\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}\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}\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}\n\nenum CancelExternalWorkflowExecutionFailedCause {\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\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}\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 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}\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}\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}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\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}\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}\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}\n\nstruct WorkflowExecutionStartedEventAttributes {\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 string identity\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\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}\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}\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}\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}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\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}\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}\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 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}\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 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}\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}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\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}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\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}\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}\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}\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}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: 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 domainID\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 domainID\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 domainID\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}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\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}\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 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 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 DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n\nstruct DescribeTaskListRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n}\n\nstruct DescribeTaskListResponse {\n 10: optional list pollers\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\") timestamp\n 20: optional string identity\n}\n" diff --git a/.gen/go/shared/types.go b/.gen/go/shared/types.go index 9380dae7afb..36cb547d27d 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -7092,12 +7092,13 @@ func (v *DescribeDomainResponse) Equals(rhs *DescribeDomainResponse) bool { return true } -type DescribeWorkflowExecutionRequest struct { - Domain *string `json:"domain,omitempty"` - Execution *WorkflowExecution `json:"execution,omitempty"` +type DescribeTaskListRequest struct { + Domain *string `json:"domain,omitempty"` + TaskList *TaskList `json:"taskList,omitempty"` + TaskListType *TaskListType `json:"taskListType,omitempty"` } -// ToWire translates a DescribeWorkflowExecutionRequest struct into a Thrift-level intermediate +// ToWire translates a DescribeTaskListRequest struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -7112,9 +7113,9 @@ type DescribeWorkflowExecutionRequest struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *DescribeWorkflowExecutionRequest) ToWire() (wire.Value, error) { +func (v *DescribeTaskListRequest) ToWire() (wire.Value, error) { var ( - fields [2]wire.Field + fields [3]wire.Field i int = 0 w wire.Value err error @@ -7128,23 +7129,37 @@ func (v *DescribeWorkflowExecutionRequest) ToWire() (wire.Value, error) { fields[i] = wire.Field{ID: 10, Value: w} i++ } - if v.Execution != nil { - w, err = v.Execution.ToWire() + if v.TaskList != nil { + w, err = v.TaskList.ToWire() if err != nil { return w, err } fields[i] = wire.Field{ID: 20, Value: w} i++ } + if v.TaskListType != nil { + w, err = v.TaskListType.ToWire() + 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 DescribeWorkflowExecutionRequest struct from its Thrift-level +func _TaskListType_Read(w wire.Value) (TaskListType, error) { + var v TaskListType + err := v.FromWire(w) + return v, err +} + +// FromWire deserializes a DescribeTaskListRequest 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 DescribeWorkflowExecutionRequest struct +// An error is returned if we were unable to build a DescribeTaskListRequest struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -7152,12 +7167,12 @@ func (v *DescribeWorkflowExecutionRequest) ToWire() (wire.Value, error) { // return nil, err // } // -// var v DescribeWorkflowExecutionRequest +// var v DescribeTaskListRequest // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *DescribeWorkflowExecutionRequest) FromWire(w wire.Value) error { +func (v *DescribeTaskListRequest) FromWire(w wire.Value) error { var err error for _, field := range w.GetStruct().Fields { @@ -7174,7 +7189,17 @@ func (v *DescribeWorkflowExecutionRequest) FromWire(w wire.Value) error { } case 20: if field.Value.Type() == wire.TStruct { - v.Execution, err = _WorkflowExecution_Read(field.Value) + v.TaskList, err = _TaskList_Read(field.Value) + if err != nil { + return err + } + + } + case 30: + if field.Value.Type() == wire.TI32 { + var x TaskListType + x, err = _TaskListType_Read(field.Value) + v.TaskListType = &x if err != nil { return err } @@ -7186,36 +7211,53 @@ func (v *DescribeWorkflowExecutionRequest) FromWire(w wire.Value) error { return nil } -// String returns a readable string representation of a DescribeWorkflowExecutionRequest +// String returns a readable string representation of a DescribeTaskListRequest // struct. -func (v *DescribeWorkflowExecutionRequest) String() string { +func (v *DescribeTaskListRequest) String() string { if v == nil { return "" } - var fields [2]string + var fields [3]string i := 0 if v.Domain != nil { fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) i++ } - if v.Execution != nil { - fields[i] = fmt.Sprintf("Execution: %v", v.Execution) + if v.TaskList != nil { + fields[i] = fmt.Sprintf("TaskList: %v", v.TaskList) + i++ + } + if v.TaskListType != nil { + fields[i] = fmt.Sprintf("TaskListType: %v", *(v.TaskListType)) i++ } - return fmt.Sprintf("DescribeWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("DescribeTaskListRequest{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this DescribeWorkflowExecutionRequest match the -// provided DescribeWorkflowExecutionRequest. +func _TaskListType_EqualsPtr(lhs, rhs *TaskListType) bool { + if lhs != nil && rhs != nil { + + x := *lhs + y := *rhs + return x.Equals(y) + } + return lhs == nil && rhs == nil +} + +// Equals returns true if all the fields of this DescribeTaskListRequest match the +// provided DescribeTaskListRequest. // // This function performs a deep comparison. -func (v *DescribeWorkflowExecutionRequest) Equals(rhs *DescribeWorkflowExecutionRequest) bool { +func (v *DescribeTaskListRequest) Equals(rhs *DescribeTaskListRequest) bool { if !_String_EqualsPtr(v.Domain, rhs.Domain) { return false } - if !((v.Execution == nil && rhs.Execution == nil) || (v.Execution != nil && rhs.Execution != nil && v.Execution.Equals(rhs.Execution))) { + if !((v.TaskList == nil && rhs.TaskList == nil) || (v.TaskList != nil && rhs.TaskList != nil && v.TaskList.Equals(rhs.TaskList))) { + return false + } + if !_TaskListType_EqualsPtr(v.TaskListType, rhs.TaskListType) { return false } @@ -7224,7 +7266,7 @@ func (v *DescribeWorkflowExecutionRequest) Equals(rhs *DescribeWorkflowExecution // GetDomain returns the value of Domain if it is set or its // zero value if it is unset. -func (v *DescribeWorkflowExecutionRequest) GetDomain() (o string) { +func (v *DescribeTaskListRequest) GetDomain() (o string) { if v.Domain != nil { return *v.Domain } @@ -7232,12 +7274,50 @@ func (v *DescribeWorkflowExecutionRequest) GetDomain() (o string) { return } -type DescribeWorkflowExecutionResponse struct { - ExecutionConfiguration *WorkflowExecutionConfiguration `json:"executionConfiguration,omitempty"` - WorkflowExecutionInfo *WorkflowExecutionInfo `json:"workflowExecutionInfo,omitempty"` +// GetTaskListType returns the value of TaskListType if it is set or its +// zero value if it is unset. +func (v *DescribeTaskListRequest) GetTaskListType() (o TaskListType) { + if v.TaskListType != nil { + return *v.TaskListType + } + + return } -// ToWire translates a DescribeWorkflowExecutionResponse struct into a Thrift-level intermediate +type DescribeTaskListResponse struct { + Pollers []*PollerInfo `json:"pollers,omitempty"` +} + +type _List_PollerInfo_ValueList []*PollerInfo + +func (v _List_PollerInfo_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_PollerInfo_ValueList) Size() int { + return len(v) +} + +func (_List_PollerInfo_ValueList) ValueType() wire.Type { + return wire.TStruct +} + +func (_List_PollerInfo_ValueList) Close() {} + +// ToWire translates a DescribeTaskListResponse struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -7252,51 +7332,55 @@ type DescribeWorkflowExecutionResponse struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *DescribeWorkflowExecutionResponse) ToWire() (wire.Value, error) { +func (v *DescribeTaskListResponse) ToWire() (wire.Value, error) { var ( - fields [2]wire.Field + fields [1]wire.Field i int = 0 w wire.Value err error ) - if v.ExecutionConfiguration != nil { - w, err = v.ExecutionConfiguration.ToWire() + if v.Pollers != nil { + w, err = wire.NewValueList(_List_PollerInfo_ValueList(v.Pollers)), error(nil) if err != nil { return w, err } fields[i] = wire.Field{ID: 10, Value: w} i++ } - if v.WorkflowExecutionInfo != nil { - w, err = v.WorkflowExecutionInfo.ToWire() - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 20, Value: w} - i++ - } return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -func _WorkflowExecutionConfiguration_Read(w wire.Value) (*WorkflowExecutionConfiguration, error) { - var v WorkflowExecutionConfiguration +func _PollerInfo_Read(w wire.Value) (*PollerInfo, error) { + var v PollerInfo err := v.FromWire(w) return &v, err } -func _WorkflowExecutionInfo_Read(w wire.Value) (*WorkflowExecutionInfo, error) { - var v WorkflowExecutionInfo - err := v.FromWire(w) - return &v, err +func _List_PollerInfo_Read(l wire.ValueList) ([]*PollerInfo, error) { + if l.ValueType() != wire.TStruct { + return nil, nil + } + + o := make([]*PollerInfo, 0, l.Size()) + err := l.ForEach(func(x wire.Value) error { + i, err := _PollerInfo_Read(x) + if err != nil { + return err + } + o = append(o, i) + return nil + }) + l.Close() + return o, err } -// FromWire deserializes a DescribeWorkflowExecutionResponse struct from its Thrift-level +// FromWire deserializes a DescribeTaskListResponse 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 DescribeWorkflowExecutionResponse struct +// An error is returned if we were unable to build a DescribeTaskListResponse struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -7304,27 +7388,19 @@ func _WorkflowExecutionInfo_Read(w wire.Value) (*WorkflowExecutionInfo, error) { // return nil, err // } // -// var v DescribeWorkflowExecutionResponse +// var v DescribeTaskListResponse // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *DescribeWorkflowExecutionResponse) FromWire(w wire.Value) error { +func (v *DescribeTaskListResponse) FromWire(w wire.Value) error { var err error for _, field := range w.GetStruct().Fields { switch field.ID { case 10: - if field.Value.Type() == wire.TStruct { - v.ExecutionConfiguration, err = _WorkflowExecutionConfiguration_Read(field.Value) - if err != nil { - return err - } - - } - case 20: - if field.Value.Type() == wire.TStruct { - v.WorkflowExecutionInfo, err = _WorkflowExecutionInfo_Read(field.Value) + if field.Value.Type() == wire.TList { + v.Pollers, err = _List_PollerInfo_Read(field.Value.GetList()) if err != nil { return err } @@ -7336,47 +7412,56 @@ func (v *DescribeWorkflowExecutionResponse) FromWire(w wire.Value) error { return nil } -// String returns a readable string representation of a DescribeWorkflowExecutionResponse +// String returns a readable string representation of a DescribeTaskListResponse // struct. -func (v *DescribeWorkflowExecutionResponse) String() string { +func (v *DescribeTaskListResponse) String() string { if v == nil { return "" } - var fields [2]string + var fields [1]string i := 0 - if v.ExecutionConfiguration != nil { - fields[i] = fmt.Sprintf("ExecutionConfiguration: %v", v.ExecutionConfiguration) + if v.Pollers != nil { + fields[i] = fmt.Sprintf("Pollers: %v", v.Pollers) i++ } - if v.WorkflowExecutionInfo != nil { - fields[i] = fmt.Sprintf("WorkflowExecutionInfo: %v", v.WorkflowExecutionInfo) - i++ + + return fmt.Sprintf("DescribeTaskListResponse{%v}", strings.Join(fields[:i], ", ")) +} + +func _List_PollerInfo_Equals(lhs, rhs []*PollerInfo) bool { + if len(lhs) != len(rhs) { + return false } - return fmt.Sprintf("DescribeWorkflowExecutionResponse{%v}", strings.Join(fields[:i], ", ")) + 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 DescribeWorkflowExecutionResponse match the -// provided DescribeWorkflowExecutionResponse. +// Equals returns true if all the fields of this DescribeTaskListResponse match the +// provided DescribeTaskListResponse. // // This function performs a deep comparison. -func (v *DescribeWorkflowExecutionResponse) Equals(rhs *DescribeWorkflowExecutionResponse) bool { - if !((v.ExecutionConfiguration == nil && rhs.ExecutionConfiguration == nil) || (v.ExecutionConfiguration != nil && rhs.ExecutionConfiguration != nil && v.ExecutionConfiguration.Equals(rhs.ExecutionConfiguration))) { - return false - } - if !((v.WorkflowExecutionInfo == nil && rhs.WorkflowExecutionInfo == nil) || (v.WorkflowExecutionInfo != nil && rhs.WorkflowExecutionInfo != nil && v.WorkflowExecutionInfo.Equals(rhs.WorkflowExecutionInfo))) { +func (v *DescribeTaskListResponse) Equals(rhs *DescribeTaskListResponse) bool { + if !((v.Pollers == nil && rhs.Pollers == nil) || (v.Pollers != nil && rhs.Pollers != nil && _List_PollerInfo_Equals(v.Pollers, rhs.Pollers))) { return false } return true } -type DomainAlreadyExistsError struct { - Message string `json:"message,required"` +type DescribeWorkflowExecutionRequest struct { + Domain *string `json:"domain,omitempty"` + Execution *WorkflowExecution `json:"execution,omitempty"` } -// ToWire translates a DomainAlreadyExistsError struct into a Thrift-level intermediate +// ToWire translates a DescribeWorkflowExecutionRequest struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -7391,29 +7476,39 @@ type DomainAlreadyExistsError struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *DomainAlreadyExistsError) ToWire() (wire.Value, error) { +func (v *DescribeWorkflowExecutionRequest) ToWire() (wire.Value, error) { var ( - fields [1]wire.Field + fields [2]wire.Field i int = 0 w wire.Value err error ) - w, err = wire.NewValueString(v.Message), error(nil) - if err != nil { - return w, err + 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.Execution != nil { + w, err = v.Execution.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 20, Value: w} + i++ } - fields[i] = wire.Field{ID: 1, Value: w} - i++ return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -// FromWire deserializes a DomainAlreadyExistsError struct from its Thrift-level +// FromWire deserializes a DescribeWorkflowExecutionRequest 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 DomainAlreadyExistsError struct +// An error is returned if we were unable to build a DescribeWorkflowExecutionRequest struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -7421,73 +7516,92 @@ func (v *DomainAlreadyExistsError) ToWire() (wire.Value, error) { // return nil, err // } // -// var v DomainAlreadyExistsError +// var v DescribeWorkflowExecutionRequest // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *DomainAlreadyExistsError) FromWire(w wire.Value) error { +func (v *DescribeWorkflowExecutionRequest) FromWire(w wire.Value) error { var err error - messageIsSet := false - for _, field := range w.GetStruct().Fields { switch field.ID { - case 1: + case 10: if field.Value.Type() == wire.TBinary { - v.Message, err = field.Value.GetString(), error(nil) + var x string + x, err = field.Value.GetString(), error(nil) + v.Domain = &x if err != nil { return err } - messageIsSet = true + } - } - } + case 20: + if field.Value.Type() == wire.TStruct { + v.Execution, err = _WorkflowExecution_Read(field.Value) + if err != nil { + return err + } - if !messageIsSet { - return errors.New("field Message of DomainAlreadyExistsError is required") + } + } } return nil } -// String returns a readable string representation of a DomainAlreadyExistsError +// String returns a readable string representation of a DescribeWorkflowExecutionRequest // struct. -func (v *DomainAlreadyExistsError) String() string { +func (v *DescribeWorkflowExecutionRequest) String() string { if v == nil { return "" } - var fields [1]string + var fields [2]string i := 0 - fields[i] = fmt.Sprintf("Message: %v", v.Message) - i++ + if v.Domain != nil { + fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) + i++ + } + if v.Execution != nil { + fields[i] = fmt.Sprintf("Execution: %v", v.Execution) + i++ + } - return fmt.Sprintf("DomainAlreadyExistsError{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("DescribeWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this DomainAlreadyExistsError match the -// provided DomainAlreadyExistsError. +// Equals returns true if all the fields of this DescribeWorkflowExecutionRequest match the +// provided DescribeWorkflowExecutionRequest. // // This function performs a deep comparison. -func (v *DomainAlreadyExistsError) Equals(rhs *DomainAlreadyExistsError) bool { - if !(v.Message == rhs.Message) { +func (v *DescribeWorkflowExecutionRequest) Equals(rhs *DescribeWorkflowExecutionRequest) bool { + if !_String_EqualsPtr(v.Domain, rhs.Domain) { + return false + } + if !((v.Execution == nil && rhs.Execution == nil) || (v.Execution != nil && rhs.Execution != nil && v.Execution.Equals(rhs.Execution))) { return false } return true } -func (v *DomainAlreadyExistsError) Error() string { - return v.String() +// GetDomain returns the value of Domain if it is set or its +// zero value if it is unset. +func (v *DescribeWorkflowExecutionRequest) GetDomain() (o string) { + if v.Domain != nil { + return *v.Domain + } + + return } -type DomainConfiguration struct { - WorkflowExecutionRetentionPeriodInDays *int32 `json:"workflowExecutionRetentionPeriodInDays,omitempty"` - EmitMetric *bool `json:"emitMetric,omitempty"` +type DescribeWorkflowExecutionResponse struct { + ExecutionConfiguration *WorkflowExecutionConfiguration `json:"executionConfiguration,omitempty"` + WorkflowExecutionInfo *WorkflowExecutionInfo `json:"workflowExecutionInfo,omitempty"` } -// ToWire translates a DomainConfiguration struct into a Thrift-level intermediate +// ToWire translates a DescribeWorkflowExecutionResponse struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -7502,7 +7616,7 @@ type DomainConfiguration struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *DomainConfiguration) ToWire() (wire.Value, error) { +func (v *DescribeWorkflowExecutionResponse) ToWire() (wire.Value, error) { var ( fields [2]wire.Field i int = 0 @@ -7510,16 +7624,16 @@ func (v *DomainConfiguration) ToWire() (wire.Value, error) { err error ) - if v.WorkflowExecutionRetentionPeriodInDays != nil { - w, err = wire.NewValueI32(*(v.WorkflowExecutionRetentionPeriodInDays)), error(nil) + if v.ExecutionConfiguration != nil { + w, err = v.ExecutionConfiguration.ToWire() if err != nil { return w, err } fields[i] = wire.Field{ID: 10, Value: w} i++ } - if v.EmitMetric != nil { - w, err = wire.NewValueBool(*(v.EmitMetric)), error(nil) + if v.WorkflowExecutionInfo != nil { + w, err = v.WorkflowExecutionInfo.ToWire() if err != nil { return w, err } @@ -7530,11 +7644,23 @@ func (v *DomainConfiguration) ToWire() (wire.Value, error) { return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -// FromWire deserializes a DomainConfiguration struct from its Thrift-level +func _WorkflowExecutionConfiguration_Read(w wire.Value) (*WorkflowExecutionConfiguration, error) { + var v WorkflowExecutionConfiguration + err := v.FromWire(w) + return &v, err +} + +func _WorkflowExecutionInfo_Read(w wire.Value) (*WorkflowExecutionInfo, error) { + var v WorkflowExecutionInfo + err := v.FromWire(w) + return &v, err +} + +// FromWire deserializes a DescribeWorkflowExecutionResponse 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 DomainConfiguration struct +// An error is returned if we were unable to build a DescribeWorkflowExecutionResponse struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -7542,31 +7668,27 @@ func (v *DomainConfiguration) ToWire() (wire.Value, error) { // return nil, err // } // -// var v DomainConfiguration +// var v DescribeWorkflowExecutionResponse // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *DomainConfiguration) FromWire(w wire.Value) error { +func (v *DescribeWorkflowExecutionResponse) FromWire(w wire.Value) error { var err error for _, field := range w.GetStruct().Fields { switch field.ID { case 10: - if field.Value.Type() == wire.TI32 { - var x int32 - x, err = field.Value.GetI32(), error(nil) - v.WorkflowExecutionRetentionPeriodInDays = &x + if field.Value.Type() == wire.TStruct { + v.ExecutionConfiguration, err = _WorkflowExecutionConfiguration_Read(field.Value) if err != nil { return err } } case 20: - if field.Value.Type() == wire.TBool { - var x bool - x, err = field.Value.GetBool(), error(nil) - v.EmitMetric = &x + if field.Value.Type() == wire.TStruct { + v.WorkflowExecutionInfo, err = _WorkflowExecutionInfo_Read(field.Value) if err != nil { return err } @@ -7578,80 +7700,47 @@ func (v *DomainConfiguration) FromWire(w wire.Value) error { return nil } -// String returns a readable string representation of a DomainConfiguration +// String returns a readable string representation of a DescribeWorkflowExecutionResponse // struct. -func (v *DomainConfiguration) String() string { +func (v *DescribeWorkflowExecutionResponse) String() string { if v == nil { return "" } var fields [2]string i := 0 - if v.WorkflowExecutionRetentionPeriodInDays != nil { - fields[i] = fmt.Sprintf("WorkflowExecutionRetentionPeriodInDays: %v", *(v.WorkflowExecutionRetentionPeriodInDays)) + if v.ExecutionConfiguration != nil { + fields[i] = fmt.Sprintf("ExecutionConfiguration: %v", v.ExecutionConfiguration) i++ } - if v.EmitMetric != nil { - fields[i] = fmt.Sprintf("EmitMetric: %v", *(v.EmitMetric)) + if v.WorkflowExecutionInfo != nil { + fields[i] = fmt.Sprintf("WorkflowExecutionInfo: %v", v.WorkflowExecutionInfo) i++ } - return fmt.Sprintf("DomainConfiguration{%v}", strings.Join(fields[:i], ", ")) -} - -func _Bool_EqualsPtr(lhs, rhs *bool) bool { - if lhs != nil && rhs != nil { - - x := *lhs - y := *rhs - return (x == y) - } - return lhs == nil && rhs == nil + return fmt.Sprintf("DescribeWorkflowExecutionResponse{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this DomainConfiguration match the -// provided DomainConfiguration. +// Equals returns true if all the fields of this DescribeWorkflowExecutionResponse match the +// provided DescribeWorkflowExecutionResponse. // // This function performs a deep comparison. -func (v *DomainConfiguration) Equals(rhs *DomainConfiguration) bool { - if !_I32_EqualsPtr(v.WorkflowExecutionRetentionPeriodInDays, rhs.WorkflowExecutionRetentionPeriodInDays) { +func (v *DescribeWorkflowExecutionResponse) Equals(rhs *DescribeWorkflowExecutionResponse) bool { + if !((v.ExecutionConfiguration == nil && rhs.ExecutionConfiguration == nil) || (v.ExecutionConfiguration != nil && rhs.ExecutionConfiguration != nil && v.ExecutionConfiguration.Equals(rhs.ExecutionConfiguration))) { return false } - if !_Bool_EqualsPtr(v.EmitMetric, rhs.EmitMetric) { + if !((v.WorkflowExecutionInfo == nil && rhs.WorkflowExecutionInfo == nil) || (v.WorkflowExecutionInfo != nil && rhs.WorkflowExecutionInfo != nil && v.WorkflowExecutionInfo.Equals(rhs.WorkflowExecutionInfo))) { return false } return true } -// GetWorkflowExecutionRetentionPeriodInDays returns the value of WorkflowExecutionRetentionPeriodInDays if it is set or its -// zero value if it is unset. -func (v *DomainConfiguration) GetWorkflowExecutionRetentionPeriodInDays() (o int32) { - if v.WorkflowExecutionRetentionPeriodInDays != nil { - return *v.WorkflowExecutionRetentionPeriodInDays - } - - return -} - -// GetEmitMetric returns the value of EmitMetric if it is set or its -// zero value if it is unset. -func (v *DomainConfiguration) GetEmitMetric() (o bool) { - if v.EmitMetric != nil { - return *v.EmitMetric - } - - return -} - -type DomainInfo struct { - Name *string `json:"name,omitempty"` - Status *DomainStatus `json:"status,omitempty"` - Description *string `json:"description,omitempty"` - OwnerEmail *string `json:"ownerEmail,omitempty"` +type DomainAlreadyExistsError struct { + Message string `json:"message,required"` } -// ToWire translates a DomainInfo struct into a Thrift-level intermediate +// ToWire translates a DomainAlreadyExistsError struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -7666,61 +7755,29 @@ type DomainInfo struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *DomainInfo) ToWire() (wire.Value, error) { +func (v *DomainAlreadyExistsError) ToWire() (wire.Value, error) { var ( - fields [4]wire.Field + fields [1]wire.Field i int = 0 w wire.Value err error ) - if v.Name != nil { - w, err = wire.NewValueString(*(v.Name)), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 10, Value: w} - i++ - } - if v.Status != nil { - w, err = v.Status.ToWire() - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 20, Value: w} - i++ - } - if v.Description != nil { - w, err = wire.NewValueString(*(v.Description)), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 30, Value: w} - i++ - } - if v.OwnerEmail != nil { - w, err = wire.NewValueString(*(v.OwnerEmail)), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 40, Value: w} - i++ + w, err = wire.NewValueString(v.Message), error(nil) + if err != nil { + return w, err } + fields[i] = wire.Field{ID: 1, Value: w} + i++ return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -func _DomainStatus_Read(w wire.Value) (DomainStatus, error) { - var v DomainStatus - err := v.FromWire(w) - return v, err -} - -// FromWire deserializes a DomainInfo struct from its Thrift-level +// FromWire deserializes a DomainAlreadyExistsError 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 DomainInfo struct +// An error is returned if we were unable to build a DomainAlreadyExistsError struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -7728,51 +7785,152 @@ func _DomainStatus_Read(w wire.Value) (DomainStatus, error) { // return nil, err // } // -// var v DomainInfo +// var v DomainAlreadyExistsError // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *DomainInfo) FromWire(w wire.Value) error { +func (v *DomainAlreadyExistsError) FromWire(w wire.Value) error { var err error + messageIsSet := false + for _, field := range w.GetStruct().Fields { switch field.ID { - case 10: + case 1: if field.Value.Type() == wire.TBinary { - var x string - x, err = field.Value.GetString(), error(nil) - v.Name = &x + v.Message, err = field.Value.GetString(), error(nil) if err != nil { return err } - + messageIsSet = true } - case 20: - if field.Value.Type() == wire.TI32 { - var x DomainStatus - x, err = _DomainStatus_Read(field.Value) - v.Status = &x - if err != nil { - return err - } + } + } - } - case 30: - if field.Value.Type() == wire.TBinary { - var x string - x, err = field.Value.GetString(), error(nil) - v.Description = &x - if err != nil { - return err - } + if !messageIsSet { + return errors.New("field Message of DomainAlreadyExistsError is required") + } - } - case 40: - if field.Value.Type() == wire.TBinary { - var x string - x, err = field.Value.GetString(), error(nil) - v.OwnerEmail = &x + return nil +} + +// String returns a readable string representation of a DomainAlreadyExistsError +// struct. +func (v *DomainAlreadyExistsError) String() string { + if v == nil { + return "" + } + + var fields [1]string + i := 0 + fields[i] = fmt.Sprintf("Message: %v", v.Message) + i++ + + return fmt.Sprintf("DomainAlreadyExistsError{%v}", strings.Join(fields[:i], ", ")) +} + +// Equals returns true if all the fields of this DomainAlreadyExistsError match the +// provided DomainAlreadyExistsError. +// +// This function performs a deep comparison. +func (v *DomainAlreadyExistsError) Equals(rhs *DomainAlreadyExistsError) bool { + if !(v.Message == rhs.Message) { + return false + } + + return true +} + +func (v *DomainAlreadyExistsError) Error() string { + return v.String() +} + +type DomainConfiguration struct { + WorkflowExecutionRetentionPeriodInDays *int32 `json:"workflowExecutionRetentionPeriodInDays,omitempty"` + EmitMetric *bool `json:"emitMetric,omitempty"` +} + +// ToWire translates a DomainConfiguration 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 *DomainConfiguration) ToWire() (wire.Value, error) { + var ( + fields [2]wire.Field + i int = 0 + w wire.Value + err error + ) + + if v.WorkflowExecutionRetentionPeriodInDays != nil { + w, err = wire.NewValueI32(*(v.WorkflowExecutionRetentionPeriodInDays)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 10, Value: w} + i++ + } + if v.EmitMetric != nil { + w, err = wire.NewValueBool(*(v.EmitMetric)), 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 DomainConfiguration 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 DomainConfiguration struct +// from the provided intermediate representation. +// +// x, err := binaryProtocol.Decode(reader, wire.TStruct) +// if err != nil { +// return nil, err +// } +// +// var v DomainConfiguration +// if err := v.FromWire(x); err != nil { +// return nil, err +// } +// return &v, nil +func (v *DomainConfiguration) FromWire(w wire.Value) error { + var err error + + for _, field := range w.GetStruct().Fields { + switch field.ID { + case 10: + if field.Value.Type() == wire.TI32 { + var x int32 + x, err = field.Value.GetI32(), error(nil) + v.WorkflowExecutionRetentionPeriodInDays = &x + if err != nil { + return err + } + + } + case 20: + if field.Value.Type() == wire.TBool { + var x bool + x, err = field.Value.GetBool(), error(nil) + v.EmitMetric = &x if err != nil { return err } @@ -7784,287 +7942,149 @@ func (v *DomainInfo) FromWire(w wire.Value) error { return nil } -// String returns a readable string representation of a DomainInfo +// String returns a readable string representation of a DomainConfiguration // struct. -func (v *DomainInfo) String() string { +func (v *DomainConfiguration) String() string { if v == nil { return "" } - var fields [4]string + var fields [2]string i := 0 - if v.Name != nil { - fields[i] = fmt.Sprintf("Name: %v", *(v.Name)) - i++ - } - if v.Status != nil { - fields[i] = fmt.Sprintf("Status: %v", *(v.Status)) - i++ - } - if v.Description != nil { - fields[i] = fmt.Sprintf("Description: %v", *(v.Description)) + if v.WorkflowExecutionRetentionPeriodInDays != nil { + fields[i] = fmt.Sprintf("WorkflowExecutionRetentionPeriodInDays: %v", *(v.WorkflowExecutionRetentionPeriodInDays)) i++ } - if v.OwnerEmail != nil { - fields[i] = fmt.Sprintf("OwnerEmail: %v", *(v.OwnerEmail)) + if v.EmitMetric != nil { + fields[i] = fmt.Sprintf("EmitMetric: %v", *(v.EmitMetric)) i++ } - return fmt.Sprintf("DomainInfo{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("DomainConfiguration{%v}", strings.Join(fields[:i], ", ")) } -func _DomainStatus_EqualsPtr(lhs, rhs *DomainStatus) bool { +func _Bool_EqualsPtr(lhs, rhs *bool) bool { if lhs != nil && rhs != nil { x := *lhs y := *rhs - return x.Equals(y) + return (x == y) } return lhs == nil && rhs == nil } -// Equals returns true if all the fields of this DomainInfo match the -// provided DomainInfo. +// Equals returns true if all the fields of this DomainConfiguration match the +// provided DomainConfiguration. // // This function performs a deep comparison. -func (v *DomainInfo) Equals(rhs *DomainInfo) bool { - if !_String_EqualsPtr(v.Name, rhs.Name) { - return false - } - if !_DomainStatus_EqualsPtr(v.Status, rhs.Status) { - return false - } - if !_String_EqualsPtr(v.Description, rhs.Description) { +func (v *DomainConfiguration) Equals(rhs *DomainConfiguration) bool { + if !_I32_EqualsPtr(v.WorkflowExecutionRetentionPeriodInDays, rhs.WorkflowExecutionRetentionPeriodInDays) { return false } - if !_String_EqualsPtr(v.OwnerEmail, rhs.OwnerEmail) { + if !_Bool_EqualsPtr(v.EmitMetric, rhs.EmitMetric) { return false } return true } -// GetName returns the value of Name if it is set or its -// zero value if it is unset. -func (v *DomainInfo) GetName() (o string) { - if v.Name != nil { - return *v.Name - } - - return -} - -// GetStatus returns the value of Status if it is set or its -// zero value if it is unset. -func (v *DomainInfo) GetStatus() (o DomainStatus) { - if v.Status != nil { - return *v.Status - } - - return -} - -// GetDescription returns the value of Description if it is set or its +// GetWorkflowExecutionRetentionPeriodInDays returns the value of WorkflowExecutionRetentionPeriodInDays if it is set or its // zero value if it is unset. -func (v *DomainInfo) GetDescription() (o string) { - if v.Description != nil { - return *v.Description +func (v *DomainConfiguration) GetWorkflowExecutionRetentionPeriodInDays() (o int32) { + if v.WorkflowExecutionRetentionPeriodInDays != nil { + return *v.WorkflowExecutionRetentionPeriodInDays } return } -// GetOwnerEmail returns the value of OwnerEmail if it is set or its +// GetEmitMetric returns the value of EmitMetric if it is set or its // zero value if it is unset. -func (v *DomainInfo) GetOwnerEmail() (o string) { - if v.OwnerEmail != nil { - return *v.OwnerEmail +func (v *DomainConfiguration) GetEmitMetric() (o bool) { + if v.EmitMetric != nil { + return *v.EmitMetric } return } -type DomainStatus int32 - -const ( - DomainStatusRegistered DomainStatus = 0 - DomainStatusDeprecated DomainStatus = 1 - DomainStatusDeleted DomainStatus = 2 -) - -// DomainStatus_Values returns all recognized values of DomainStatus. -func DomainStatus_Values() []DomainStatus { - return []DomainStatus{ - DomainStatusRegistered, - DomainStatusDeprecated, - DomainStatusDeleted, - } -} - -// UnmarshalText tries to decode DomainStatus from a byte slice -// containing its name. -// -// var v DomainStatus -// err := v.UnmarshalText([]byte("REGISTERED")) -func (v *DomainStatus) UnmarshalText(value []byte) error { - switch string(value) { - case "REGISTERED": - *v = DomainStatusRegistered - return nil - case "DEPRECATED": - *v = DomainStatusDeprecated - return nil - case "DELETED": - *v = DomainStatusDeleted - return nil - default: - return fmt.Errorf("unknown enum value %q for %q", value, "DomainStatus") - } +type DomainInfo struct { + Name *string `json:"name,omitempty"` + Status *DomainStatus `json:"status,omitempty"` + Description *string `json:"description,omitempty"` + OwnerEmail *string `json:"ownerEmail,omitempty"` } -// ToWire translates DomainStatus into a Thrift-level intermediate +// ToWire translates a DomainInfo struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // -// Enums are represented as 32-bit integers over the wire. -func (v DomainStatus) ToWire() (wire.Value, error) { - return wire.NewValueI32(int32(v)), nil -} - -// FromWire deserializes DomainStatus from its Thrift-level -// representation. +// An error is returned if the struct or any of its fields failed to +// validate. // -// x, err := binaryProtocol.Decode(reader, wire.TI32) +// x, err := v.ToWire() // if err != nil { -// return DomainStatus(0), err -// } -// -// var v DomainStatus -// if err := v.FromWire(x); err != nil { -// return DomainStatus(0), err -// } -// return v, nil -func (v *DomainStatus) FromWire(w wire.Value) error { - *v = (DomainStatus)(w.GetI32()) - return nil -} - -// String returns a readable string representation of DomainStatus. -func (v DomainStatus) String() string { - w := int32(v) - switch w { - case 0: - return "REGISTERED" - case 1: - return "DEPRECATED" - case 2: - return "DELETED" - } - return fmt.Sprintf("DomainStatus(%d)", w) -} - -// Equals returns true if this DomainStatus value matches the provided -// value. -func (v DomainStatus) Equals(rhs DomainStatus) bool { - return v == rhs -} - -// MarshalJSON serializes DomainStatus into JSON. -// -// If the enum value is recognized, its name is returned. Otherwise, -// its integer value is returned. -// -// This implements json.Marshaler. -func (v DomainStatus) MarshalJSON() ([]byte, error) { - switch int32(v) { - case 0: - return ([]byte)("\"REGISTERED\""), nil - case 1: - return ([]byte)("\"DEPRECATED\""), nil - case 2: - return ([]byte)("\"DELETED\""), nil - } - return ([]byte)(strconv.FormatInt(int64(v), 10)), nil -} - -// UnmarshalJSON attempts to decode DomainStatus from its JSON -// representation. -// -// This implementation supports both, numeric and string inputs. If a -// string is provided, it must be a known enum name. -// -// This implements json.Unmarshaler. -func (v *DomainStatus) UnmarshalJSON(text []byte) error { - d := json.NewDecoder(bytes.NewReader(text)) - d.UseNumber() - t, err := d.Token() - if err != nil { - return err - } - - switch w := t.(type) { - case json.Number: - x, err := w.Int64() - if err != nil { - return err - } - if x > math.MaxInt32 { - return fmt.Errorf("enum overflow from JSON %q for %q", text, "DomainStatus") - } - if x < math.MinInt32 { - return fmt.Errorf("enum underflow from JSON %q for %q", text, "DomainStatus") - } - *v = (DomainStatus)(x) - return nil - case string: - return v.UnmarshalText([]byte(w)) - default: - return fmt.Errorf("invalid JSON value %q (%T) to unmarshal into %q", t, t, "DomainStatus") - } -} - -type EntityNotExistsError struct { - Message string `json:"message,required"` -} - -// ToWire translates a EntityNotExistsError 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 +// return err // } // // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *EntityNotExistsError) ToWire() (wire.Value, error) { +func (v *DomainInfo) ToWire() (wire.Value, error) { var ( - fields [1]wire.Field + fields [4]wire.Field i int = 0 w wire.Value err error ) - w, err = wire.NewValueString(v.Message), error(nil) - if err != nil { - return w, err + if v.Name != nil { + w, err = wire.NewValueString(*(v.Name)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 10, Value: w} + i++ + } + if v.Status != nil { + w, err = v.Status.ToWire() + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 20, Value: w} + i++ + } + if v.Description != nil { + w, err = wire.NewValueString(*(v.Description)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 30, Value: w} + i++ + } + if v.OwnerEmail != nil { + w, err = wire.NewValueString(*(v.OwnerEmail)), error(nil) + if err != nil { + return w, err + } + fields[i] = wire.Field{ID: 40, Value: w} + i++ } - fields[i] = wire.Field{ID: 1, Value: w} - i++ return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -// FromWire deserializes a EntityNotExistsError struct from its Thrift-level +func _DomainStatus_Read(w wire.Value) (DomainStatus, error) { + var v DomainStatus + err := v.FromWire(w) + return v, err +} + +// FromWire deserializes a DomainInfo 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 EntityNotExistsError struct +// An error is returned if we were unable to build a DomainInfo struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -8072,493 +8092,273 @@ func (v *EntityNotExistsError) ToWire() (wire.Value, error) { // return nil, err // } // -// var v EntityNotExistsError +// var v DomainInfo // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *EntityNotExistsError) FromWire(w wire.Value) error { +func (v *DomainInfo) FromWire(w wire.Value) error { var err error - messageIsSet := false - for _, field := range w.GetStruct().Fields { switch field.ID { - case 1: + case 10: if field.Value.Type() == wire.TBinary { - v.Message, err = field.Value.GetString(), error(nil) + var x string + x, err = field.Value.GetString(), error(nil) + v.Name = &x if err != nil { return err } - messageIsSet = true + } - } - } + case 20: + if field.Value.Type() == wire.TI32 { + var x DomainStatus + x, err = _DomainStatus_Read(field.Value) + v.Status = &x + if err != nil { + return err + } - if !messageIsSet { - return errors.New("field Message of EntityNotExistsError is required") + } + case 30: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.Description = &x + if err != nil { + return err + } + + } + case 40: + if field.Value.Type() == wire.TBinary { + var x string + x, err = field.Value.GetString(), error(nil) + v.OwnerEmail = &x + if err != nil { + return err + } + + } + } } return nil } -// String returns a readable string representation of a EntityNotExistsError +// String returns a readable string representation of a DomainInfo // struct. -func (v *EntityNotExistsError) String() string { +func (v *DomainInfo) String() string { if v == nil { return "" } - var fields [1]string + var fields [4]string i := 0 - fields[i] = fmt.Sprintf("Message: %v", v.Message) - i++ + if v.Name != nil { + fields[i] = fmt.Sprintf("Name: %v", *(v.Name)) + i++ + } + if v.Status != nil { + fields[i] = fmt.Sprintf("Status: %v", *(v.Status)) + i++ + } + if v.Description != nil { + fields[i] = fmt.Sprintf("Description: %v", *(v.Description)) + i++ + } + if v.OwnerEmail != nil { + fields[i] = fmt.Sprintf("OwnerEmail: %v", *(v.OwnerEmail)) + i++ + } - return fmt.Sprintf("EntityNotExistsError{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("DomainInfo{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this EntityNotExistsError match the -// provided EntityNotExistsError. +func _DomainStatus_EqualsPtr(lhs, rhs *DomainStatus) bool { + if lhs != nil && rhs != nil { + + x := *lhs + y := *rhs + return x.Equals(y) + } + return lhs == nil && rhs == nil +} + +// Equals returns true if all the fields of this DomainInfo match the +// provided DomainInfo. // // This function performs a deep comparison. -func (v *EntityNotExistsError) Equals(rhs *EntityNotExistsError) bool { - if !(v.Message == rhs.Message) { +func (v *DomainInfo) Equals(rhs *DomainInfo) bool { + if !_String_EqualsPtr(v.Name, rhs.Name) { + return false + } + if !_DomainStatus_EqualsPtr(v.Status, rhs.Status) { + return false + } + if !_String_EqualsPtr(v.Description, rhs.Description) { + return false + } + if !_String_EqualsPtr(v.OwnerEmail, rhs.OwnerEmail) { return false } return true } -func (v *EntityNotExistsError) Error() string { - return v.String() -} - -type EventType int32 +// GetName returns the value of Name if it is set or its +// zero value if it is unset. +func (v *DomainInfo) GetName() (o string) { + if v.Name != nil { + return *v.Name + } + + return +} + +// GetStatus returns the value of Status if it is set or its +// zero value if it is unset. +func (v *DomainInfo) GetStatus() (o DomainStatus) { + if v.Status != nil { + return *v.Status + } + + return +} + +// GetDescription returns the value of Description if it is set or its +// zero value if it is unset. +func (v *DomainInfo) GetDescription() (o string) { + if v.Description != nil { + return *v.Description + } + + return +} + +// GetOwnerEmail returns the value of OwnerEmail if it is set or its +// zero value if it is unset. +func (v *DomainInfo) GetOwnerEmail() (o string) { + if v.OwnerEmail != nil { + return *v.OwnerEmail + } + + return +} + +type DomainStatus int32 const ( - EventTypeWorkflowExecutionStarted EventType = 0 - EventTypeWorkflowExecutionCompleted EventType = 1 - EventTypeWorkflowExecutionFailed EventType = 2 - EventTypeWorkflowExecutionTimedOut EventType = 3 - EventTypeDecisionTaskScheduled EventType = 4 - EventTypeDecisionTaskStarted EventType = 5 - EventTypeDecisionTaskCompleted EventType = 6 - EventTypeDecisionTaskTimedOut EventType = 7 - EventTypeDecisionTaskFailed EventType = 8 - EventTypeActivityTaskScheduled EventType = 9 - EventTypeActivityTaskStarted EventType = 10 - EventTypeActivityTaskCompleted EventType = 11 - EventTypeActivityTaskFailed EventType = 12 - EventTypeActivityTaskTimedOut EventType = 13 - EventTypeActivityTaskCancelRequested EventType = 14 - EventTypeRequestCancelActivityTaskFailed EventType = 15 - EventTypeActivityTaskCanceled EventType = 16 - EventTypeTimerStarted EventType = 17 - EventTypeTimerFired EventType = 18 - EventTypeCancelTimerFailed EventType = 19 - EventTypeTimerCanceled EventType = 20 - EventTypeWorkflowExecutionCancelRequested EventType = 21 - EventTypeWorkflowExecutionCanceled EventType = 22 - EventTypeRequestCancelExternalWorkflowExecutionInitiated EventType = 23 - EventTypeRequestCancelExternalWorkflowExecutionFailed EventType = 24 - EventTypeExternalWorkflowExecutionCancelRequested EventType = 25 - EventTypeMarkerRecorded EventType = 26 - EventTypeWorkflowExecutionSignaled EventType = 27 - EventTypeWorkflowExecutionTerminated EventType = 28 - EventTypeWorkflowExecutionContinuedAsNew EventType = 29 - EventTypeStartChildWorkflowExecutionInitiated EventType = 30 - EventTypeStartChildWorkflowExecutionFailed EventType = 31 - EventTypeChildWorkflowExecutionStarted EventType = 32 - EventTypeChildWorkflowExecutionCompleted EventType = 33 - EventTypeChildWorkflowExecutionFailed EventType = 34 - EventTypeChildWorkflowExecutionCanceled EventType = 35 - EventTypeChildWorkflowExecutionTimedOut EventType = 36 - EventTypeChildWorkflowExecutionTerminated EventType = 37 + DomainStatusRegistered DomainStatus = 0 + DomainStatusDeprecated DomainStatus = 1 + DomainStatusDeleted DomainStatus = 2 ) -// EventType_Values returns all recognized values of EventType. -func EventType_Values() []EventType { - return []EventType{ - EventTypeWorkflowExecutionStarted, - EventTypeWorkflowExecutionCompleted, - EventTypeWorkflowExecutionFailed, - EventTypeWorkflowExecutionTimedOut, - EventTypeDecisionTaskScheduled, - EventTypeDecisionTaskStarted, - EventTypeDecisionTaskCompleted, - EventTypeDecisionTaskTimedOut, - EventTypeDecisionTaskFailed, - EventTypeActivityTaskScheduled, - EventTypeActivityTaskStarted, - EventTypeActivityTaskCompleted, - EventTypeActivityTaskFailed, - EventTypeActivityTaskTimedOut, - EventTypeActivityTaskCancelRequested, - EventTypeRequestCancelActivityTaskFailed, - EventTypeActivityTaskCanceled, - EventTypeTimerStarted, - EventTypeTimerFired, - EventTypeCancelTimerFailed, - EventTypeTimerCanceled, - EventTypeWorkflowExecutionCancelRequested, - EventTypeWorkflowExecutionCanceled, - EventTypeRequestCancelExternalWorkflowExecutionInitiated, - EventTypeRequestCancelExternalWorkflowExecutionFailed, - EventTypeExternalWorkflowExecutionCancelRequested, - EventTypeMarkerRecorded, - EventTypeWorkflowExecutionSignaled, - EventTypeWorkflowExecutionTerminated, - EventTypeWorkflowExecutionContinuedAsNew, - EventTypeStartChildWorkflowExecutionInitiated, - EventTypeStartChildWorkflowExecutionFailed, - EventTypeChildWorkflowExecutionStarted, - EventTypeChildWorkflowExecutionCompleted, - EventTypeChildWorkflowExecutionFailed, - EventTypeChildWorkflowExecutionCanceled, - EventTypeChildWorkflowExecutionTimedOut, - EventTypeChildWorkflowExecutionTerminated, +// DomainStatus_Values returns all recognized values of DomainStatus. +func DomainStatus_Values() []DomainStatus { + return []DomainStatus{ + DomainStatusRegistered, + DomainStatusDeprecated, + DomainStatusDeleted, } } -// UnmarshalText tries to decode EventType from a byte slice +// UnmarshalText tries to decode DomainStatus from a byte slice // containing its name. // -// var v EventType -// err := v.UnmarshalText([]byte("WorkflowExecutionStarted")) -func (v *EventType) UnmarshalText(value []byte) error { +// var v DomainStatus +// err := v.UnmarshalText([]byte("REGISTERED")) +func (v *DomainStatus) UnmarshalText(value []byte) error { switch string(value) { - case "WorkflowExecutionStarted": - *v = EventTypeWorkflowExecutionStarted - return nil - case "WorkflowExecutionCompleted": - *v = EventTypeWorkflowExecutionCompleted - return nil - case "WorkflowExecutionFailed": - *v = EventTypeWorkflowExecutionFailed - return nil - case "WorkflowExecutionTimedOut": - *v = EventTypeWorkflowExecutionTimedOut - return nil - case "DecisionTaskScheduled": - *v = EventTypeDecisionTaskScheduled - return nil - case "DecisionTaskStarted": - *v = EventTypeDecisionTaskStarted - return nil - case "DecisionTaskCompleted": - *v = EventTypeDecisionTaskCompleted - return nil - case "DecisionTaskTimedOut": - *v = EventTypeDecisionTaskTimedOut - return nil - case "DecisionTaskFailed": - *v = EventTypeDecisionTaskFailed - return nil - case "ActivityTaskScheduled": - *v = EventTypeActivityTaskScheduled - return nil - case "ActivityTaskStarted": - *v = EventTypeActivityTaskStarted - return nil - case "ActivityTaskCompleted": - *v = EventTypeActivityTaskCompleted - return nil - case "ActivityTaskFailed": - *v = EventTypeActivityTaskFailed - return nil - case "ActivityTaskTimedOut": - *v = EventTypeActivityTaskTimedOut - return nil - case "ActivityTaskCancelRequested": - *v = EventTypeActivityTaskCancelRequested - return nil - case "RequestCancelActivityTaskFailed": - *v = EventTypeRequestCancelActivityTaskFailed - return nil - case "ActivityTaskCanceled": - *v = EventTypeActivityTaskCanceled - return nil - case "TimerStarted": - *v = EventTypeTimerStarted - return nil - case "TimerFired": - *v = EventTypeTimerFired - return nil - case "CancelTimerFailed": - *v = EventTypeCancelTimerFailed - return nil - case "TimerCanceled": - *v = EventTypeTimerCanceled - return nil - case "WorkflowExecutionCancelRequested": - *v = EventTypeWorkflowExecutionCancelRequested - return nil - case "WorkflowExecutionCanceled": - *v = EventTypeWorkflowExecutionCanceled - return nil - case "RequestCancelExternalWorkflowExecutionInitiated": - *v = EventTypeRequestCancelExternalWorkflowExecutionInitiated - return nil - case "RequestCancelExternalWorkflowExecutionFailed": - *v = EventTypeRequestCancelExternalWorkflowExecutionFailed - return nil - case "ExternalWorkflowExecutionCancelRequested": - *v = EventTypeExternalWorkflowExecutionCancelRequested - return nil - case "MarkerRecorded": - *v = EventTypeMarkerRecorded - return nil - case "WorkflowExecutionSignaled": - *v = EventTypeWorkflowExecutionSignaled - return nil - case "WorkflowExecutionTerminated": - *v = EventTypeWorkflowExecutionTerminated - return nil - case "WorkflowExecutionContinuedAsNew": - *v = EventTypeWorkflowExecutionContinuedAsNew - return nil - case "StartChildWorkflowExecutionInitiated": - *v = EventTypeStartChildWorkflowExecutionInitiated - return nil - case "StartChildWorkflowExecutionFailed": - *v = EventTypeStartChildWorkflowExecutionFailed - return nil - case "ChildWorkflowExecutionStarted": - *v = EventTypeChildWorkflowExecutionStarted - return nil - case "ChildWorkflowExecutionCompleted": - *v = EventTypeChildWorkflowExecutionCompleted - return nil - case "ChildWorkflowExecutionFailed": - *v = EventTypeChildWorkflowExecutionFailed - return nil - case "ChildWorkflowExecutionCanceled": - *v = EventTypeChildWorkflowExecutionCanceled + case "REGISTERED": + *v = DomainStatusRegistered return nil - case "ChildWorkflowExecutionTimedOut": - *v = EventTypeChildWorkflowExecutionTimedOut + case "DEPRECATED": + *v = DomainStatusDeprecated return nil - case "ChildWorkflowExecutionTerminated": - *v = EventTypeChildWorkflowExecutionTerminated + case "DELETED": + *v = DomainStatusDeleted return nil default: - return fmt.Errorf("unknown enum value %q for %q", value, "EventType") + return fmt.Errorf("unknown enum value %q for %q", value, "DomainStatus") } } -// ToWire translates EventType into a Thrift-level intermediate +// ToWire translates DomainStatus into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // // Enums are represented as 32-bit integers over the wire. -func (v EventType) ToWire() (wire.Value, error) { +func (v DomainStatus) ToWire() (wire.Value, error) { return wire.NewValueI32(int32(v)), nil } -// FromWire deserializes EventType from its Thrift-level +// FromWire deserializes DomainStatus from its Thrift-level // representation. // // x, err := binaryProtocol.Decode(reader, wire.TI32) // if err != nil { -// return EventType(0), err +// return DomainStatus(0), err // } // -// var v EventType +// var v DomainStatus // if err := v.FromWire(x); err != nil { -// return EventType(0), err +// return DomainStatus(0), err // } // return v, nil -func (v *EventType) FromWire(w wire.Value) error { - *v = (EventType)(w.GetI32()) +func (v *DomainStatus) FromWire(w wire.Value) error { + *v = (DomainStatus)(w.GetI32()) return nil } -// String returns a readable string representation of EventType. -func (v EventType) String() string { +// String returns a readable string representation of DomainStatus. +func (v DomainStatus) String() string { w := int32(v) switch w { case 0: - return "WorkflowExecutionStarted" + return "REGISTERED" case 1: - return "WorkflowExecutionCompleted" + return "DEPRECATED" case 2: - return "WorkflowExecutionFailed" - case 3: - return "WorkflowExecutionTimedOut" - case 4: - return "DecisionTaskScheduled" - case 5: - return "DecisionTaskStarted" - case 6: - return "DecisionTaskCompleted" - case 7: - return "DecisionTaskTimedOut" - case 8: - return "DecisionTaskFailed" - case 9: - return "ActivityTaskScheduled" - case 10: - return "ActivityTaskStarted" - case 11: - return "ActivityTaskCompleted" - case 12: - return "ActivityTaskFailed" - case 13: - return "ActivityTaskTimedOut" - case 14: - return "ActivityTaskCancelRequested" - case 15: - return "RequestCancelActivityTaskFailed" - case 16: - return "ActivityTaskCanceled" - case 17: - return "TimerStarted" - case 18: - return "TimerFired" - case 19: - return "CancelTimerFailed" - case 20: - return "TimerCanceled" - case 21: - return "WorkflowExecutionCancelRequested" - case 22: - return "WorkflowExecutionCanceled" - case 23: - return "RequestCancelExternalWorkflowExecutionInitiated" - case 24: - return "RequestCancelExternalWorkflowExecutionFailed" - case 25: - return "ExternalWorkflowExecutionCancelRequested" - case 26: - return "MarkerRecorded" - case 27: - return "WorkflowExecutionSignaled" - case 28: - return "WorkflowExecutionTerminated" - case 29: - return "WorkflowExecutionContinuedAsNew" - case 30: - return "StartChildWorkflowExecutionInitiated" - case 31: - return "StartChildWorkflowExecutionFailed" - case 32: - return "ChildWorkflowExecutionStarted" - case 33: - return "ChildWorkflowExecutionCompleted" - case 34: - return "ChildWorkflowExecutionFailed" - case 35: - return "ChildWorkflowExecutionCanceled" - case 36: - return "ChildWorkflowExecutionTimedOut" - case 37: - return "ChildWorkflowExecutionTerminated" + return "DELETED" } - return fmt.Sprintf("EventType(%d)", w) + return fmt.Sprintf("DomainStatus(%d)", w) } -// Equals returns true if this EventType value matches the provided +// Equals returns true if this DomainStatus value matches the provided // value. -func (v EventType) Equals(rhs EventType) bool { +func (v DomainStatus) Equals(rhs DomainStatus) bool { return v == rhs } -// MarshalJSON serializes EventType into JSON. +// MarshalJSON serializes DomainStatus into JSON. // // If the enum value is recognized, its name is returned. Otherwise, // its integer value is returned. // // This implements json.Marshaler. -func (v EventType) MarshalJSON() ([]byte, error) { +func (v DomainStatus) MarshalJSON() ([]byte, error) { switch int32(v) { case 0: - return ([]byte)("\"WorkflowExecutionStarted\""), nil + return ([]byte)("\"REGISTERED\""), nil case 1: - return ([]byte)("\"WorkflowExecutionCompleted\""), nil + return ([]byte)("\"DEPRECATED\""), nil case 2: - return ([]byte)("\"WorkflowExecutionFailed\""), nil - case 3: - return ([]byte)("\"WorkflowExecutionTimedOut\""), nil - case 4: - return ([]byte)("\"DecisionTaskScheduled\""), nil - case 5: - return ([]byte)("\"DecisionTaskStarted\""), nil - case 6: - return ([]byte)("\"DecisionTaskCompleted\""), nil - case 7: - return ([]byte)("\"DecisionTaskTimedOut\""), nil - case 8: - return ([]byte)("\"DecisionTaskFailed\""), nil - case 9: - return ([]byte)("\"ActivityTaskScheduled\""), nil - case 10: - return ([]byte)("\"ActivityTaskStarted\""), nil - case 11: - return ([]byte)("\"ActivityTaskCompleted\""), nil - case 12: - return ([]byte)("\"ActivityTaskFailed\""), nil - case 13: - return ([]byte)("\"ActivityTaskTimedOut\""), nil - case 14: - return ([]byte)("\"ActivityTaskCancelRequested\""), nil - case 15: - return ([]byte)("\"RequestCancelActivityTaskFailed\""), nil - case 16: - return ([]byte)("\"ActivityTaskCanceled\""), nil - case 17: - return ([]byte)("\"TimerStarted\""), nil - case 18: - return ([]byte)("\"TimerFired\""), nil - case 19: - return ([]byte)("\"CancelTimerFailed\""), nil - case 20: - return ([]byte)("\"TimerCanceled\""), nil - case 21: - return ([]byte)("\"WorkflowExecutionCancelRequested\""), nil - case 22: - return ([]byte)("\"WorkflowExecutionCanceled\""), nil - case 23: - return ([]byte)("\"RequestCancelExternalWorkflowExecutionInitiated\""), nil - case 24: - return ([]byte)("\"RequestCancelExternalWorkflowExecutionFailed\""), nil - case 25: - return ([]byte)("\"ExternalWorkflowExecutionCancelRequested\""), nil - case 26: - return ([]byte)("\"MarkerRecorded\""), nil - case 27: - return ([]byte)("\"WorkflowExecutionSignaled\""), nil - case 28: - return ([]byte)("\"WorkflowExecutionTerminated\""), nil - case 29: - return ([]byte)("\"WorkflowExecutionContinuedAsNew\""), nil - case 30: - return ([]byte)("\"StartChildWorkflowExecutionInitiated\""), nil - case 31: - return ([]byte)("\"StartChildWorkflowExecutionFailed\""), nil - case 32: - return ([]byte)("\"ChildWorkflowExecutionStarted\""), nil - case 33: - return ([]byte)("\"ChildWorkflowExecutionCompleted\""), nil - case 34: - return ([]byte)("\"ChildWorkflowExecutionFailed\""), nil - case 35: - return ([]byte)("\"ChildWorkflowExecutionCanceled\""), nil - case 36: - return ([]byte)("\"ChildWorkflowExecutionTimedOut\""), nil - case 37: - return ([]byte)("\"ChildWorkflowExecutionTerminated\""), nil + return ([]byte)("\"DELETED\""), nil } return ([]byte)(strconv.FormatInt(int64(v), 10)), nil } -// UnmarshalJSON attempts to decode EventType from its JSON +// UnmarshalJSON attempts to decode DomainStatus from its JSON // representation. // // This implementation supports both, numeric and string inputs. If a // string is provided, it must be a known enum name. // // This implements json.Unmarshaler. -func (v *EventType) UnmarshalJSON(text []byte) error { +func (v *DomainStatus) UnmarshalJSON(text []byte) error { d := json.NewDecoder(bytes.NewReader(text)) d.UseNumber() t, err := d.Token() @@ -8573,27 +8373,25 @@ func (v *EventType) UnmarshalJSON(text []byte) error { return err } if x > math.MaxInt32 { - return fmt.Errorf("enum overflow from JSON %q for %q", text, "EventType") + return fmt.Errorf("enum overflow from JSON %q for %q", text, "DomainStatus") } if x < math.MinInt32 { - return fmt.Errorf("enum underflow from JSON %q for %q", text, "EventType") + return fmt.Errorf("enum underflow from JSON %q for %q", text, "DomainStatus") } - *v = (EventType)(x) + *v = (DomainStatus)(x) return nil case string: return v.UnmarshalText([]byte(w)) default: - return fmt.Errorf("invalid JSON value %q (%T) to unmarshal into %q", t, t, "EventType") + return fmt.Errorf("invalid JSON value %q (%T) to unmarshal into %q", t, t, "DomainStatus") } } -type ExternalWorkflowExecutionCancelRequestedEventAttributes struct { - InitiatedEventId *int64 `json:"initiatedEventId,omitempty"` - Domain *string `json:"domain,omitempty"` - WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"` +type EntityNotExistsError struct { + Message string `json:"message,required"` } -// ToWire translates a ExternalWorkflowExecutionCancelRequestedEventAttributes struct into a Thrift-level intermediate +// ToWire translates a EntityNotExistsError struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -8608,47 +8406,29 @@ type ExternalWorkflowExecutionCancelRequestedEventAttributes struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) ToWire() (wire.Value, error) { +func (v *EntityNotExistsError) ToWire() (wire.Value, error) { var ( - fields [3]wire.Field + fields [1]wire.Field i int = 0 w wire.Value err error ) - if v.InitiatedEventId != nil { - w, err = wire.NewValueI64(*(v.InitiatedEventId)), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 10, Value: w} - i++ - } - if v.Domain != nil { - w, err = wire.NewValueString(*(v.Domain)), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 20, Value: w} - i++ - } - if v.WorkflowExecution != nil { - w, err = v.WorkflowExecution.ToWire() - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 30, Value: w} - i++ + w, err = wire.NewValueString(v.Message), error(nil) + if err != nil { + return w, err } + fields[i] = wire.Field{ID: 1, Value: w} + i++ return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -// FromWire deserializes a ExternalWorkflowExecutionCancelRequestedEventAttributes struct from its Thrift-level +// FromWire deserializes a EntityNotExistsError 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 ExternalWorkflowExecutionCancelRequestedEventAttributes struct +// An error is returned if we were unable to build a EntityNotExistsError struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -8656,260 +8436,528 @@ func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) ToWire() (wire // return nil, err // } // -// var v ExternalWorkflowExecutionCancelRequestedEventAttributes +// var v EntityNotExistsError // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) FromWire(w wire.Value) error { +func (v *EntityNotExistsError) FromWire(w wire.Value) error { var err error + messageIsSet := false + for _, field := range w.GetStruct().Fields { switch field.ID { - case 10: - if field.Value.Type() == wire.TI64 { - var x int64 - x, err = field.Value.GetI64(), error(nil) - v.InitiatedEventId = &x + case 1: + if field.Value.Type() == wire.TBinary { + v.Message, err = field.Value.GetString(), error(nil) if err != nil { return err } - - } - case 20: - 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 30: - if field.Value.Type() == wire.TStruct { - v.WorkflowExecution, err = _WorkflowExecution_Read(field.Value) - if err != nil { - return err - } - + messageIsSet = true } } } + if !messageIsSet { + return errors.New("field Message of EntityNotExistsError is required") + } + return nil } -// String returns a readable string representation of a ExternalWorkflowExecutionCancelRequestedEventAttributes +// String returns a readable string representation of a EntityNotExistsError // struct. -func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) String() string { +func (v *EntityNotExistsError) String() string { if v == nil { return "" } - var fields [3]string + var fields [1]string i := 0 - if v.InitiatedEventId != nil { - fields[i] = fmt.Sprintf("InitiatedEventId: %v", *(v.InitiatedEventId)) - i++ - } - if v.Domain != nil { - fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) - i++ - } - if v.WorkflowExecution != nil { - fields[i] = fmt.Sprintf("WorkflowExecution: %v", v.WorkflowExecution) - i++ - } + fields[i] = fmt.Sprintf("Message: %v", v.Message) + i++ - return fmt.Sprintf("ExternalWorkflowExecutionCancelRequestedEventAttributes{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("EntityNotExistsError{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this ExternalWorkflowExecutionCancelRequestedEventAttributes match the -// provided ExternalWorkflowExecutionCancelRequestedEventAttributes. +// Equals returns true if all the fields of this EntityNotExistsError match the +// provided EntityNotExistsError. // // This function performs a deep comparison. -func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) Equals(rhs *ExternalWorkflowExecutionCancelRequestedEventAttributes) bool { - if !_I64_EqualsPtr(v.InitiatedEventId, rhs.InitiatedEventId) { - return false - } - if !_String_EqualsPtr(v.Domain, rhs.Domain) { - return false - } - if !((v.WorkflowExecution == nil && rhs.WorkflowExecution == nil) || (v.WorkflowExecution != nil && rhs.WorkflowExecution != nil && v.WorkflowExecution.Equals(rhs.WorkflowExecution))) { +func (v *EntityNotExistsError) Equals(rhs *EntityNotExistsError) bool { + if !(v.Message == rhs.Message) { return false } return true } -// GetInitiatedEventId returns the value of InitiatedEventId if it is set or its -// zero value if it is unset. -func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) GetInitiatedEventId() (o int64) { - if v.InitiatedEventId != nil { - return *v.InitiatedEventId - } - - return -} - -// GetDomain returns the value of Domain if it is set or its -// zero value if it is unset. -func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) GetDomain() (o string) { - if v.Domain != nil { - return *v.Domain - } - - return +func (v *EntityNotExistsError) Error() string { + return v.String() } -type FailWorkflowExecutionDecisionAttributes struct { - Reason *string `json:"reason,omitempty"` - Details []byte `json:"details,omitempty"` -} +type EventType int32 -// ToWire translates a FailWorkflowExecutionDecisionAttributes 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 *FailWorkflowExecutionDecisionAttributes) ToWire() (wire.Value, error) { - var ( - fields [2]wire.Field - i int = 0 - w wire.Value - err error - ) +const ( + EventTypeWorkflowExecutionStarted EventType = 0 + EventTypeWorkflowExecutionCompleted EventType = 1 + EventTypeWorkflowExecutionFailed EventType = 2 + EventTypeWorkflowExecutionTimedOut EventType = 3 + EventTypeDecisionTaskScheduled EventType = 4 + EventTypeDecisionTaskStarted EventType = 5 + EventTypeDecisionTaskCompleted EventType = 6 + EventTypeDecisionTaskTimedOut EventType = 7 + EventTypeDecisionTaskFailed EventType = 8 + EventTypeActivityTaskScheduled EventType = 9 + EventTypeActivityTaskStarted EventType = 10 + EventTypeActivityTaskCompleted EventType = 11 + EventTypeActivityTaskFailed EventType = 12 + EventTypeActivityTaskTimedOut EventType = 13 + EventTypeActivityTaskCancelRequested EventType = 14 + EventTypeRequestCancelActivityTaskFailed EventType = 15 + EventTypeActivityTaskCanceled EventType = 16 + EventTypeTimerStarted EventType = 17 + EventTypeTimerFired EventType = 18 + EventTypeCancelTimerFailed EventType = 19 + EventTypeTimerCanceled EventType = 20 + EventTypeWorkflowExecutionCancelRequested EventType = 21 + EventTypeWorkflowExecutionCanceled EventType = 22 + EventTypeRequestCancelExternalWorkflowExecutionInitiated EventType = 23 + EventTypeRequestCancelExternalWorkflowExecutionFailed EventType = 24 + EventTypeExternalWorkflowExecutionCancelRequested EventType = 25 + EventTypeMarkerRecorded EventType = 26 + EventTypeWorkflowExecutionSignaled EventType = 27 + EventTypeWorkflowExecutionTerminated EventType = 28 + EventTypeWorkflowExecutionContinuedAsNew EventType = 29 + EventTypeStartChildWorkflowExecutionInitiated EventType = 30 + EventTypeStartChildWorkflowExecutionFailed EventType = 31 + EventTypeChildWorkflowExecutionStarted EventType = 32 + EventTypeChildWorkflowExecutionCompleted EventType = 33 + EventTypeChildWorkflowExecutionFailed EventType = 34 + EventTypeChildWorkflowExecutionCanceled EventType = 35 + EventTypeChildWorkflowExecutionTimedOut EventType = 36 + EventTypeChildWorkflowExecutionTerminated EventType = 37 +) - 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.Details != nil { - w, err = wire.NewValueBinary(v.Details), error(nil) - if err != nil { - return w, err - } - fields[i] = wire.Field{ID: 20, Value: w} - i++ +// EventType_Values returns all recognized values of EventType. +func EventType_Values() []EventType { + return []EventType{ + EventTypeWorkflowExecutionStarted, + EventTypeWorkflowExecutionCompleted, + EventTypeWorkflowExecutionFailed, + EventTypeWorkflowExecutionTimedOut, + EventTypeDecisionTaskScheduled, + EventTypeDecisionTaskStarted, + EventTypeDecisionTaskCompleted, + EventTypeDecisionTaskTimedOut, + EventTypeDecisionTaskFailed, + EventTypeActivityTaskScheduled, + EventTypeActivityTaskStarted, + EventTypeActivityTaskCompleted, + EventTypeActivityTaskFailed, + EventTypeActivityTaskTimedOut, + EventTypeActivityTaskCancelRequested, + EventTypeRequestCancelActivityTaskFailed, + EventTypeActivityTaskCanceled, + EventTypeTimerStarted, + EventTypeTimerFired, + EventTypeCancelTimerFailed, + EventTypeTimerCanceled, + EventTypeWorkflowExecutionCancelRequested, + EventTypeWorkflowExecutionCanceled, + EventTypeRequestCancelExternalWorkflowExecutionInitiated, + EventTypeRequestCancelExternalWorkflowExecutionFailed, + EventTypeExternalWorkflowExecutionCancelRequested, + EventTypeMarkerRecorded, + EventTypeWorkflowExecutionSignaled, + EventTypeWorkflowExecutionTerminated, + EventTypeWorkflowExecutionContinuedAsNew, + EventTypeStartChildWorkflowExecutionInitiated, + EventTypeStartChildWorkflowExecutionFailed, + EventTypeChildWorkflowExecutionStarted, + EventTypeChildWorkflowExecutionCompleted, + EventTypeChildWorkflowExecutionFailed, + EventTypeChildWorkflowExecutionCanceled, + EventTypeChildWorkflowExecutionTimedOut, + EventTypeChildWorkflowExecutionTerminated, } - - return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -// FromWire deserializes a FailWorkflowExecutionDecisionAttributes 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 FailWorkflowExecutionDecisionAttributes struct -// from the provided intermediate representation. -// -// x, err := binaryProtocol.Decode(reader, wire.TStruct) -// if err != nil { -// return nil, err -// } +// UnmarshalText tries to decode EventType from a byte slice +// containing its name. // -// var v FailWorkflowExecutionDecisionAttributes -// if err := v.FromWire(x); err != nil { -// return nil, err -// } -// return &v, nil -func (v *FailWorkflowExecutionDecisionAttributes) 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 { - v.Details, err = field.Value.GetBinary(), error(nil) - if err != nil { - return err - } - - } - } - } - - return nil -} - -// String returns a readable string representation of a FailWorkflowExecutionDecisionAttributes -// struct. -func (v *FailWorkflowExecutionDecisionAttributes) String() string { - if v == nil { - return "" - } - - var fields [2]string - i := 0 - if v.Reason != nil { - fields[i] = fmt.Sprintf("Reason: %v", *(v.Reason)) - i++ - } - if v.Details != nil { - fields[i] = fmt.Sprintf("Details: %v", v.Details) - i++ +// var v EventType +// err := v.UnmarshalText([]byte("WorkflowExecutionStarted")) +func (v *EventType) UnmarshalText(value []byte) error { + switch string(value) { + case "WorkflowExecutionStarted": + *v = EventTypeWorkflowExecutionStarted + return nil + case "WorkflowExecutionCompleted": + *v = EventTypeWorkflowExecutionCompleted + return nil + case "WorkflowExecutionFailed": + *v = EventTypeWorkflowExecutionFailed + return nil + case "WorkflowExecutionTimedOut": + *v = EventTypeWorkflowExecutionTimedOut + return nil + case "DecisionTaskScheduled": + *v = EventTypeDecisionTaskScheduled + return nil + case "DecisionTaskStarted": + *v = EventTypeDecisionTaskStarted + return nil + case "DecisionTaskCompleted": + *v = EventTypeDecisionTaskCompleted + return nil + case "DecisionTaskTimedOut": + *v = EventTypeDecisionTaskTimedOut + return nil + case "DecisionTaskFailed": + *v = EventTypeDecisionTaskFailed + return nil + case "ActivityTaskScheduled": + *v = EventTypeActivityTaskScheduled + return nil + case "ActivityTaskStarted": + *v = EventTypeActivityTaskStarted + return nil + case "ActivityTaskCompleted": + *v = EventTypeActivityTaskCompleted + return nil + case "ActivityTaskFailed": + *v = EventTypeActivityTaskFailed + return nil + case "ActivityTaskTimedOut": + *v = EventTypeActivityTaskTimedOut + return nil + case "ActivityTaskCancelRequested": + *v = EventTypeActivityTaskCancelRequested + return nil + case "RequestCancelActivityTaskFailed": + *v = EventTypeRequestCancelActivityTaskFailed + return nil + case "ActivityTaskCanceled": + *v = EventTypeActivityTaskCanceled + return nil + case "TimerStarted": + *v = EventTypeTimerStarted + return nil + case "TimerFired": + *v = EventTypeTimerFired + return nil + case "CancelTimerFailed": + *v = EventTypeCancelTimerFailed + return nil + case "TimerCanceled": + *v = EventTypeTimerCanceled + return nil + case "WorkflowExecutionCancelRequested": + *v = EventTypeWorkflowExecutionCancelRequested + return nil + case "WorkflowExecutionCanceled": + *v = EventTypeWorkflowExecutionCanceled + return nil + case "RequestCancelExternalWorkflowExecutionInitiated": + *v = EventTypeRequestCancelExternalWorkflowExecutionInitiated + return nil + case "RequestCancelExternalWorkflowExecutionFailed": + *v = EventTypeRequestCancelExternalWorkflowExecutionFailed + return nil + case "ExternalWorkflowExecutionCancelRequested": + *v = EventTypeExternalWorkflowExecutionCancelRequested + return nil + case "MarkerRecorded": + *v = EventTypeMarkerRecorded + return nil + case "WorkflowExecutionSignaled": + *v = EventTypeWorkflowExecutionSignaled + return nil + case "WorkflowExecutionTerminated": + *v = EventTypeWorkflowExecutionTerminated + return nil + case "WorkflowExecutionContinuedAsNew": + *v = EventTypeWorkflowExecutionContinuedAsNew + return nil + case "StartChildWorkflowExecutionInitiated": + *v = EventTypeStartChildWorkflowExecutionInitiated + return nil + case "StartChildWorkflowExecutionFailed": + *v = EventTypeStartChildWorkflowExecutionFailed + return nil + case "ChildWorkflowExecutionStarted": + *v = EventTypeChildWorkflowExecutionStarted + return nil + case "ChildWorkflowExecutionCompleted": + *v = EventTypeChildWorkflowExecutionCompleted + return nil + case "ChildWorkflowExecutionFailed": + *v = EventTypeChildWorkflowExecutionFailed + return nil + case "ChildWorkflowExecutionCanceled": + *v = EventTypeChildWorkflowExecutionCanceled + return nil + case "ChildWorkflowExecutionTimedOut": + *v = EventTypeChildWorkflowExecutionTimedOut + return nil + case "ChildWorkflowExecutionTerminated": + *v = EventTypeChildWorkflowExecutionTerminated + return nil + default: + return fmt.Errorf("unknown enum value %q for %q", value, "EventType") } +} - return fmt.Sprintf("FailWorkflowExecutionDecisionAttributes{%v}", strings.Join(fields[:i], ", ")) +// ToWire translates EventType into a Thrift-level intermediate +// representation. This intermediate representation may be serialized +// into bytes using a ThriftRW protocol implementation. +// +// Enums are represented as 32-bit integers over the wire. +func (v EventType) ToWire() (wire.Value, error) { + return wire.NewValueI32(int32(v)), nil } -// Equals returns true if all the fields of this FailWorkflowExecutionDecisionAttributes match the -// provided FailWorkflowExecutionDecisionAttributes. +// FromWire deserializes EventType from its Thrift-level +// representation. // -// This function performs a deep comparison. -func (v *FailWorkflowExecutionDecisionAttributes) Equals(rhs *FailWorkflowExecutionDecisionAttributes) bool { - if !_String_EqualsPtr(v.Reason, rhs.Reason) { - return false - } - if !((v.Details == nil && rhs.Details == nil) || (v.Details != nil && rhs.Details != nil && bytes.Equal(v.Details, rhs.Details))) { - return false +// x, err := binaryProtocol.Decode(reader, wire.TI32) +// if err != nil { +// return EventType(0), err +// } +// +// var v EventType +// if err := v.FromWire(x); err != nil { +// return EventType(0), err +// } +// return v, nil +func (v *EventType) FromWire(w wire.Value) error { + *v = (EventType)(w.GetI32()) + return nil +} + +// String returns a readable string representation of EventType. +func (v EventType) String() string { + w := int32(v) + switch w { + case 0: + return "WorkflowExecutionStarted" + case 1: + return "WorkflowExecutionCompleted" + case 2: + return "WorkflowExecutionFailed" + case 3: + return "WorkflowExecutionTimedOut" + case 4: + return "DecisionTaskScheduled" + case 5: + return "DecisionTaskStarted" + case 6: + return "DecisionTaskCompleted" + case 7: + return "DecisionTaskTimedOut" + case 8: + return "DecisionTaskFailed" + case 9: + return "ActivityTaskScheduled" + case 10: + return "ActivityTaskStarted" + case 11: + return "ActivityTaskCompleted" + case 12: + return "ActivityTaskFailed" + case 13: + return "ActivityTaskTimedOut" + case 14: + return "ActivityTaskCancelRequested" + case 15: + return "RequestCancelActivityTaskFailed" + case 16: + return "ActivityTaskCanceled" + case 17: + return "TimerStarted" + case 18: + return "TimerFired" + case 19: + return "CancelTimerFailed" + case 20: + return "TimerCanceled" + case 21: + return "WorkflowExecutionCancelRequested" + case 22: + return "WorkflowExecutionCanceled" + case 23: + return "RequestCancelExternalWorkflowExecutionInitiated" + case 24: + return "RequestCancelExternalWorkflowExecutionFailed" + case 25: + return "ExternalWorkflowExecutionCancelRequested" + case 26: + return "MarkerRecorded" + case 27: + return "WorkflowExecutionSignaled" + case 28: + return "WorkflowExecutionTerminated" + case 29: + return "WorkflowExecutionContinuedAsNew" + case 30: + return "StartChildWorkflowExecutionInitiated" + case 31: + return "StartChildWorkflowExecutionFailed" + case 32: + return "ChildWorkflowExecutionStarted" + case 33: + return "ChildWorkflowExecutionCompleted" + case 34: + return "ChildWorkflowExecutionFailed" + case 35: + return "ChildWorkflowExecutionCanceled" + case 36: + return "ChildWorkflowExecutionTimedOut" + case 37: + return "ChildWorkflowExecutionTerminated" } + return fmt.Sprintf("EventType(%d)", w) +} - return true +// Equals returns true if this EventType value matches the provided +// value. +func (v EventType) Equals(rhs EventType) bool { + return v == rhs } -// GetReason returns the value of Reason if it is set or its -// zero value if it is unset. -func (v *FailWorkflowExecutionDecisionAttributes) GetReason() (o string) { - if v.Reason != nil { - return *v.Reason +// MarshalJSON serializes EventType into JSON. +// +// If the enum value is recognized, its name is returned. Otherwise, +// its integer value is returned. +// +// This implements json.Marshaler. +func (v EventType) MarshalJSON() ([]byte, error) { + switch int32(v) { + case 0: + return ([]byte)("\"WorkflowExecutionStarted\""), nil + case 1: + return ([]byte)("\"WorkflowExecutionCompleted\""), nil + case 2: + return ([]byte)("\"WorkflowExecutionFailed\""), nil + case 3: + return ([]byte)("\"WorkflowExecutionTimedOut\""), nil + case 4: + return ([]byte)("\"DecisionTaskScheduled\""), nil + case 5: + return ([]byte)("\"DecisionTaskStarted\""), nil + case 6: + return ([]byte)("\"DecisionTaskCompleted\""), nil + case 7: + return ([]byte)("\"DecisionTaskTimedOut\""), nil + case 8: + return ([]byte)("\"DecisionTaskFailed\""), nil + case 9: + return ([]byte)("\"ActivityTaskScheduled\""), nil + case 10: + return ([]byte)("\"ActivityTaskStarted\""), nil + case 11: + return ([]byte)("\"ActivityTaskCompleted\""), nil + case 12: + return ([]byte)("\"ActivityTaskFailed\""), nil + case 13: + return ([]byte)("\"ActivityTaskTimedOut\""), nil + case 14: + return ([]byte)("\"ActivityTaskCancelRequested\""), nil + case 15: + return ([]byte)("\"RequestCancelActivityTaskFailed\""), nil + case 16: + return ([]byte)("\"ActivityTaskCanceled\""), nil + case 17: + return ([]byte)("\"TimerStarted\""), nil + case 18: + return ([]byte)("\"TimerFired\""), nil + case 19: + return ([]byte)("\"CancelTimerFailed\""), nil + case 20: + return ([]byte)("\"TimerCanceled\""), nil + case 21: + return ([]byte)("\"WorkflowExecutionCancelRequested\""), nil + case 22: + return ([]byte)("\"WorkflowExecutionCanceled\""), nil + case 23: + return ([]byte)("\"RequestCancelExternalWorkflowExecutionInitiated\""), nil + case 24: + return ([]byte)("\"RequestCancelExternalWorkflowExecutionFailed\""), nil + case 25: + return ([]byte)("\"ExternalWorkflowExecutionCancelRequested\""), nil + case 26: + return ([]byte)("\"MarkerRecorded\""), nil + case 27: + return ([]byte)("\"WorkflowExecutionSignaled\""), nil + case 28: + return ([]byte)("\"WorkflowExecutionTerminated\""), nil + case 29: + return ([]byte)("\"WorkflowExecutionContinuedAsNew\""), nil + case 30: + return ([]byte)("\"StartChildWorkflowExecutionInitiated\""), nil + case 31: + return ([]byte)("\"StartChildWorkflowExecutionFailed\""), nil + case 32: + return ([]byte)("\"ChildWorkflowExecutionStarted\""), nil + case 33: + return ([]byte)("\"ChildWorkflowExecutionCompleted\""), nil + case 34: + return ([]byte)("\"ChildWorkflowExecutionFailed\""), nil + case 35: + return ([]byte)("\"ChildWorkflowExecutionCanceled\""), nil + case 36: + return ([]byte)("\"ChildWorkflowExecutionTimedOut\""), nil + case 37: + return ([]byte)("\"ChildWorkflowExecutionTerminated\""), nil + } + return ([]byte)(strconv.FormatInt(int64(v), 10)), nil +} + +// UnmarshalJSON attempts to decode EventType from its JSON +// representation. +// +// This implementation supports both, numeric and string inputs. If a +// string is provided, it must be a known enum name. +// +// This implements json.Unmarshaler. +func (v *EventType) UnmarshalJSON(text []byte) error { + d := json.NewDecoder(bytes.NewReader(text)) + d.UseNumber() + t, err := d.Token() + if err != nil { + return err + } + + switch w := t.(type) { + case json.Number: + x, err := w.Int64() + if err != nil { + return err + } + if x > math.MaxInt32 { + return fmt.Errorf("enum overflow from JSON %q for %q", text, "EventType") + } + if x < math.MinInt32 { + return fmt.Errorf("enum underflow from JSON %q for %q", text, "EventType") + } + *v = (EventType)(x) + return nil + case string: + return v.UnmarshalText([]byte(w)) + default: + return fmt.Errorf("invalid JSON value %q (%T) to unmarshal into %q", t, t, "EventType") } - - return } -type GetPollerHistoryRequest struct { - Domain *string `json:"domain,omitempty"` - TaskList *TaskList `json:"taskList,omitempty"` - TaskListType *TaskListType `json:"taskListType,omitempty"` +type ExternalWorkflowExecutionCancelRequestedEventAttributes struct { + InitiatedEventId *int64 `json:"initiatedEventId,omitempty"` + Domain *string `json:"domain,omitempty"` + WorkflowExecution *WorkflowExecution `json:"workflowExecution,omitempty"` } -// ToWire translates a GetPollerHistoryRequest struct into a Thrift-level intermediate +// ToWire translates a ExternalWorkflowExecutionCancelRequestedEventAttributes struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -8924,7 +8972,7 @@ type GetPollerHistoryRequest struct { // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *GetPollerHistoryRequest) ToWire() (wire.Value, error) { +func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) ToWire() (wire.Value, error) { var ( fields [3]wire.Field i int = 0 @@ -8932,24 +8980,24 @@ func (v *GetPollerHistoryRequest) ToWire() (wire.Value, error) { err error ) - if v.Domain != nil { - w, err = wire.NewValueString(*(v.Domain)), error(nil) + if v.InitiatedEventId != nil { + w, err = wire.NewValueI64(*(v.InitiatedEventId)), error(nil) if err != nil { return w, err } fields[i] = wire.Field{ID: 10, Value: w} i++ } - if v.TaskList != nil { - w, err = v.TaskList.ToWire() + if v.Domain != nil { + w, err = wire.NewValueString(*(v.Domain)), error(nil) if err != nil { return w, err } fields[i] = wire.Field{ID: 20, Value: w} i++ } - if v.TaskListType != nil { - w, err = v.TaskListType.ToWire() + if v.WorkflowExecution != nil { + w, err = v.WorkflowExecution.ToWire() if err != nil { return w, err } @@ -8960,17 +9008,11 @@ func (v *GetPollerHistoryRequest) ToWire() (wire.Value, error) { return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -func _TaskListType_Read(w wire.Value) (TaskListType, error) { - var v TaskListType - err := v.FromWire(w) - return v, err -} - -// FromWire deserializes a GetPollerHistoryRequest struct from its Thrift-level +// FromWire deserializes a ExternalWorkflowExecutionCancelRequestedEventAttributes 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 GetPollerHistoryRequest struct +// An error is returned if we were unable to build a ExternalWorkflowExecutionCancelRequestedEventAttributes struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -8978,39 +9020,39 @@ func _TaskListType_Read(w wire.Value) (TaskListType, error) { // return nil, err // } // -// var v GetPollerHistoryRequest +// var v ExternalWorkflowExecutionCancelRequestedEventAttributes // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *GetPollerHistoryRequest) FromWire(w wire.Value) error { +func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) 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 field.Value.Type() == wire.TI64 { + var x int64 + x, err = field.Value.GetI64(), error(nil) + v.InitiatedEventId = &x if err != nil { return err } } case 20: - if field.Value.Type() == wire.TStruct { - v.TaskList, err = _TaskList_Read(field.Value) + 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 30: - if field.Value.Type() == wire.TI32 { - var x TaskListType - x, err = _TaskListType_Read(field.Value) - v.TaskListType = &x + if field.Value.Type() == wire.TStruct { + v.WorkflowExecution, err = _WorkflowExecution_Read(field.Value) if err != nil { return err } @@ -9022,113 +9064,75 @@ func (v *GetPollerHistoryRequest) FromWire(w wire.Value) error { return nil } -// String returns a readable string representation of a GetPollerHistoryRequest +// String returns a readable string representation of a ExternalWorkflowExecutionCancelRequestedEventAttributes // struct. -func (v *GetPollerHistoryRequest) String() string { +func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) String() string { if v == nil { return "" } var fields [3]string i := 0 - if v.Domain != nil { - fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) + if v.InitiatedEventId != nil { + fields[i] = fmt.Sprintf("InitiatedEventId: %v", *(v.InitiatedEventId)) i++ } - if v.TaskList != nil { - fields[i] = fmt.Sprintf("TaskList: %v", v.TaskList) + if v.Domain != nil { + fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain)) i++ } - if v.TaskListType != nil { - fields[i] = fmt.Sprintf("TaskListType: %v", *(v.TaskListType)) + if v.WorkflowExecution != nil { + fields[i] = fmt.Sprintf("WorkflowExecution: %v", v.WorkflowExecution) i++ } - return fmt.Sprintf("GetPollerHistoryRequest{%v}", strings.Join(fields[:i], ", ")) -} - -func _TaskListType_EqualsPtr(lhs, rhs *TaskListType) bool { - if lhs != nil && rhs != nil { - - x := *lhs - y := *rhs - return x.Equals(y) - } - return lhs == nil && rhs == nil + return fmt.Sprintf("ExternalWorkflowExecutionCancelRequestedEventAttributes{%v}", strings.Join(fields[:i], ", ")) } -// Equals returns true if all the fields of this GetPollerHistoryRequest match the -// provided GetPollerHistoryRequest. +// Equals returns true if all the fields of this ExternalWorkflowExecutionCancelRequestedEventAttributes match the +// provided ExternalWorkflowExecutionCancelRequestedEventAttributes. // // This function performs a deep comparison. -func (v *GetPollerHistoryRequest) Equals(rhs *GetPollerHistoryRequest) bool { - if !_String_EqualsPtr(v.Domain, rhs.Domain) { +func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) Equals(rhs *ExternalWorkflowExecutionCancelRequestedEventAttributes) bool { + if !_I64_EqualsPtr(v.InitiatedEventId, rhs.InitiatedEventId) { return false } - if !((v.TaskList == nil && rhs.TaskList == nil) || (v.TaskList != nil && rhs.TaskList != nil && v.TaskList.Equals(rhs.TaskList))) { + if !_String_EqualsPtr(v.Domain, rhs.Domain) { return false } - if !_TaskListType_EqualsPtr(v.TaskListType, rhs.TaskListType) { + if !((v.WorkflowExecution == nil && rhs.WorkflowExecution == nil) || (v.WorkflowExecution != nil && rhs.WorkflowExecution != nil && v.WorkflowExecution.Equals(rhs.WorkflowExecution))) { return false } return true } -// GetDomain returns the value of Domain if it is set or its +// GetInitiatedEventId returns the value of InitiatedEventId if it is set or its // zero value if it is unset. -func (v *GetPollerHistoryRequest) GetDomain() (o string) { - if v.Domain != nil { - return *v.Domain +func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) GetInitiatedEventId() (o int64) { + if v.InitiatedEventId != nil { + return *v.InitiatedEventId } return } -// GetTaskListType returns the value of TaskListType if it is set or its +// GetDomain returns the value of Domain if it is set or its // zero value if it is unset. -func (v *GetPollerHistoryRequest) GetTaskListType() (o TaskListType) { - if v.TaskListType != nil { - return *v.TaskListType +func (v *ExternalWorkflowExecutionCancelRequestedEventAttributes) GetDomain() (o string) { + if v.Domain != nil { + return *v.Domain } return } -type GetPollerHistoryResponse struct { - Pollers []*PollerInfo `json:"pollers,omitempty"` -} - -type _List_PollerInfo_ValueList []*PollerInfo - -func (v _List_PollerInfo_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_PollerInfo_ValueList) Size() int { - return len(v) -} - -func (_List_PollerInfo_ValueList) ValueType() wire.Type { - return wire.TStruct +type FailWorkflowExecutionDecisionAttributes struct { + Reason *string `json:"reason,omitempty"` + Details []byte `json:"details,omitempty"` } -func (_List_PollerInfo_ValueList) Close() {} - -// ToWire translates a GetPollerHistoryResponse struct into a Thrift-level intermediate +// ToWire translates a FailWorkflowExecutionDecisionAttributes struct into a Thrift-level intermediate // representation. This intermediate representation may be serialized // into bytes using a ThriftRW protocol implementation. // @@ -9143,55 +9147,39 @@ func (_List_PollerInfo_ValueList) Close() {} // if err := binaryProtocol.Encode(x, writer); err != nil { // return err // } -func (v *GetPollerHistoryResponse) ToWire() (wire.Value, error) { +func (v *FailWorkflowExecutionDecisionAttributes) ToWire() (wire.Value, error) { var ( - fields [1]wire.Field + fields [2]wire.Field i int = 0 w wire.Value err error ) - if v.Pollers != nil { - w, err = wire.NewValueList(_List_PollerInfo_ValueList(v.Pollers)), error(nil) + 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++ } - - return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil -} - -func _PollerInfo_Read(w wire.Value) (*PollerInfo, error) { - var v PollerInfo - err := v.FromWire(w) - return &v, err -} - -func _List_PollerInfo_Read(l wire.ValueList) ([]*PollerInfo, error) { - if l.ValueType() != wire.TStruct { - return nil, nil - } - - o := make([]*PollerInfo, 0, l.Size()) - err := l.ForEach(func(x wire.Value) error { - i, err := _PollerInfo_Read(x) + if v.Details != nil { + w, err = wire.NewValueBinary(v.Details), error(nil) if err != nil { - return err + return w, err } - o = append(o, i) - return nil - }) - l.Close() - return o, err + fields[i] = wire.Field{ID: 20, Value: w} + i++ + } + + return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil } -// FromWire deserializes a GetPollerHistoryResponse struct from its Thrift-level +// FromWire deserializes a FailWorkflowExecutionDecisionAttributes 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 GetPollerHistoryResponse struct +// An error is returned if we were unable to build a FailWorkflowExecutionDecisionAttributes struct // from the provided intermediate representation. // // x, err := binaryProtocol.Decode(reader, wire.TStruct) @@ -9199,19 +9187,29 @@ func _List_PollerInfo_Read(l wire.ValueList) ([]*PollerInfo, error) { // return nil, err // } // -// var v GetPollerHistoryResponse +// var v FailWorkflowExecutionDecisionAttributes // if err := v.FromWire(x); err != nil { // return nil, err // } // return &v, nil -func (v *GetPollerHistoryResponse) FromWire(w wire.Value) error { +func (v *FailWorkflowExecutionDecisionAttributes) 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.Pollers, err = _List_PollerInfo_Read(field.Value.GetList()) + 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 { + v.Details, err = field.Value.GetBinary(), error(nil) if err != nil { return err } @@ -9223,48 +9221,50 @@ func (v *GetPollerHistoryResponse) FromWire(w wire.Value) error { return nil } -// String returns a readable string representation of a GetPollerHistoryResponse +// String returns a readable string representation of a FailWorkflowExecutionDecisionAttributes // struct. -func (v *GetPollerHistoryResponse) String() string { +func (v *FailWorkflowExecutionDecisionAttributes) String() string { if v == nil { return "" } - var fields [1]string + var fields [2]string i := 0 - if v.Pollers != nil { - fields[i] = fmt.Sprintf("Pollers: %v", v.Pollers) + if v.Reason != nil { + fields[i] = fmt.Sprintf("Reason: %v", *(v.Reason)) + i++ + } + if v.Details != nil { + fields[i] = fmt.Sprintf("Details: %v", v.Details) i++ } - return fmt.Sprintf("GetPollerHistoryResponse{%v}", strings.Join(fields[:i], ", ")) + return fmt.Sprintf("FailWorkflowExecutionDecisionAttributes{%v}", strings.Join(fields[:i], ", ")) } -func _List_PollerInfo_Equals(lhs, rhs []*PollerInfo) bool { - if len(lhs) != len(rhs) { +// Equals returns true if all the fields of this FailWorkflowExecutionDecisionAttributes match the +// provided FailWorkflowExecutionDecisionAttributes. +// +// This function performs a deep comparison. +func (v *FailWorkflowExecutionDecisionAttributes) Equals(rhs *FailWorkflowExecutionDecisionAttributes) bool { + if !_String_EqualsPtr(v.Reason, rhs.Reason) { return false } - - for i, lv := range lhs { - rv := rhs[i] - if !lv.Equals(rv) { - return false - } + if !((v.Details == nil && rhs.Details == nil) || (v.Details != nil && rhs.Details != nil && bytes.Equal(v.Details, rhs.Details))) { + return false } return true } -// Equals returns true if all the fields of this GetPollerHistoryResponse match the -// provided GetPollerHistoryResponse. -// -// This function performs a deep comparison. -func (v *GetPollerHistoryResponse) Equals(rhs *GetPollerHistoryResponse) bool { - if !((v.Pollers == nil && rhs.Pollers == nil) || (v.Pollers != nil && rhs.Pollers != nil && _List_PollerInfo_Equals(v.Pollers, rhs.Pollers))) { - return false +// GetReason returns the value of Reason if it is set or its +// zero value if it is unset. +func (v *FailWorkflowExecutionDecisionAttributes) GetReason() (o string) { + if v.Reason != nil { + return *v.Reason } - return true + return } type GetWorkflowExecutionHistoryRequest struct { @@ -13472,7 +13472,7 @@ func (v *PollForDecisionTaskResponse) GetBacklogCountHint() (o int64) { } type PollerInfo struct { - Timestamp *string `json:"timestamp,omitempty"` + Timestamp *int64 `json:"timestamp,omitempty"` Identity *string `json:"identity,omitempty"` } @@ -13500,7 +13500,7 @@ func (v *PollerInfo) ToWire() (wire.Value, error) { ) if v.Timestamp != nil { - w, err = wire.NewValueString(*(v.Timestamp)), error(nil) + w, err = wire.NewValueI64(*(v.Timestamp)), error(nil) if err != nil { return w, err } @@ -13542,9 +13542,9 @@ func (v *PollerInfo) FromWire(w wire.Value) 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) + if field.Value.Type() == wire.TI64 { + var x int64 + x, err = field.Value.GetI64(), error(nil) v.Timestamp = &x if err != nil { return err @@ -13593,7 +13593,7 @@ func (v *PollerInfo) String() string { // // This function performs a deep comparison. func (v *PollerInfo) Equals(rhs *PollerInfo) bool { - if !_String_EqualsPtr(v.Timestamp, rhs.Timestamp) { + if !_I64_EqualsPtr(v.Timestamp, rhs.Timestamp) { return false } if !_String_EqualsPtr(v.Identity, rhs.Identity) { @@ -13605,7 +13605,7 @@ func (v *PollerInfo) Equals(rhs *PollerInfo) bool { // GetTimestamp returns the value of Timestamp if it is set or its // zero value if it is unset. -func (v *PollerInfo) GetTimestamp() (o string) { +func (v *PollerInfo) GetTimestamp() (o int64) { if v.Timestamp != nil { return *v.Timestamp } diff --git a/client/matching/client.go b/client/matching/client.go index 12d94697f6c..7dd894bbbd3 100644 --- a/client/matching/client.go +++ b/client/matching/client.go @@ -62,7 +62,7 @@ func (c *clientImpl) AddActivityTask( addRequest *m.AddActivityTaskRequest, opts ...yarpc.CallOption) error { opts = common.AggregateYarpcOptions(ctx, opts...) - client, err := c.getHostForRequest(*addRequest.TaskList.Name) + client, err := c.getHostForRequest(addRequest.TaskList.GetName()) if err != nil { return err } @@ -76,7 +76,7 @@ func (c *clientImpl) AddDecisionTask( addRequest *m.AddDecisionTaskRequest, opts ...yarpc.CallOption) error { opts = common.AggregateYarpcOptions(ctx, opts...) - client, err := c.getHostForRequest(*addRequest.TaskList.Name) + client, err := c.getHostForRequest(addRequest.TaskList.GetName()) if err != nil { return err } @@ -90,7 +90,7 @@ func (c *clientImpl) PollForActivityTask( pollRequest *m.PollForActivityTaskRequest, opts ...yarpc.CallOption) (*workflow.PollForActivityTaskResponse, error) { opts = common.AggregateYarpcOptions(ctx, opts...) - client, err := c.getHostForRequest(*pollRequest.PollRequest.TaskList.Name) + client, err := c.getHostForRequest(pollRequest.PollRequest.TaskList.GetName()) if err != nil { return nil, err } @@ -104,7 +104,7 @@ func (c *clientImpl) PollForDecisionTask( pollRequest *m.PollForDecisionTaskRequest, opts ...yarpc.CallOption) (*m.PollForDecisionTaskResponse, error) { opts = common.AggregateYarpcOptions(ctx, opts...) - client, err := c.getHostForRequest(*pollRequest.PollRequest.TaskList.Name) + client, err := c.getHostForRequest(pollRequest.PollRequest.TaskList.GetName()) if err != nil { return nil, err } @@ -115,7 +115,7 @@ func (c *clientImpl) PollForDecisionTask( func (c *clientImpl) QueryWorkflow(ctx context.Context, queryRequest *m.QueryWorkflowRequest, opts ...yarpc.CallOption) (*workflow.QueryWorkflowResponse, error) { opts = common.AggregateYarpcOptions(ctx, opts...) - client, err := c.getHostForRequest(*queryRequest.TaskList.Name) + client, err := c.getHostForRequest(queryRequest.TaskList.GetName()) if err != nil { return nil, err } @@ -126,7 +126,7 @@ func (c *clientImpl) QueryWorkflow(ctx context.Context, queryRequest *m.QueryWor func (c *clientImpl) RespondQueryTaskCompleted(ctx context.Context, request *m.RespondQueryTaskCompletedRequest, opts ...yarpc.CallOption) error { opts = common.AggregateYarpcOptions(ctx, opts...) - client, err := c.getHostForRequest(*request.TaskList.Name) + client, err := c.getHostForRequest(request.TaskList.GetName()) if err != nil { return err } @@ -137,7 +137,7 @@ func (c *clientImpl) RespondQueryTaskCompleted(ctx context.Context, request *m.R func (c *clientImpl) CancelOutstandingPoll(ctx context.Context, request *m.CancelOutstandingPollRequest, opts ...yarpc.CallOption) error { opts = common.AggregateYarpcOptions(ctx, opts...) - client, err := c.getHostForRequest(*request.TaskList.Name) + client, err := c.getHostForRequest(request.TaskList.GetName()) if err != nil { return err } @@ -146,15 +146,15 @@ func (c *clientImpl) CancelOutstandingPoll(ctx context.Context, request *m.Cance return client.CancelOutstandingPoll(ctx, request, opts...) } -func (c *clientImpl) GetPollerHistory(ctx context.Context, request *m.GetPollerHistoryRequest, opts ...yarpc.CallOption) (*workflow.GetPollerHistoryResponse, error) { +func (c *clientImpl) DescribeTaskList(ctx context.Context, request *m.DescribeTaskListRequest, opts ...yarpc.CallOption) (*workflow.DescribeTaskListResponse, error) { opts = common.AggregateYarpcOptions(ctx, opts...) - client, err := c.getHostForRequest(request.GetRequest.TaskList.GetName()) + client, err := c.getHostForRequest(request.DescRequest.TaskList.GetName()) if err != nil { return nil, err } ctx, cancel := c.createContext(ctx) defer cancel() - return client.GetPollerHistory(ctx, request, opts...) + return client.DescribeTaskList(ctx, request, opts...) } func (c *clientImpl) getHostForRequest(key string) (matchingserviceclient.Interface, error) { diff --git a/client/matching/metricClient.go b/client/matching/metricClient.go index 526e4cea92a..7c381342b68 100644 --- a/client/matching/metricClient.go +++ b/client/matching/metricClient.go @@ -163,18 +163,18 @@ func (c *metricClient) CancelOutstandingPoll( return err } -func (c *metricClient) GetPollerHistory( +func (c *metricClient) DescribeTaskList( ctx context.Context, - request *m.GetPollerHistoryRequest, - opts ...yarpc.CallOption) (*workflow.GetPollerHistoryResponse, error) { - c.metricsClient.IncCounter(metrics.MatchingClientGetPollerHistoryScope, metrics.CadenceRequests) + request *m.DescribeTaskListRequest, + opts ...yarpc.CallOption) (*workflow.DescribeTaskListResponse, error) { + c.metricsClient.IncCounter(metrics.MatchingClientDescribeTaskListScope, metrics.CadenceRequests) - sw := c.metricsClient.StartTimer(metrics.MatchingClientGetPollerHistoryScope, metrics.CadenceLatency) - resp, err := c.client.GetPollerHistory(ctx, request, opts...) + sw := c.metricsClient.StartTimer(metrics.MatchingClientDescribeTaskListScope, metrics.CadenceLatency) + resp, err := c.client.DescribeTaskList(ctx, request, opts...) sw.Stop() if err != nil { - c.metricsClient.IncCounter(metrics.MatchingClientGetPollerHistoryScope, metrics.CadenceFailures) + c.metricsClient.IncCounter(metrics.MatchingClientDescribeTaskListScope, metrics.CadenceFailures) } return resp, err diff --git a/common/convert.go b/common/convert.go index 4346ba596e8..310d0637ba4 100644 --- a/common/convert.go +++ b/common/convert.go @@ -62,8 +62,8 @@ func BoolPtr(v bool) *bool { } // TimePtr makes a copy and returns the pointer to a string for time.Time, as ISO 8601 format. -func TimePtr(v time.Time) *string { - time := v.UTC().Format(time.RFC3339) +func TimePtr(v time.Time) *int64 { + time := v.UTC().UnixNano() return &time } diff --git a/common/metrics/defs.go b/common/metrics/defs.go index f40d9dec154..d56805a6a98 100644 --- a/common/metrics/defs.go +++ b/common/metrics/defs.go @@ -207,8 +207,8 @@ const ( MatchingClientRespondQueryTaskCompletedScope // MatchingClientCancelOutstandingPollScope tracks RPC calls to matching service MatchingClientCancelOutstandingPollScope - // MatchingClientGetPollerHistoryScope tracks RPC calls to matching service - MatchingClientGetPollerHistoryScope + // MatchingClientDescribeTaskListScope tracks RPC calls to matching service + MatchingClientDescribeTaskListScope NumCommonScopes ) @@ -265,8 +265,8 @@ const ( FrontendQueryWorkflowScope // FrontendDescribeWorkflowExecutionScope is the metric scope for frontend.DescribeWorkflowExecution FrontendDescribeWorkflowExecutionScope - // FrontendGetPollerHistoryScope is the metric scope for frontend.GetPollerHistory - FrontendGetPollerHistoryScope + // FrontendDescribeTaskListScope is the metric scope for frontend.DescribeTaskList + FrontendDescribeTaskListScope NumFrontendScopes ) @@ -355,8 +355,8 @@ const ( MatchingRespondQueryTaskCompletedScope // MatchingCancelOutstandingPollScope tracks CancelOutstandingPoll API calls received by service MatchingCancelOutstandingPollScope - // MatchingGetPollerHistoryScope tracks GetPollerHistory API calls received by service - MatchingGetPollerHistoryScope + // MatchingDescribeTaskListScope tracks DescribeTaskList API calls received by service + MatchingDescribeTaskListScope NumMatchingScopes ) @@ -414,7 +414,7 @@ var ScopeDefs = map[ServiceIdx]map[int]scopeDefinition{ MatchingClientQueryWorkflowScope: {operation: "MatchingClientQueryWorkflow"}, MatchingClientRespondQueryTaskCompletedScope: {operation: "MatchingClientRespondQueryTaskCompleted"}, MatchingClientCancelOutstandingPollScope: {operation: "MatchingClientCancelOutstandingPoll"}, - MatchingClientGetPollerHistoryScope: {operation: "MatchingClientGetPollerHistory"}, + MatchingClientDescribeTaskListScope: {operation: "MatchingClientDescribeTaskList"}, }, // Frontend Scope Names Frontend: { @@ -443,7 +443,7 @@ var ScopeDefs = map[ServiceIdx]map[int]scopeDefinition{ FrontendDeprecateDomainScope: {operation: "DeprecateDomain"}, FrontendQueryWorkflowScope: {operation: "QueryWorkflow"}, FrontendDescribeWorkflowExecutionScope: {operation: "DescribeWorkflowExecution"}, - FrontendGetPollerHistoryScope: {operation: "GetPollerHistory"}, + FrontendDescribeTaskListScope: {operation: "DescribeTaskList"}, }, // History Scope Names History: { @@ -488,7 +488,7 @@ var ScopeDefs = map[ServiceIdx]map[int]scopeDefinition{ MatchingQueryWorkflowScope: {operation: "QueryWorkflow"}, MatchingRespondQueryTaskCompletedScope: {operation: "RespondQueryTaskCompleted"}, MatchingCancelOutstandingPollScope: {operation: "CancelOutstandingPoll"}, - MatchingGetPollerHistoryScope: {operation: "GetPollerHistory"}, + MatchingDescribeTaskListScope: {operation: "DescribeTaskList"}, }, } diff --git a/common/mocks/MatchingClient.go b/common/mocks/MatchingClient.go index b40f33b2d1e..c1295650db7 100644 --- a/common/mocks/MatchingClient.go +++ b/common/mocks/MatchingClient.go @@ -165,22 +165,22 @@ func (_m *MatchingClient) CancelOutstandingPoll(ctx context.Context, return r0 } -// GetPollerHistory provides a mock function with given fields: ctx, request -func (_m *MatchingClient) GetPollerHistory(ctx context.Context, - request *matching.GetPollerHistoryRequest, opts ...yarpc.CallOption) (*shared.GetPollerHistoryResponse, error) { +// DescribeTaskList provides a mock function with given fields: ctx, request +func (_m *MatchingClient) DescribeTaskList(ctx context.Context, + request *matching.DescribeTaskListRequest, opts ...yarpc.CallOption) (*shared.DescribeTaskListResponse, error) { ret := _m.Called(ctx, request) - var r0 *shared.GetPollerHistoryResponse - if rf, ok := ret.Get(0).(func(context.Context, *matching.GetPollerHistoryRequest) *shared.GetPollerHistoryResponse); ok { + var r0 *shared.DescribeTaskListResponse + if rf, ok := ret.Get(0).(func(context.Context, *matching.DescribeTaskListRequest) *shared.DescribeTaskListResponse); ok { r0 = rf(ctx, request) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*shared.GetPollerHistoryResponse) + r0 = ret.Get(0).(*shared.DescribeTaskListResponse) } } var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *matching.GetPollerHistoryRequest) error); ok { + if rf, ok := ret.Get(1).(func(context.Context, *matching.DescribeTaskListRequest) error); ok { r1 = rf(ctx, request) } else { r1 = ret.Error(1) diff --git a/host/integration_test.go b/host/integration_test.go index a7391295945..171a266b8bf 100644 --- a/host/integration_test.go +++ b/host/integration_test.go @@ -3621,7 +3621,7 @@ func (s *integrationSuite) TestGetWorkflowExecutionHistoryLongPoll() { s.Equal(11, len(allEvents)) } -func (s *integrationSuite) TestGetPollerHistory() { +func (s *integrationSuite) TestDescribeTaskList() { workflowID := "interation-get-poller-history" identity := "worker1" activityName := "activity_type1" @@ -3706,8 +3706,8 @@ func (s *integrationSuite) TestGetPollerHistory() { } // this function poll events from history side - testGetPollerHistory := func(domain string, tasklist *workflow.TaskList, tasklistType workflow.TaskListType) []*workflow.PollerInfo { - responseInner, errInner := s.engine.GetPollerHistory(createContext(), &workflow.GetPollerHistoryRequest{ + testDescribeTaskList := func(domain string, tasklist *workflow.TaskList, tasklistType workflow.TaskListType) []*workflow.PollerInfo { + responseInner, errInner := s.engine.DescribeTaskList(createContext(), &workflow.DescribeTaskListRequest{ Domain: common.StringPtr(domain), TaskList: taskList, TaskListType: &tasklistType, @@ -3717,30 +3717,35 @@ func (s *integrationSuite) TestGetPollerHistory() { return responseInner.Pollers } + before := time.Now() + // when no one polling on the tasklist (activity or decition), there shall be no poller information - pollerInfos := testGetPollerHistory(s.domainName, taskList, workflow.TaskListTypeActivity) + pollerInfos := testDescribeTaskList(s.domainName, taskList, workflow.TaskListTypeActivity) s.Empty(pollerInfos) - pollerInfos = testGetPollerHistory(s.domainName, taskList, workflow.TaskListTypeDecision) + pollerInfos = testDescribeTaskList(s.domainName, taskList, workflow.TaskListTypeDecision) s.Empty(pollerInfos) _, errDecision := poller.pollAndProcessDecisionTask(false, false) s.Nil(errDecision) - pollerInfos = testGetPollerHistory(s.domainName, taskList, workflow.TaskListTypeActivity) + pollerInfos = testDescribeTaskList(s.domainName, taskList, workflow.TaskListTypeActivity) s.Empty(pollerInfos) - pollerInfos = testGetPollerHistory(s.domainName, taskList, workflow.TaskListTypeDecision) + pollerInfos = testDescribeTaskList(s.domainName, taskList, workflow.TaskListTypeDecision) s.Equal(1, len(pollerInfos)) s.Equal(identity, pollerInfos[0].GetIdentity()) + s.True(time.Unix(0, pollerInfos[0].GetTimestamp()).After(before)) s.NotEmpty(pollerInfos[0].GetTimestamp()) errActivity := poller.pollAndProcessActivityTask(false) s.Nil(errActivity) - pollerInfos = testGetPollerHistory(s.domainName, taskList, workflow.TaskListTypeActivity) + pollerInfos = testDescribeTaskList(s.domainName, taskList, workflow.TaskListTypeActivity) s.Equal(1, len(pollerInfos)) s.Equal(identity, pollerInfos[0].GetIdentity()) + s.True(time.Unix(0, pollerInfos[0].GetTimestamp()).After(before)) s.NotEmpty(pollerInfos[0].GetTimestamp()) - pollerInfos = testGetPollerHistory(s.domainName, taskList, workflow.TaskListTypeDecision) + pollerInfos = testDescribeTaskList(s.domainName, taskList, workflow.TaskListTypeDecision) s.Equal(1, len(pollerInfos)) s.Equal(identity, pollerInfos[0].GetIdentity()) + s.True(time.Unix(0, pollerInfos[0].GetTimestamp()).After(before)) s.NotEmpty(pollerInfos[0].GetTimestamp()) } diff --git a/idl/github.com/uber/cadence/cadence.thrift b/idl/github.com/uber/cadence/cadence.thrift index 466a822abef..cfa2597c5bd 100644 --- a/idl/github.com/uber/cadence/cadence.thrift +++ b/idl/github.com/uber/cadence/cadence.thrift @@ -352,9 +352,10 @@ service WorkflowService { ) /** - * GetPollerHistory returns pollers which poll from given tasklist in last few minutes. + * DescribeTaskList returns information about the target tasklist, right now this API returns the + * pollers which polled this tasklist in last few minutes. **/ - shared.GetPollerHistoryResponse GetPollerHistory(1: shared.GetPollerHistoryRequest request) + shared.DescribeTaskListResponse DescribeTaskList(1: shared.DescribeTaskListRequest request) throws ( 1: shared.BadRequestError badRequestError, 2: shared.InternalServiceError internalServiceError, diff --git a/idl/github.com/uber/cadence/matching.thrift b/idl/github.com/uber/cadence/matching.thrift index c557befd9d6..e34f6b4a6b5 100644 --- a/idl/github.com/uber/cadence/matching.thrift +++ b/idl/github.com/uber/cadence/matching.thrift @@ -85,9 +85,9 @@ struct CancelOutstandingPollRequest { 40: optional string pollerID } -struct GetPollerHistoryRequest { +struct DescribeTaskListRequest { 10: optional string domainUUID - 20: optional shared.GetPollerHistoryRequest getRequest + 20: optional shared.DescribeTaskListRequest descRequest } /** @@ -177,9 +177,10 @@ service MatchingService { ) /** - * GetPollerHistory returns pollers which poll from given tasklist in last few minutes. + * DescribeTaskList returns information about the target tasklist, right now this API returns the + * pollers which polled this tasklist in last few minutes. **/ - shared.GetPollerHistoryResponse GetPollerHistory(1: GetPollerHistoryRequest request) + shared.DescribeTaskListResponse DescribeTaskList(1: DescribeTaskListRequest request) throws ( 1: shared.BadRequestError badRequestError, 2: shared.InternalServiceError internalServiceError, diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index d05c99cd8c6..2fa45685498 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -931,13 +931,13 @@ struct DescribeWorkflowExecutionResponse { 20: optional WorkflowExecutionInfo workflowExecutionInfo } -struct GetPollerHistoryRequest { +struct DescribeTaskListRequest { 10: optional string domain 20: optional TaskList taskList 30: optional TaskListType taskListType } -struct GetPollerHistoryResponse { +struct DescribeTaskListResponse { 10: optional list pollers } @@ -953,7 +953,7 @@ enum TaskListType { } struct PollerInfo { - // ISO 8601 format - 10: optional string timestamp + // Unix Nano + 10: optional i64 (js.type = "Long") timestamp 20: optional string identity } diff --git a/service/frontend/handler.go b/service/frontend/handler.go index 4ff45b979f6..92693419f3d 100644 --- a/service/frontend/handler.go +++ b/service/frontend/handler.go @@ -1423,10 +1423,11 @@ func (wh *WorkflowHandler) DescribeWorkflowExecution(ctx context.Context, reques return response, nil } -// GetPollerHistory get poller information for given tasklist -func (wh *WorkflowHandler) GetPollerHistory(ctx context.Context, request *gen.GetPollerHistoryRequest) (*gen.GetPollerHistoryResponse, error) { +// DescribeTaskList returns information about the target tasklist, right now this API returns the +// pollers which polled this tasklist in last few minutes. +func (wh *WorkflowHandler) DescribeTaskList(ctx context.Context, request *gen.DescribeTaskListRequest) (*gen.DescribeTaskListResponse, error) { - scope := metrics.FrontendGetPollerHistoryScope + scope := metrics.FrontendDescribeTaskListScope sw := wh.startRequestProfile(scope) defer sw.Stop() @@ -1450,9 +1451,9 @@ func (wh *WorkflowHandler) GetPollerHistory(ctx context.Context, request *gen.Ge return nil, err } - response, err := wh.matching.GetPollerHistory(ctx, &m.GetPollerHistoryRequest{ - DomainUUID: common.StringPtr(domainInfo.ID), - GetRequest: request, + response, err := wh.matching.DescribeTaskList(ctx, &m.DescribeTaskListRequest{ + DomainUUID: common.StringPtr(domainInfo.ID), + DescRequest: request, }) if err != nil { diff --git a/service/matching/handler.go b/service/matching/handler.go index 3c2a996882a..02962c81305 100644 --- a/service/matching/handler.go +++ b/service/matching/handler.go @@ -169,13 +169,14 @@ func (h *Handler) CancelOutstandingPoll(ctx context.Context, return h.handleErr(err, scope) } -// GetPollerHistory get poller information for given tasklist -func (h *Handler) GetPollerHistory(ctx context.Context, request *m.GetPollerHistoryRequest) (*gen.GetPollerHistoryResponse, error) { - scope := metrics.MatchingGetPollerHistoryScope - sw := h.startRequestProfile("GetPollerHistory", scope) +// DescribeTaskList returns information about the target tasklist, right now this API returns the +// pollers which polled this tasklist in last few minutes. +func (h *Handler) DescribeTaskList(ctx context.Context, request *m.DescribeTaskListRequest) (*gen.DescribeTaskListResponse, error) { + scope := metrics.MatchingDescribeTaskListScope + sw := h.startRequestProfile("DescribeTaskList", scope) defer sw.Stop() - response, err := h.engine.GetPollerHistory(ctx, request) + response, err := h.engine.DescribeTaskList(ctx, request) return response, h.handleErr(err, scope) } diff --git a/service/matching/matchingEngine.go b/service/matching/matchingEngine.go index 5cf8f4a75ef..223732e5cd0 100644 --- a/service/matching/matchingEngine.go +++ b/service/matching/matchingEngine.go @@ -453,13 +453,13 @@ func (e *matchingEngineImpl) CancelOutstandingPoll(ctx context.Context, request return nil } -func (e *matchingEngineImpl) GetPollerHistory(ctx context.Context, request *m.GetPollerHistoryRequest) (*workflow.GetPollerHistoryResponse, error) { +func (e *matchingEngineImpl) DescribeTaskList(ctx context.Context, request *m.DescribeTaskListRequest) (*workflow.DescribeTaskListResponse, error) { domainID := request.GetDomainUUID() taskListType := persistence.TaskListTypeDecision - if request.GetRequest.GetTaskListType() == workflow.TaskListTypeActivity { + if request.DescRequest.GetTaskListType() == workflow.TaskListTypeActivity { taskListType = persistence.TaskListTypeActivity } - taskListName := request.GetRequest.TaskList.GetName() + taskListName := request.DescRequest.TaskList.GetName() taskList := newTaskListID(domainID, taskListName, taskListType) tlMgr, err := e.getTaskListManager(taskList) @@ -474,7 +474,7 @@ func (e *matchingEngineImpl) GetPollerHistory(ctx context.Context, request *m.Ge Timestamp: common.TimePtr(poller.timestamp), }) } - return &workflow.GetPollerHistoryResponse{Pollers: pollers}, nil + return &workflow.DescribeTaskListResponse{Pollers: pollers}, nil } // Loads a task from persistence and wraps it in a task context diff --git a/service/matching/matchingEngineInterfaces.go b/service/matching/matchingEngineInterfaces.go index 7844682e55e..f5ccf3e29bc 100644 --- a/service/matching/matchingEngineInterfaces.go +++ b/service/matching/matchingEngineInterfaces.go @@ -38,6 +38,6 @@ type ( QueryWorkflow(ctx context.Context, request *m.QueryWorkflowRequest) (*workflow.QueryWorkflowResponse, error) RespondQueryTaskCompleted(ctx context.Context, request *m.RespondQueryTaskCompletedRequest) error CancelOutstandingPoll(ctx context.Context, request *m.CancelOutstandingPollRequest) error - GetPollerHistory(ctx context.Context, request *m.GetPollerHistoryRequest) (*workflow.GetPollerHistoryResponse, error) + DescribeTaskList(ctx context.Context, request *m.DescribeTaskListRequest) (*workflow.DescribeTaskListResponse, error) } ) diff --git a/service/matching/matchingEngine_test.go b/service/matching/matchingEngine_test.go index 301908e182d..84c01de7064 100644 --- a/service/matching/matchingEngine_test.go +++ b/service/matching/matchingEngine_test.go @@ -223,17 +223,17 @@ func (s *matchingEngineSuite) PollForTasksEmptyResultTest(taskType int) { tasklistType = workflow.TaskListTypeDecision } // check the poller information - getResp, err := s.matchingEngine.GetPollerHistory(s.callContext, &matching.GetPollerHistoryRequest{ + descResp, err := s.matchingEngine.DescribeTaskList(s.callContext, &matching.DescribeTaskListRequest{ DomainUUID: common.StringPtr(domainID), - GetRequest: &workflow.GetPollerHistoryRequest{ + DescRequest: &workflow.DescribeTaskListRequest{ TaskList: taskList, TaskListType: &tasklistType, }, }) s.NoError(err) - s.Equal(1, len(getResp.Pollers)) - s.Equal(identity, getResp.Pollers[0].GetIdentity()) - s.NotEmpty(getResp.Pollers[0].GetTimestamp()) + s.Equal(1, len(descResp.Pollers)) + s.Equal(identity, descResp.Pollers[0].GetIdentity()) + s.NotEmpty(descResp.Pollers[0].GetTimestamp()) } s.EqualValues(1, s.taskManager.taskLists[*tlID].rangeID) } From 5ced7dddd878b36b438e44f1a1223346fd7d8b9e Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Thu, 11 Jan 2018 17:15:37 -0800 Subject: [PATCH 4/8] address comments --- common/cache/cache.go | 7 +-- common/cache/lru.go | 75 +++++++++++++++--------------- common/cache/lru_test.go | 12 +++-- common/convert.go | 6 +-- service/matching/matchingEngine.go | 2 +- service/matching/pollerHistory.go | 12 +++-- 6 files changed, 60 insertions(+), 54 deletions(-) diff --git a/common/cache/cache.go b/common/cache/cache.go index 74c08e53384..e80ac365a87 100644 --- a/common/cache/cache.go +++ b/common/cache/cache.go @@ -79,9 +79,10 @@ type Iterator interface { // Close closes the iterator // and releases any allocated resources Close() - // Entries returns a channel of MapEntry - // objects that can be used in a range loop - Entries() <-chan Entry + // HasNext return true if there is more items to be returned + HasNext() bool + // Next return the next item + Next() Entry } // Entry represents a key-value entry within the map diff --git a/common/cache/lru.go b/common/cache/lru.go index d40e7603699..2a8e7cbc04a 100644 --- a/common/cache/lru.go +++ b/common/cache/lru.go @@ -45,8 +45,8 @@ type ( } iteratorImpl struct { - stopCh chan struct{} - dataCh chan Entry + lru *lru + nextItem *list.Element } entryImpl struct { @@ -59,51 +59,52 @@ type ( // Close closes the iterator func (it *iteratorImpl) Close() { - close(it.stopCh) + it.lru.mut.Unlock() } -// Entries returns a channel of map entries -func (it *iteratorImpl) Entries() <-chan Entry { - return it.dataCh +// HasNext return true if there is more items to be returned +func (it *iteratorImpl) HasNext() bool { + for it.nextItem != nil { + entry := it.nextItem.Value.(*entryImpl) + if !it.lru.isEntryExpired(entry) { + // Entry is valid + return true + } + + nextItem := it.nextItem.Next() + it.lru.deleteInternal(it.nextItem) + it.nextItem = nextItem + } + + return false +} + +// Next return the next item +func (it *iteratorImpl) Next() Entry { + if !it.HasNext() { + panic("LRU cache iterator Next called when there is no next item") + } + + entry := it.nextItem.Value.(*entryImpl) + it.nextItem = it.nextItem.Next() + // make a copy of the entry so there will be no concurrent access to this entry + entry = &entryImpl{ + key: entry.key, + value: entry.value, + timestamp: entry.timestamp, + } + return entry } // Iterator returns an iterator to the map. This map // does not use re-entrant locks, so access or modification // to the map during iteration can cause a dead lock. func (c *lru) Iterator() Iterator { - + c.mut.Lock() iterator := &iteratorImpl{ - dataCh: make(chan Entry, 8), - stopCh: make(chan struct{}), + lru: c, + nextItem: c.byAccess.Front(), } - - go func(iterator *iteratorImpl) { - c.mut.Lock() - for _, element := range c.byKey { - entry := element.Value.(*entryImpl) - if c.isEntryExpired(entry) { - // Entry has expired - c.deleteInternal(element) - continue - } - // make a copy of the entry so there will be no concurrent access to this entry - entry = &entryImpl{ - key: entry.key, - value: entry.value, - timestamp: entry.timestamp, - } - select { - case iterator.dataCh <- entry: - case <-iterator.stopCh: - c.mut.Unlock() - close(iterator.dataCh) - return - } - } - c.mut.Unlock() - close(iterator.dataCh) - }(iterator) - return iterator } diff --git a/common/cache/lru_test.go b/common/cache/lru_test.go index b7e898120d9..302b0cb51c1 100644 --- a/common/cache/lru_test.go +++ b/common/cache/lru_test.go @@ -139,10 +139,11 @@ func TestLRUCacheConcurrentAccess(t *testing.T) { for j := 0; j < 50; j++ { result := []Entry{} it := cache.Iterator() - defer it.Close() - for entry := range it.Entries() { + for it.HasNext() { + entry := it.Next() result = append(result, entry) } + it.Close() } }() } @@ -215,9 +216,10 @@ func TestIterator(t *testing.T) { actual := map[string]string{} - ite := cache.Iterator() - defer ite.Close() - for entry := range ite.Entries() { + it := cache.Iterator() + defer it.Close() + for it.HasNext() { + entry := it.Next() actual[entry.Key().(string)] = entry.Value().(string) } diff --git a/common/convert.go b/common/convert.go index 310d0637ba4..8d8821488da 100644 --- a/common/convert.go +++ b/common/convert.go @@ -61,9 +61,9 @@ func BoolPtr(v bool) *bool { return &v } -// TimePtr makes a copy and returns the pointer to a string for time.Time, as ISO 8601 format. -func TimePtr(v time.Time) *int64 { - time := v.UTC().UnixNano() +// TimeInt64Ptr makes a copy and returns the pointer to a string for time.Time, as ISO 8601 format. +func TimeInt64Ptr(v time.Time) *int64 { + time := v.UnixNano() return &time } diff --git a/service/matching/matchingEngine.go b/service/matching/matchingEngine.go index 223732e5cd0..fe71caad83e 100644 --- a/service/matching/matchingEngine.go +++ b/service/matching/matchingEngine.go @@ -471,7 +471,7 @@ func (e *matchingEngineImpl) DescribeTaskList(ctx context.Context, request *m.De for _, poller := range tlMgr.GetAllPollerInfo() { pollers = append(pollers, &workflow.PollerInfo{ Identity: common.StringPtr(poller.identity), - Timestamp: common.TimePtr(poller.timestamp), + Timestamp: common.TimeInt64Ptr(poller.timestamp), }) } return &workflow.DescribeTaskListResponse{Pollers: pollers}, nil diff --git a/service/matching/pollerHistory.go b/service/matching/pollerHistory.go index 910558087e2..a737413f0cb 100644 --- a/service/matching/pollerHistory.go +++ b/service/matching/pollerHistory.go @@ -52,10 +52,11 @@ type pollerHistory struct { } func newPollerHistory() *pollerHistory { - opts := &cache.Options{} - opts.InitialCapacity = pollerHistoryInitSize - opts.TTL = pollerHistoryTTL - opts.Pin = false + opts := &cache.Options{ + InitialCapacity: pollerHistoryInitSize, + TTL: pollerHistoryTTL, + Pin: false, + } return &pollerHistory{ history: cache.New(pollerHistoryInitMaxSize, opts), @@ -71,7 +72,8 @@ func (pollers *pollerHistory) getAllPollerInfo() []*pollerInfo { ite := pollers.history.Iterator() defer ite.Close() - for entry := range ite.Entries() { + for ite.HasNext() { + entry := ite.Next() key := entry.Key().(pollerIdentity) timestamp := entry.Timestamp() result = append(result, &pollerInfo{ From 31539e8fe5e93847e8a9b124caacea1fe2a995b7 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Thu, 11 Jan 2018 23:12:12 -0800 Subject: [PATCH 5/8] address comments --- common/cache/lru.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/common/cache/lru.go b/common/cache/lru.go index 2a8e7cbc04a..0b1a1e03705 100644 --- a/common/cache/lru.go +++ b/common/cache/lru.go @@ -45,8 +45,9 @@ type ( } iteratorImpl struct { - lru *lru - nextItem *list.Element + lru *lru + timestamp time.Time + nextItem *list.Element } entryImpl struct { @@ -66,7 +67,7 @@ func (it *iteratorImpl) Close() { func (it *iteratorImpl) HasNext() bool { for it.nextItem != nil { entry := it.nextItem.Value.(*entryImpl) - if !it.lru.isEntryExpired(entry) { + if !it.lru.isEntryExpired(entry, it.timestamp) { // Entry is valid return true } @@ -102,8 +103,9 @@ func (it *iteratorImpl) Next() Entry { func (c *lru) Iterator() Iterator { c.mut.Lock() iterator := &iteratorImpl{ - lru: c, - nextItem: c.byAccess.Front(), + lru: c, + timestamp: time.Now(), + nextItem: c.byAccess.Front(), } return iterator } @@ -166,7 +168,7 @@ func (c *lru) Get(key interface{}) interface{} { entry.refCount++ } - if c.isEntryExpired(entry) { + if c.isEntryExpired(entry, time.Now()) { // Entry has expired c.deleteInternal(element) return nil @@ -290,6 +292,6 @@ func (c *lru) deleteInternal(element *list.Element) { delete(c.byKey, entry.key) } -func (c *lru) isEntryExpired(entry *entryImpl) bool { - return entry.refCount == 0 && !entry.timestamp.IsZero() && time.Now().After(entry.timestamp.Add(c.ttl)) +func (c *lru) isEntryExpired(entry *entryImpl, timestamp time.Time) bool { + return entry.refCount == 0 && !entry.timestamp.IsZero() && timestamp.After(entry.timestamp.Add(c.ttl)) } From c6812206e8bc09459b550cbeb7e62b94c62a8f15 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Fri, 12 Jan 2018 12:12:35 -0800 Subject: [PATCH 6/8] address comments --- common/cache/lru.go | 30 ++++++++++++++++-------------- common/convert.go | 8 -------- service/matching/matchingEngine.go | 2 +- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/common/cache/lru.go b/common/cache/lru.go index 0b1a1e03705..26f8a294bf8 100644 --- a/common/cache/lru.go +++ b/common/cache/lru.go @@ -65,24 +65,13 @@ func (it *iteratorImpl) Close() { // HasNext return true if there is more items to be returned func (it *iteratorImpl) HasNext() bool { - for it.nextItem != nil { - entry := it.nextItem.Value.(*entryImpl) - if !it.lru.isEntryExpired(entry, it.timestamp) { - // Entry is valid - return true - } - - nextItem := it.nextItem.Next() - it.lru.deleteInternal(it.nextItem) - it.nextItem = nextItem - } - - return false + it.checkNext() + return it.nextItem != nil } // Next return the next item func (it *iteratorImpl) Next() Entry { - if !it.HasNext() { + if it.nextItem == nil { panic("LRU cache iterator Next called when there is no next item") } @@ -97,6 +86,19 @@ func (it *iteratorImpl) Next() Entry { return entry } +func (it *iteratorImpl) checkNext() { + for it.nextItem != nil { + entry := it.nextItem.Value.(*entryImpl) + if it.lru.isEntryExpired(entry, it.timestamp) { + nextItem := it.nextItem.Next() + it.lru.deleteInternal(it.nextItem) + it.nextItem = nextItem + } else { + return + } + } +} + // Iterator returns an iterator to the map. This map // does not use re-entrant locks, so access or modification // to the map during iteration can cause a dead lock. diff --git a/common/convert.go b/common/convert.go index 8d8821488da..0d0c7332989 100644 --- a/common/convert.go +++ b/common/convert.go @@ -21,8 +21,6 @@ package common import ( - "time" - s "github.com/uber/cadence/.gen/go/shared" ) @@ -61,12 +59,6 @@ func BoolPtr(v bool) *bool { return &v } -// TimeInt64Ptr makes a copy and returns the pointer to a string for time.Time, as ISO 8601 format. -func TimeInt64Ptr(v time.Time) *int64 { - time := v.UnixNano() - return &time -} - // StringPtr makes a copy and returns the pointer to a string. func StringPtr(v string) *string { return &v diff --git a/service/matching/matchingEngine.go b/service/matching/matchingEngine.go index fe71caad83e..945f598496b 100644 --- a/service/matching/matchingEngine.go +++ b/service/matching/matchingEngine.go @@ -471,7 +471,7 @@ func (e *matchingEngineImpl) DescribeTaskList(ctx context.Context, request *m.De for _, poller := range tlMgr.GetAllPollerInfo() { pollers = append(pollers, &workflow.PollerInfo{ Identity: common.StringPtr(poller.identity), - Timestamp: common.TimeInt64Ptr(poller.timestamp), + Timestamp: common.Int64Ptr(poller.timestamp.UnixNano()), }) } return &workflow.DescribeTaskListResponse{Pollers: pollers}, nil From 048a17b535f7d77508bed2fb2c0e26fc9c6a5349 Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Fri, 12 Jan 2018 13:31:27 -0800 Subject: [PATCH 7/8] address more comments --- common/cache/cache.go | 4 +-- common/cache/lru.go | 45 ++++++++++++++++--------------- common/cache/lru_test.go | 9 ++++++- service/matching/pollerHistory.go | 2 +- 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/common/cache/cache.go b/common/cache/cache.go index e80ac365a87..20b1ddf8185 100644 --- a/common/cache/cache.go +++ b/common/cache/cache.go @@ -91,6 +91,6 @@ type Entry interface { Key() interface{} // Value represents the value Value() interface{} - // Timestamp represents the time when the value is updated - Timestamp() time.Time + // LastAccessTime represents the time when the value is last accessed + LastAccessTime() time.Time } diff --git a/common/cache/lru.go b/common/cache/lru.go index 26f8a294bf8..bf52708b9ff 100644 --- a/common/cache/lru.go +++ b/common/cache/lru.go @@ -45,16 +45,16 @@ type ( } iteratorImpl struct { - lru *lru - timestamp time.Time - nextItem *list.Element + lru *lru + createTime time.Time + nextItem *list.Element } entryImpl struct { - key interface{} - timestamp time.Time - value interface{} - refCount int + key interface{} + lastAccessTime time.Time + value interface{} + refCount int } ) @@ -65,7 +65,6 @@ func (it *iteratorImpl) Close() { // HasNext return true if there is more items to be returned func (it *iteratorImpl) HasNext() bool { - it.checkNext() return it.nextItem != nil } @@ -79,17 +78,18 @@ func (it *iteratorImpl) Next() Entry { it.nextItem = it.nextItem.Next() // make a copy of the entry so there will be no concurrent access to this entry entry = &entryImpl{ - key: entry.key, - value: entry.value, - timestamp: entry.timestamp, + key: entry.key, + value: entry.value, + lastAccessTime: entry.lastAccessTime, } + it.prepareNext() return entry } -func (it *iteratorImpl) checkNext() { +func (it *iteratorImpl) prepareNext() { for it.nextItem != nil { entry := it.nextItem.Value.(*entryImpl) - if it.lru.isEntryExpired(entry, it.timestamp) { + if it.lru.isEntryExpired(entry, it.createTime) { nextItem := it.nextItem.Next() it.lru.deleteInternal(it.nextItem) it.nextItem = nextItem @@ -105,10 +105,11 @@ func (it *iteratorImpl) checkNext() { func (c *lru) Iterator() Iterator { c.mut.Lock() iterator := &iteratorImpl{ - lru: c, - timestamp: time.Now(), - nextItem: c.byAccess.Front(), + lru: c, + createTime: time.Now(), + nextItem: c.byAccess.Front(), } + iterator.prepareNext() return iterator } @@ -120,8 +121,8 @@ func (entry *entryImpl) Value() interface{} { return entry.value } -func (entry *entryImpl) Timestamp() time.Time { - return entry.timestamp +func (entry *entryImpl) LastAccessTime() time.Time { + return entry.lastAccessTime } // New creates a new cache with the given options @@ -247,7 +248,7 @@ func (c *lru) putInternal(key interface{}, value interface{}, allowUpdate bool) entry.value = value } if c.ttl != 0 { - entry.timestamp = time.Now() + entry.lastAccessTime = time.Now() } c.byAccess.MoveToFront(elt) if c.pin { @@ -266,7 +267,7 @@ func (c *lru) putInternal(key interface{}, value interface{}, allowUpdate bool) } if c.ttl != 0 { - entry.timestamp = time.Now() + entry.lastAccessTime = time.Now() } c.byKey[key] = c.byAccess.PushFront(entry) @@ -294,6 +295,6 @@ func (c *lru) deleteInternal(element *list.Element) { delete(c.byKey, entry.key) } -func (c *lru) isEntryExpired(entry *entryImpl, timestamp time.Time) bool { - return entry.refCount == 0 && !entry.timestamp.IsZero() && timestamp.After(entry.timestamp.Add(c.ttl)) +func (c *lru) isEntryExpired(entry *entryImpl, currentTime time.Time) bool { + return entry.refCount == 0 && !entry.lastAccessTime.IsZero() && currentTime.After(entry.lastAccessTime.Add(c.ttl)) } diff --git a/common/cache/lru_test.go b/common/cache/lru_test.go index 302b0cb51c1..8392b72f631 100644 --- a/common/cache/lru_test.go +++ b/common/cache/lru_test.go @@ -217,11 +217,18 @@ func TestIterator(t *testing.T) { actual := map[string]string{} it := cache.Iterator() - defer it.Close() for it.HasNext() { entry := it.Next() actual[entry.Key().(string)] = entry.Value().(string) } + it.Close() + assert.Equal(t, expected, actual) + it = cache.Iterator() + for i := 0; i < len(expected); i++ { + entry := it.Next() + actual[entry.Key().(string)] = entry.Value().(string) + } + it.Close() assert.Equal(t, expected, actual) } diff --git a/service/matching/pollerHistory.go b/service/matching/pollerHistory.go index a737413f0cb..c363b104a6e 100644 --- a/service/matching/pollerHistory.go +++ b/service/matching/pollerHistory.go @@ -75,7 +75,7 @@ func (pollers *pollerHistory) getAllPollerInfo() []*pollerInfo { for ite.HasNext() { entry := ite.Next() key := entry.Key().(pollerIdentity) - timestamp := entry.Timestamp() + timestamp := entry.LastAccessTime() result = append(result, &pollerInfo{ identity: key.identity, // TODO add IP, T1396795 From f2cdce26feafc35c926629ad077a78e2c5339ace Mon Sep 17 00:00:00 2001 From: Wenquan Xing Date: Fri, 12 Jan 2018 14:11:51 -0800 Subject: [PATCH 8/8] more comments --- .gen/go/shared/idl.go | 4 ++-- .gen/go/shared/types.go | 24 +++++++++---------- common/cache/cache.go | 4 ++-- common/cache/lru.go | 29 ++++++++++++----------- host/integration_test.go | 12 +++++----- idl/github.com/uber/cadence/shared.thrift | 2 +- service/matching/matchingEngine.go | 4 ++-- service/matching/matchingEngine_test.go | 2 +- service/matching/pollerHistory.go | 6 ++--- 9 files changed, 44 insertions(+), 43 deletions(-) diff --git a/.gen/go/shared/idl.go b/.gen/go/shared/idl.go index a1b6ff2dc44..c98f4b9942c 100644 --- a/.gen/go/shared/idl.go +++ b/.gen/go/shared/idl.go @@ -30,8 +30,8 @@ var ThriftModule = &thriftreflect.ThriftModule{ Name: "shared", Package: "github.com/uber/cadence/.gen/go/shared", FilePath: "shared.thrift", - SHA1: "16e6a5553742142373900f3ff51dcae8c8b38fa4", + SHA1: "0f17dd60fe9e67cfe0dd7c9b6df4c163d060abf3", 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\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\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}\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}\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}\n\nenum CancelExternalWorkflowExecutionFailedCause {\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\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}\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 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}\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}\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}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\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}\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}\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}\n\nstruct WorkflowExecutionStartedEventAttributes {\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 string identity\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\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}\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}\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}\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}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\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}\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}\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 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}\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 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}\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}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\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}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\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}\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}\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}\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}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: 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 domainID\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 domainID\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 domainID\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}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\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}\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 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 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 DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n\nstruct DescribeTaskListRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n}\n\nstruct DescribeTaskListResponse {\n 10: optional list pollers\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\") timestamp\n 20: optional string identity\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\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\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}\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}\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}\n\nenum CancelExternalWorkflowExecutionFailedCause {\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\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}\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 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}\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}\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}\n\nstruct RecordMarkerDecisionAttributes {\n 10: optional string markerName\n 20: optional binary details\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}\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}\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}\n\nstruct WorkflowExecutionStartedEventAttributes {\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 string identity\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\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}\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}\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}\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}\n\nstruct ActivityTaskStartedEventAttributes {\n 10: optional i64 (js.type = \"Long\") scheduledEventId\n 20: optional string identity\n 30: optional string requestId\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}\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}\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 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}\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 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}\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}\n\nstruct DomainConfiguration {\n 10: optional i32 workflowExecutionRetentionPeriodInDays\n 20: optional bool emitMetric\n}\n\nstruct UpdateDomainInfo {\n 10: optional string description\n 20: optional string ownerEmail\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}\n\nstruct DescribeDomainRequest {\n 10: optional string name\n}\n\nstruct DescribeDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainRequest {\n 10: optional string name\n 20: optional UpdateDomainInfo updatedInfo\n 30: optional DomainConfiguration configuration\n}\n\nstruct UpdateDomainResponse {\n 10: optional DomainInfo domainInfo\n 20: optional DomainConfiguration configuration\n}\n\nstruct DeprecateDomainRequest {\n 10: optional string name\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}\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}\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}\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}\n\nstruct RecordActivityTaskHeartbeatRequest {\n 10: optional binary taskToken\n 20: optional binary details\n 30: 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 domainID\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 domainID\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 domainID\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}\n\nstruct GetWorkflowExecutionHistoryResponse {\n 10: optional History history\n 20: optional binary nextPageToken\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}\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 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 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 DescribeWorkflowExecutionResponse {\n 10: optional WorkflowExecutionConfiguration executionConfiguration\n 20: optional WorkflowExecutionInfo workflowExecutionInfo\n}\n\nstruct DescribeTaskListRequest {\n 10: optional string domain\n 20: optional TaskList taskList\n 30: optional TaskListType taskListType\n}\n\nstruct DescribeTaskListResponse {\n 10: optional list pollers\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}\n" diff --git a/.gen/go/shared/types.go b/.gen/go/shared/types.go index 36cb547d27d..dca6662efb2 100644 --- a/.gen/go/shared/types.go +++ b/.gen/go/shared/types.go @@ -13472,8 +13472,8 @@ func (v *PollForDecisionTaskResponse) GetBacklogCountHint() (o int64) { } type PollerInfo struct { - Timestamp *int64 `json:"timestamp,omitempty"` - Identity *string `json:"identity,omitempty"` + LastAccessTime *int64 `json:"lastAccessTime,omitempty"` + Identity *string `json:"identity,omitempty"` } // ToWire translates a PollerInfo struct into a Thrift-level intermediate @@ -13499,8 +13499,8 @@ func (v *PollerInfo) ToWire() (wire.Value, error) { err error ) - if v.Timestamp != nil { - w, err = wire.NewValueI64(*(v.Timestamp)), error(nil) + if v.LastAccessTime != nil { + w, err = wire.NewValueI64(*(v.LastAccessTime)), error(nil) if err != nil { return w, err } @@ -13545,7 +13545,7 @@ func (v *PollerInfo) FromWire(w wire.Value) error { if field.Value.Type() == wire.TI64 { var x int64 x, err = field.Value.GetI64(), error(nil) - v.Timestamp = &x + v.LastAccessTime = &x if err != nil { return err } @@ -13576,8 +13576,8 @@ func (v *PollerInfo) String() string { var fields [2]string i := 0 - if v.Timestamp != nil { - fields[i] = fmt.Sprintf("Timestamp: %v", *(v.Timestamp)) + if v.LastAccessTime != nil { + fields[i] = fmt.Sprintf("LastAccessTime: %v", *(v.LastAccessTime)) i++ } if v.Identity != nil { @@ -13593,7 +13593,7 @@ func (v *PollerInfo) String() string { // // This function performs a deep comparison. func (v *PollerInfo) Equals(rhs *PollerInfo) bool { - if !_I64_EqualsPtr(v.Timestamp, rhs.Timestamp) { + if !_I64_EqualsPtr(v.LastAccessTime, rhs.LastAccessTime) { return false } if !_String_EqualsPtr(v.Identity, rhs.Identity) { @@ -13603,11 +13603,11 @@ func (v *PollerInfo) Equals(rhs *PollerInfo) bool { return true } -// GetTimestamp returns the value of Timestamp if it is set or its +// GetLastAccessTime returns the value of LastAccessTime if it is set or its // zero value if it is unset. -func (v *PollerInfo) GetTimestamp() (o int64) { - if v.Timestamp != nil { - return *v.Timestamp +func (v *PollerInfo) GetLastAccessTime() (o int64) { + if v.LastAccessTime != nil { + return *v.LastAccessTime } return diff --git a/common/cache/cache.go b/common/cache/cache.go index 20b1ddf8185..44afb37ac58 100644 --- a/common/cache/cache.go +++ b/common/cache/cache.go @@ -91,6 +91,6 @@ type Entry interface { Key() interface{} // Value represents the value Value() interface{} - // LastAccessTime represents the time when the value is last accessed - LastAccessTime() time.Time + // CreateTime represents the time when the entry is created + CreateTime() time.Time } diff --git a/common/cache/lru.go b/common/cache/lru.go index bf52708b9ff..cf2caa21221 100644 --- a/common/cache/lru.go +++ b/common/cache/lru.go @@ -51,10 +51,10 @@ type ( } entryImpl struct { - key interface{} - lastAccessTime time.Time - value interface{} - refCount int + key interface{} + createTime time.Time + value interface{} + refCount int } ) @@ -78,9 +78,9 @@ func (it *iteratorImpl) Next() Entry { it.nextItem = it.nextItem.Next() // make a copy of the entry so there will be no concurrent access to this entry entry = &entryImpl{ - key: entry.key, - value: entry.value, - lastAccessTime: entry.lastAccessTime, + key: entry.key, + value: entry.value, + createTime: entry.createTime, } it.prepareNext() return entry @@ -121,8 +121,8 @@ func (entry *entryImpl) Value() interface{} { return entry.value } -func (entry *entryImpl) LastAccessTime() time.Time { - return entry.lastAccessTime +func (entry *entryImpl) CreateTime() time.Time { + return entry.createTime } // New creates a new cache with the given options @@ -246,10 +246,11 @@ func (c *lru) putInternal(key interface{}, value interface{}, allowUpdate bool) existing := entry.value if allowUpdate { entry.value = value + if c.ttl != 0 { + entry.createTime = time.Now() + } } - if c.ttl != 0 { - entry.lastAccessTime = time.Now() - } + c.byAccess.MoveToFront(elt) if c.pin { entry.refCount++ @@ -267,7 +268,7 @@ func (c *lru) putInternal(key interface{}, value interface{}, allowUpdate bool) } if c.ttl != 0 { - entry.lastAccessTime = time.Now() + entry.createTime = time.Now() } c.byKey[key] = c.byAccess.PushFront(entry) @@ -296,5 +297,5 @@ func (c *lru) deleteInternal(element *list.Element) { } func (c *lru) isEntryExpired(entry *entryImpl, currentTime time.Time) bool { - return entry.refCount == 0 && !entry.lastAccessTime.IsZero() && currentTime.After(entry.lastAccessTime.Add(c.ttl)) + return entry.refCount == 0 && !entry.createTime.IsZero() && currentTime.After(entry.createTime.Add(c.ttl)) } diff --git a/host/integration_test.go b/host/integration_test.go index 171a266b8bf..40bd0825eda 100644 --- a/host/integration_test.go +++ b/host/integration_test.go @@ -3732,21 +3732,21 @@ func (s *integrationSuite) TestDescribeTaskList() { pollerInfos = testDescribeTaskList(s.domainName, taskList, workflow.TaskListTypeDecision) s.Equal(1, len(pollerInfos)) s.Equal(identity, pollerInfos[0].GetIdentity()) - s.True(time.Unix(0, pollerInfos[0].GetTimestamp()).After(before)) - s.NotEmpty(pollerInfos[0].GetTimestamp()) + s.True(time.Unix(0, pollerInfos[0].GetLastAccessTime()).After(before)) + s.NotEmpty(pollerInfos[0].GetLastAccessTime()) errActivity := poller.pollAndProcessActivityTask(false) s.Nil(errActivity) pollerInfos = testDescribeTaskList(s.domainName, taskList, workflow.TaskListTypeActivity) s.Equal(1, len(pollerInfos)) s.Equal(identity, pollerInfos[0].GetIdentity()) - s.True(time.Unix(0, pollerInfos[0].GetTimestamp()).After(before)) - s.NotEmpty(pollerInfos[0].GetTimestamp()) + s.True(time.Unix(0, pollerInfos[0].GetLastAccessTime()).After(before)) + s.NotEmpty(pollerInfos[0].GetLastAccessTime()) pollerInfos = testDescribeTaskList(s.domainName, taskList, workflow.TaskListTypeDecision) s.Equal(1, len(pollerInfos)) s.Equal(identity, pollerInfos[0].GetIdentity()) - s.True(time.Unix(0, pollerInfos[0].GetTimestamp()).After(before)) - s.NotEmpty(pollerInfos[0].GetTimestamp()) + s.True(time.Unix(0, pollerInfos[0].GetLastAccessTime()).After(before)) + s.NotEmpty(pollerInfos[0].GetLastAccessTime()) } func (s *integrationSuite) setupShards() { diff --git a/idl/github.com/uber/cadence/shared.thrift b/idl/github.com/uber/cadence/shared.thrift index 2fa45685498..5f9c05c1806 100644 --- a/idl/github.com/uber/cadence/shared.thrift +++ b/idl/github.com/uber/cadence/shared.thrift @@ -954,6 +954,6 @@ enum TaskListType { struct PollerInfo { // Unix Nano - 10: optional i64 (js.type = "Long") timestamp + 10: optional i64 (js.type = "Long") lastAccessTime 20: optional string identity } diff --git a/service/matching/matchingEngine.go b/service/matching/matchingEngine.go index 945f598496b..4186f04f187 100644 --- a/service/matching/matchingEngine.go +++ b/service/matching/matchingEngine.go @@ -470,8 +470,8 @@ func (e *matchingEngineImpl) DescribeTaskList(ctx context.Context, request *m.De pollers := []*workflow.PollerInfo{} for _, poller := range tlMgr.GetAllPollerInfo() { pollers = append(pollers, &workflow.PollerInfo{ - Identity: common.StringPtr(poller.identity), - Timestamp: common.Int64Ptr(poller.timestamp.UnixNano()), + Identity: common.StringPtr(poller.identity), + LastAccessTime: common.Int64Ptr(poller.lastAccessTime.UnixNano()), }) } return &workflow.DescribeTaskListResponse{Pollers: pollers}, nil diff --git a/service/matching/matchingEngine_test.go b/service/matching/matchingEngine_test.go index 84c01de7064..2b8ab4281ca 100644 --- a/service/matching/matchingEngine_test.go +++ b/service/matching/matchingEngine_test.go @@ -233,7 +233,7 @@ func (s *matchingEngineSuite) PollForTasksEmptyResultTest(taskType int) { s.NoError(err) s.Equal(1, len(descResp.Pollers)) s.Equal(identity, descResp.Pollers[0].GetIdentity()) - s.NotEmpty(descResp.Pollers[0].GetTimestamp()) + s.NotEmpty(descResp.Pollers[0].GetLastAccessTime()) } s.EqualValues(1, s.taskManager.taskLists[*tlID].rangeID) } diff --git a/service/matching/pollerHistory.go b/service/matching/pollerHistory.go index c363b104a6e..dfd35afc620 100644 --- a/service/matching/pollerHistory.go +++ b/service/matching/pollerHistory.go @@ -41,7 +41,7 @@ type ( pollerInfo struct { identity string // TODO add IP, T1396795 - timestamp time.Time + lastAccessTime time.Time } ) @@ -75,11 +75,11 @@ func (pollers *pollerHistory) getAllPollerInfo() []*pollerInfo { for ite.HasNext() { entry := ite.Next() key := entry.Key().(pollerIdentity) - timestamp := entry.LastAccessTime() + lastAccessTime := entry.CreateTime() result = append(result, &pollerInfo{ identity: key.identity, // TODO add IP, T1396795 - timestamp: timestamp, + lastAccessTime: lastAccessTime, }) }