go.uber.org/cadence@v1.2.9/internal/compatibility/adapter.go (about)

     1  // Copyright (c) 2021 Uber Technologies, Inc.
     2  //
     3  // Permission is hereby granted, free of charge, to any person obtaining a copy
     4  // of this software and associated documentation files (the "Software"), to deal
     5  // in the Software without restriction, including without limitation the rights
     6  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     7  // copies of the Software, and to permit persons to whom the Software is
     8  // furnished to do so, subject to the following conditions:
     9  //
    10  // The above copyright notice and this permission notice shall be included in
    11  // all copies or substantial portions of the Software.
    12  //
    13  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    14  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    15  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    16  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    17  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    18  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    19  // THE SOFTWARE.
    20  
    21  package compatibility
    22  
    23  import (
    24  	"context"
    25  
    26  	"go.uber.org/yarpc"
    27  
    28  	"go.uber.org/cadence/.gen/go/cadence/workflowserviceclient"
    29  	"go.uber.org/cadence/.gen/go/shared"
    30  	"go.uber.org/cadence/internal/compatibility/proto"
    31  	"go.uber.org/cadence/internal/compatibility/thrift"
    32  
    33  	apiv1 "github.com/uber/cadence-idl/go/proto/api/v1"
    34  )
    35  
    36  type thrift2protoAdapter struct {
    37  	domain     apiv1.DomainAPIYARPCClient
    38  	workflow   apiv1.WorkflowAPIYARPCClient
    39  	worker     apiv1.WorkerAPIYARPCClient
    40  	visibility apiv1.VisibilityAPIYARPCClient
    41  }
    42  
    43  func NewThrift2ProtoAdapter(
    44  	domain apiv1.DomainAPIYARPCClient,
    45  	workflow apiv1.WorkflowAPIYARPCClient,
    46  	worker apiv1.WorkerAPIYARPCClient,
    47  	visibility apiv1.VisibilityAPIYARPCClient,
    48  ) workflowserviceclient.Interface {
    49  	return thrift2protoAdapter{domain, workflow, worker, visibility}
    50  }
    51  
    52  func (a thrift2protoAdapter) CountWorkflowExecutions(ctx context.Context, request *shared.CountWorkflowExecutionsRequest, opts ...yarpc.CallOption) (*shared.CountWorkflowExecutionsResponse, error) {
    53  	response, err := a.visibility.CountWorkflowExecutions(ctx, proto.CountWorkflowExecutionsRequest(request), opts...)
    54  	return thrift.CountWorkflowExecutionsResponse(response), thrift.Error(err)
    55  }
    56  
    57  func (a thrift2protoAdapter) DeprecateDomain(ctx context.Context, request *shared.DeprecateDomainRequest, opts ...yarpc.CallOption) error {
    58  	_, err := a.domain.DeprecateDomain(ctx, proto.DeprecateDomainRequest(request), opts...)
    59  	return thrift.Error(err)
    60  }
    61  
    62  func (a thrift2protoAdapter) DescribeDomain(ctx context.Context, request *shared.DescribeDomainRequest, opts ...yarpc.CallOption) (*shared.DescribeDomainResponse, error) {
    63  	response, err := a.domain.DescribeDomain(ctx, proto.DescribeDomainRequest(request), opts...)
    64  	return thrift.DescribeDomainResponse(response), thrift.Error(err)
    65  }
    66  
    67  func (a thrift2protoAdapter) DescribeTaskList(ctx context.Context, request *shared.DescribeTaskListRequest, opts ...yarpc.CallOption) (*shared.DescribeTaskListResponse, error) {
    68  	response, err := a.workflow.DescribeTaskList(ctx, proto.DescribeTaskListRequest(request), opts...)
    69  	return thrift.DescribeTaskListResponse(response), thrift.Error(err)
    70  }
    71  
    72  func (a thrift2protoAdapter) DescribeWorkflowExecution(ctx context.Context, request *shared.DescribeWorkflowExecutionRequest, opts ...yarpc.CallOption) (*shared.DescribeWorkflowExecutionResponse, error) {
    73  	response, err := a.workflow.DescribeWorkflowExecution(ctx, proto.DescribeWorkflowExecutionRequest(request), opts...)
    74  	return thrift.DescribeWorkflowExecutionResponse(response), thrift.Error(err)
    75  }
    76  
    77  func (a thrift2protoAdapter) GetClusterInfo(ctx context.Context, opts ...yarpc.CallOption) (*shared.ClusterInfo, error) {
    78  	response, err := a.workflow.GetClusterInfo(ctx, &apiv1.GetClusterInfoRequest{}, opts...)
    79  	return thrift.GetClusterInfoResponse(response), thrift.Error(err)
    80  }
    81  
    82  func (a thrift2protoAdapter) GetSearchAttributes(ctx context.Context, opts ...yarpc.CallOption) (*shared.GetSearchAttributesResponse, error) {
    83  	response, err := a.visibility.GetSearchAttributes(ctx, &apiv1.GetSearchAttributesRequest{}, opts...)
    84  	return thrift.GetSearchAttributesResponse(response), thrift.Error(err)
    85  }
    86  
    87  func (a thrift2protoAdapter) GetWorkflowExecutionHistory(ctx context.Context, request *shared.GetWorkflowExecutionHistoryRequest, opts ...yarpc.CallOption) (*shared.GetWorkflowExecutionHistoryResponse, error) {
    88  	response, err := a.workflow.GetWorkflowExecutionHistory(ctx, proto.GetWorkflowExecutionHistoryRequest(request), opts...)
    89  	return thrift.GetWorkflowExecutionHistoryResponse(response), thrift.Error(err)
    90  }
    91  
    92  func (a thrift2protoAdapter) ListArchivedWorkflowExecutions(ctx context.Context, request *shared.ListArchivedWorkflowExecutionsRequest, opts ...yarpc.CallOption) (*shared.ListArchivedWorkflowExecutionsResponse, error) {
    93  	response, err := a.visibility.ListArchivedWorkflowExecutions(ctx, proto.ListArchivedWorkflowExecutionsRequest(request), opts...)
    94  	return thrift.ListArchivedWorkflowExecutionsResponse(response), thrift.Error(err)
    95  }
    96  
    97  func (a thrift2protoAdapter) ListClosedWorkflowExecutions(ctx context.Context, request *shared.ListClosedWorkflowExecutionsRequest, opts ...yarpc.CallOption) (*shared.ListClosedWorkflowExecutionsResponse, error) {
    98  	response, err := a.visibility.ListClosedWorkflowExecutions(ctx, proto.ListClosedWorkflowExecutionsRequest(request), opts...)
    99  	return thrift.ListClosedWorkflowExecutionsResponse(response), thrift.Error(err)
   100  }
   101  
   102  func (a thrift2protoAdapter) ListDomains(ctx context.Context, request *shared.ListDomainsRequest, opts ...yarpc.CallOption) (*shared.ListDomainsResponse, error) {
   103  	response, err := a.domain.ListDomains(ctx, proto.ListDomainsRequest(request), opts...)
   104  	return thrift.ListDomainsResponse(response), thrift.Error(err)
   105  }
   106  
   107  func (a thrift2protoAdapter) ListOpenWorkflowExecutions(ctx context.Context, request *shared.ListOpenWorkflowExecutionsRequest, opts ...yarpc.CallOption) (*shared.ListOpenWorkflowExecutionsResponse, error) {
   108  	response, err := a.visibility.ListOpenWorkflowExecutions(ctx, proto.ListOpenWorkflowExecutionsRequest(request), opts...)
   109  	return thrift.ListOpenWorkflowExecutionsResponse(response), thrift.Error(err)
   110  }
   111  
   112  func (a thrift2protoAdapter) ListTaskListPartitions(ctx context.Context, request *shared.ListTaskListPartitionsRequest, opts ...yarpc.CallOption) (*shared.ListTaskListPartitionsResponse, error) {
   113  	response, err := a.workflow.ListTaskListPartitions(ctx, proto.ListTaskListPartitionsRequest(request), opts...)
   114  	return thrift.ListTaskListPartitionsResponse(response), thrift.Error(err)
   115  }
   116  
   117  func (a thrift2protoAdapter) ListWorkflowExecutions(ctx context.Context, request *shared.ListWorkflowExecutionsRequest, opts ...yarpc.CallOption) (*shared.ListWorkflowExecutionsResponse, error) {
   118  	response, err := a.visibility.ListWorkflowExecutions(ctx, proto.ListWorkflowExecutionsRequest(request), opts...)
   119  	return thrift.ListWorkflowExecutionsResponse(response), thrift.Error(err)
   120  }
   121  
   122  func (a thrift2protoAdapter) PollForActivityTask(ctx context.Context, request *shared.PollForActivityTaskRequest, opts ...yarpc.CallOption) (*shared.PollForActivityTaskResponse, error) {
   123  	response, err := a.worker.PollForActivityTask(ctx, proto.PollForActivityTaskRequest(request), opts...)
   124  	return thrift.PollForActivityTaskResponse(response), thrift.Error(err)
   125  }
   126  
   127  func (a thrift2protoAdapter) PollForDecisionTask(ctx context.Context, request *shared.PollForDecisionTaskRequest, opts ...yarpc.CallOption) (*shared.PollForDecisionTaskResponse, error) {
   128  	response, err := a.worker.PollForDecisionTask(ctx, proto.PollForDecisionTaskRequest(request), opts...)
   129  	return thrift.PollForDecisionTaskResponse(response), thrift.Error(err)
   130  }
   131  
   132  func (a thrift2protoAdapter) QueryWorkflow(ctx context.Context, request *shared.QueryWorkflowRequest, opts ...yarpc.CallOption) (*shared.QueryWorkflowResponse, error) {
   133  	response, err := a.workflow.QueryWorkflow(ctx, proto.QueryWorkflowRequest(request), opts...)
   134  	return thrift.QueryWorkflowResponse(response), thrift.Error(err)
   135  }
   136  
   137  func (a thrift2protoAdapter) RecordActivityTaskHeartbeat(ctx context.Context, request *shared.RecordActivityTaskHeartbeatRequest, opts ...yarpc.CallOption) (*shared.RecordActivityTaskHeartbeatResponse, error) {
   138  	response, err := a.worker.RecordActivityTaskHeartbeat(ctx, proto.RecordActivityTaskHeartbeatRequest(request), opts...)
   139  	return thrift.RecordActivityTaskHeartbeatResponse(response), thrift.Error(err)
   140  }
   141  
   142  func (a thrift2protoAdapter) RecordActivityTaskHeartbeatByID(ctx context.Context, request *shared.RecordActivityTaskHeartbeatByIDRequest, opts ...yarpc.CallOption) (*shared.RecordActivityTaskHeartbeatResponse, error) {
   143  	response, err := a.worker.RecordActivityTaskHeartbeatByID(ctx, proto.RecordActivityTaskHeartbeatByIdRequest(request), opts...)
   144  	return thrift.RecordActivityTaskHeartbeatByIdResponse(response), thrift.Error(err)
   145  }
   146  
   147  func (a thrift2protoAdapter) RegisterDomain(ctx context.Context, request *shared.RegisterDomainRequest, opts ...yarpc.CallOption) error {
   148  	_, err := a.domain.RegisterDomain(ctx, proto.RegisterDomainRequest(request), opts...)
   149  	return thrift.Error(err)
   150  }
   151  
   152  func (a thrift2protoAdapter) RequestCancelWorkflowExecution(ctx context.Context, request *shared.RequestCancelWorkflowExecutionRequest, opts ...yarpc.CallOption) error {
   153  	_, err := a.workflow.RequestCancelWorkflowExecution(ctx, proto.RequestCancelWorkflowExecutionRequest(request), opts...)
   154  	return thrift.Error(err)
   155  }
   156  
   157  func (a thrift2protoAdapter) ResetStickyTaskList(ctx context.Context, request *shared.ResetStickyTaskListRequest, opts ...yarpc.CallOption) (*shared.ResetStickyTaskListResponse, error) {
   158  	_, err := a.worker.ResetStickyTaskList(ctx, proto.ResetStickyTaskListRequest(request), opts...)
   159  	return &shared.ResetStickyTaskListResponse{}, thrift.Error(err)
   160  }
   161  
   162  func (a thrift2protoAdapter) ResetWorkflowExecution(ctx context.Context, request *shared.ResetWorkflowExecutionRequest, opts ...yarpc.CallOption) (*shared.ResetWorkflowExecutionResponse, error) {
   163  	response, err := a.workflow.ResetWorkflowExecution(ctx, proto.ResetWorkflowExecutionRequest(request), opts...)
   164  	return thrift.ResetWorkflowExecutionResponse(response), thrift.Error(err)
   165  }
   166  
   167  func (a thrift2protoAdapter) RespondActivityTaskCanceled(ctx context.Context, request *shared.RespondActivityTaskCanceledRequest, opts ...yarpc.CallOption) error {
   168  	_, err := a.worker.RespondActivityTaskCanceled(ctx, proto.RespondActivityTaskCanceledRequest(request), opts...)
   169  	return thrift.Error(err)
   170  }
   171  
   172  func (a thrift2protoAdapter) RespondActivityTaskCanceledByID(ctx context.Context, request *shared.RespondActivityTaskCanceledByIDRequest, opts ...yarpc.CallOption) error {
   173  	_, err := a.worker.RespondActivityTaskCanceledByID(ctx, proto.RespondActivityTaskCanceledByIdRequest(request), opts...)
   174  	return thrift.Error(err)
   175  }
   176  
   177  func (a thrift2protoAdapter) RespondActivityTaskCompleted(ctx context.Context, request *shared.RespondActivityTaskCompletedRequest, opts ...yarpc.CallOption) error {
   178  	_, err := a.worker.RespondActivityTaskCompleted(ctx, proto.RespondActivityTaskCompletedRequest(request), opts...)
   179  	return thrift.Error(err)
   180  }
   181  
   182  func (a thrift2protoAdapter) RespondActivityTaskCompletedByID(ctx context.Context, request *shared.RespondActivityTaskCompletedByIDRequest, opts ...yarpc.CallOption) error {
   183  	_, err := a.worker.RespondActivityTaskCompletedByID(ctx, proto.RespondActivityTaskCompletedByIdRequest(request), opts...)
   184  	return thrift.Error(err)
   185  }
   186  
   187  func (a thrift2protoAdapter) RespondActivityTaskFailed(ctx context.Context, request *shared.RespondActivityTaskFailedRequest, opts ...yarpc.CallOption) error {
   188  	_, err := a.worker.RespondActivityTaskFailed(ctx, proto.RespondActivityTaskFailedRequest(request), opts...)
   189  	return thrift.Error(err)
   190  }
   191  
   192  func (a thrift2protoAdapter) RespondActivityTaskFailedByID(ctx context.Context, request *shared.RespondActivityTaskFailedByIDRequest, opts ...yarpc.CallOption) error {
   193  	_, err := a.worker.RespondActivityTaskFailedByID(ctx, proto.RespondActivityTaskFailedByIdRequest(request), opts...)
   194  	return thrift.Error(err)
   195  }
   196  
   197  func (a thrift2protoAdapter) RespondDecisionTaskCompleted(ctx context.Context, request *shared.RespondDecisionTaskCompletedRequest, opts ...yarpc.CallOption) (*shared.RespondDecisionTaskCompletedResponse, error) {
   198  	response, err := a.worker.RespondDecisionTaskCompleted(ctx, proto.RespondDecisionTaskCompletedRequest(request), opts...)
   199  	return thrift.RespondDecisionTaskCompletedResponse(response), thrift.Error(err)
   200  }
   201  
   202  func (a thrift2protoAdapter) RespondDecisionTaskFailed(ctx context.Context, request *shared.RespondDecisionTaskFailedRequest, opts ...yarpc.CallOption) error {
   203  	_, err := a.worker.RespondDecisionTaskFailed(ctx, proto.RespondDecisionTaskFailedRequest(request), opts...)
   204  	return thrift.Error(err)
   205  }
   206  
   207  func (a thrift2protoAdapter) RespondQueryTaskCompleted(ctx context.Context, request *shared.RespondQueryTaskCompletedRequest, opts ...yarpc.CallOption) error {
   208  	_, err := a.worker.RespondQueryTaskCompleted(ctx, proto.RespondQueryTaskCompletedRequest(request), opts...)
   209  	return thrift.Error(err)
   210  }
   211  
   212  func (a thrift2protoAdapter) ScanWorkflowExecutions(ctx context.Context, request *shared.ListWorkflowExecutionsRequest, opts ...yarpc.CallOption) (*shared.ListWorkflowExecutionsResponse, error) {
   213  	response, err := a.visibility.ScanWorkflowExecutions(ctx, proto.ScanWorkflowExecutionsRequest(request), opts...)
   214  	return thrift.ScanWorkflowExecutionsResponse(response), thrift.Error(err)
   215  }
   216  
   217  func (a thrift2protoAdapter) SignalWithStartWorkflowExecution(ctx context.Context, request *shared.SignalWithStartWorkflowExecutionRequest, opts ...yarpc.CallOption) (*shared.StartWorkflowExecutionResponse, error) {
   218  	response, err := a.workflow.SignalWithStartWorkflowExecution(ctx, proto.SignalWithStartWorkflowExecutionRequest(request), opts...)
   219  	return thrift.SignalWithStartWorkflowExecutionResponse(response), thrift.Error(err)
   220  }
   221  
   222  func (a thrift2protoAdapter) SignalWorkflowExecution(ctx context.Context, request *shared.SignalWorkflowExecutionRequest, opts ...yarpc.CallOption) error {
   223  	_, err := a.workflow.SignalWorkflowExecution(ctx, proto.SignalWorkflowExecutionRequest(request), opts...)
   224  	return thrift.Error(err)
   225  }
   226  
   227  func (a thrift2protoAdapter) StartWorkflowExecution(ctx context.Context, request *shared.StartWorkflowExecutionRequest, opts ...yarpc.CallOption) (*shared.StartWorkflowExecutionResponse, error) {
   228  	response, err := a.workflow.StartWorkflowExecution(ctx, proto.StartWorkflowExecutionRequest(request), opts...)
   229  	return thrift.StartWorkflowExecutionResponse(response), thrift.Error(err)
   230  }
   231  
   232  func (a thrift2protoAdapter) TerminateWorkflowExecution(ctx context.Context, request *shared.TerminateWorkflowExecutionRequest, opts ...yarpc.CallOption) error {
   233  	_, err := a.workflow.TerminateWorkflowExecution(ctx, proto.TerminateWorkflowExecutionRequest(request), opts...)
   234  	return thrift.Error(err)
   235  }
   236  
   237  func (a thrift2protoAdapter) UpdateDomain(ctx context.Context, request *shared.UpdateDomainRequest, opts ...yarpc.CallOption) (*shared.UpdateDomainResponse, error) {
   238  	response, err := a.domain.UpdateDomain(ctx, proto.UpdateDomainRequest(request), opts...)
   239  	return thrift.UpdateDomainResponse(response), thrift.Error(err)
   240  }
   241  
   242  func (a thrift2protoAdapter) GetTaskListsByDomain(ctx context.Context, Request *shared.GetTaskListsByDomainRequest, opts ...yarpc.CallOption) (*shared.GetTaskListsByDomainResponse, error) {
   243  	panic("implement me")
   244  }
   245  
   246  func (a thrift2protoAdapter) RefreshWorkflowTasks(ctx context.Context, request *shared.RefreshWorkflowTasksRequest, opts ...yarpc.CallOption) error {
   247  	_, err := a.workflow.RefreshWorkflowTasks(ctx, proto.RefreshWorkflowTasksRequest(request), opts...)
   248  	return thrift.Error(err)
   249  }
   250  
   251  func (a thrift2protoAdapter) RestartWorkflowExecution(ctx context.Context, request *shared.RestartWorkflowExecutionRequest, opts ...yarpc.CallOption) (*shared.RestartWorkflowExecutionResponse, error) {
   252  	response, err := a.workflow.RestartWorkflowExecution(ctx, proto.RestartWorkflowExecutionRequest(request), opts...)
   253  	return thrift.RestartWorkflowExecutionResponse(response), proto.Error(err)
   254  }
   255  
   256  type domainAPIthriftAdapter struct {
   257  	service workflowserviceclient.Interface
   258  }
   259  
   260  func NewDomainAPITriftAdapter(thrift workflowserviceclient.Interface) domainAPIthriftAdapter {
   261  	return domainAPIthriftAdapter{thrift}
   262  }
   263  
   264  func (a domainAPIthriftAdapter) RegisterDomain(ctx context.Context, request *apiv1.RegisterDomainRequest, opts ...yarpc.CallOption) (*apiv1.RegisterDomainResponse, error) {
   265  	err := a.service.RegisterDomain(ctx, thrift.RegisterDomainRequest(request), opts...)
   266  	return &apiv1.RegisterDomainResponse{}, proto.Error(err)
   267  }
   268  func (a domainAPIthriftAdapter) DescribeDomain(ctx context.Context, request *apiv1.DescribeDomainRequest, opts ...yarpc.CallOption) (*apiv1.DescribeDomainResponse, error) {
   269  	response, err := a.service.DescribeDomain(ctx, thrift.DescribeDomainRequest(request), opts...)
   270  	return proto.DescribeDomainResponse(response), proto.Error(err)
   271  }
   272  func (a domainAPIthriftAdapter) ListDomains(ctx context.Context, request *apiv1.ListDomainsRequest, opts ...yarpc.CallOption) (*apiv1.ListDomainsResponse, error) {
   273  	response, err := a.service.ListDomains(ctx, thrift.ListDomainsRequest(request), opts...)
   274  	return proto.ListDomainsResponse(response), proto.Error(err)
   275  }
   276  func (a domainAPIthriftAdapter) UpdateDomain(ctx context.Context, request *apiv1.UpdateDomainRequest, opts ...yarpc.CallOption) (*apiv1.UpdateDomainResponse, error) {
   277  	response, err := a.service.UpdateDomain(ctx, thrift.UpdateDomainRequest(request), opts...)
   278  	return proto.UpdateDomainResponse(response), proto.Error(err)
   279  }
   280  func (a domainAPIthriftAdapter) DeprecateDomain(ctx context.Context, request *apiv1.DeprecateDomainRequest, opts ...yarpc.CallOption) (*apiv1.DeprecateDomainResponse, error) {
   281  	err := a.service.DeprecateDomain(ctx, thrift.DeprecateDomainRequest(request), opts...)
   282  	return &apiv1.DeprecateDomainResponse{}, proto.Error(err)
   283  }
   284  
   285  type workflowAPIthriftAdapter struct {
   286  	service workflowserviceclient.Interface
   287  }
   288  
   289  func NewWorkflowAPITriftAdapter(thrift workflowserviceclient.Interface) workflowAPIthriftAdapter {
   290  	return workflowAPIthriftAdapter{thrift}
   291  }
   292  
   293  func (a workflowAPIthriftAdapter) StartWorkflowExecution(ctx context.Context, request *apiv1.StartWorkflowExecutionRequest, opts ...yarpc.CallOption) (*apiv1.StartWorkflowExecutionResponse, error) {
   294  	response, err := a.service.StartWorkflowExecution(ctx, thrift.StartWorkflowExecutionRequest(request), opts...)
   295  	return proto.StartWorkflowExecutionResponse(response), proto.Error(err)
   296  }
   297  func (a workflowAPIthriftAdapter) SignalWorkflowExecution(ctx context.Context, request *apiv1.SignalWorkflowExecutionRequest, opts ...yarpc.CallOption) (*apiv1.SignalWorkflowExecutionResponse, error) {
   298  	err := a.service.SignalWorkflowExecution(ctx, thrift.SignalWorkflowExecutionRequest(request), opts...)
   299  	return &apiv1.SignalWorkflowExecutionResponse{}, proto.Error(err)
   300  }
   301  func (a workflowAPIthriftAdapter) SignalWithStartWorkflowExecution(ctx context.Context, request *apiv1.SignalWithStartWorkflowExecutionRequest, opts ...yarpc.CallOption) (*apiv1.SignalWithStartWorkflowExecutionResponse, error) {
   302  	response, err := a.service.SignalWithStartWorkflowExecution(ctx, thrift.SignalWithStartWorkflowExecutionRequest(request), opts...)
   303  	return proto.SignalWithStartWorkflowExecutionResponse(response), proto.Error(err)
   304  }
   305  func (a workflowAPIthriftAdapter) ResetWorkflowExecution(ctx context.Context, request *apiv1.ResetWorkflowExecutionRequest, opts ...yarpc.CallOption) (*apiv1.ResetWorkflowExecutionResponse, error) {
   306  	response, err := a.service.ResetWorkflowExecution(ctx, thrift.ResetWorkflowExecutionRequest(request), opts...)
   307  	return proto.ResetWorkflowExecutionResponse(response), proto.Error(err)
   308  }
   309  func (a workflowAPIthriftAdapter) RequestCancelWorkflowExecution(ctx context.Context, request *apiv1.RequestCancelWorkflowExecutionRequest, opts ...yarpc.CallOption) (*apiv1.RequestCancelWorkflowExecutionResponse, error) {
   310  	err := a.service.RequestCancelWorkflowExecution(ctx, thrift.RequestCancelWorkflowExecutionRequest(request), opts...)
   311  	return &apiv1.RequestCancelWorkflowExecutionResponse{}, proto.Error(err)
   312  }
   313  func (a workflowAPIthriftAdapter) TerminateWorkflowExecution(ctx context.Context, request *apiv1.TerminateWorkflowExecutionRequest, opts ...yarpc.CallOption) (*apiv1.TerminateWorkflowExecutionResponse, error) {
   314  	err := a.service.TerminateWorkflowExecution(ctx, thrift.TerminateWorkflowExecutionRequest(request), opts...)
   315  	return &apiv1.TerminateWorkflowExecutionResponse{}, proto.Error(err)
   316  }
   317  func (a workflowAPIthriftAdapter) DescribeWorkflowExecution(ctx context.Context, request *apiv1.DescribeWorkflowExecutionRequest, opts ...yarpc.CallOption) (*apiv1.DescribeWorkflowExecutionResponse, error) {
   318  	response, err := a.service.DescribeWorkflowExecution(ctx, thrift.DescribeWorkflowExecutionRequest(request), opts...)
   319  	return proto.DescribeWorkflowExecutionResponse(response), proto.Error(err)
   320  }
   321  func (a workflowAPIthriftAdapter) QueryWorkflow(ctx context.Context, request *apiv1.QueryWorkflowRequest, opts ...yarpc.CallOption) (*apiv1.QueryWorkflowResponse, error) {
   322  	response, err := a.service.QueryWorkflow(ctx, thrift.QueryWorkflowRequest(request), opts...)
   323  	return proto.QueryWorkflowResponse(response), proto.Error(err)
   324  }
   325  func (a workflowAPIthriftAdapter) DescribeTaskList(ctx context.Context, request *apiv1.DescribeTaskListRequest, opts ...yarpc.CallOption) (*apiv1.DescribeTaskListResponse, error) {
   326  	response, err := a.service.DescribeTaskList(ctx, thrift.DescribeTaskListRequest(request), opts...)
   327  	return proto.DescribeTaskListResponse(response), proto.Error(err)
   328  }
   329  func (a workflowAPIthriftAdapter) ListTaskListPartitions(ctx context.Context, request *apiv1.ListTaskListPartitionsRequest, opts ...yarpc.CallOption) (*apiv1.ListTaskListPartitionsResponse, error) {
   330  	response, err := a.service.ListTaskListPartitions(ctx, thrift.ListTaskListPartitionsRequest(request), opts...)
   331  	return proto.ListTaskListPartitionsResponse(response), proto.Error(err)
   332  }
   333  func (a workflowAPIthriftAdapter) GetClusterInfo(ctx context.Context, request *apiv1.GetClusterInfoRequest, opts ...yarpc.CallOption) (*apiv1.GetClusterInfoResponse, error) {
   334  	response, err := a.service.GetClusterInfo(ctx, opts...)
   335  	return proto.GetClusterInfoResponse(response), proto.Error(err)
   336  }
   337  func (a workflowAPIthriftAdapter) GetWorkflowExecutionHistory(ctx context.Context, request *apiv1.GetWorkflowExecutionHistoryRequest, opts ...yarpc.CallOption) (*apiv1.GetWorkflowExecutionHistoryResponse, error) {
   338  	response, err := a.service.GetWorkflowExecutionHistory(ctx, thrift.GetWorkflowExecutionHistoryRequest(request), opts...)
   339  	return proto.GetWorkflowExecutionHistoryResponse(response), proto.Error(err)
   340  }
   341  
   342  type workerAPIthriftAdapter struct {
   343  	service workflowserviceclient.Interface
   344  }
   345  
   346  func NewWorkerAPITriftAdapter(thrift workflowserviceclient.Interface) workerAPIthriftAdapter {
   347  	return workerAPIthriftAdapter{thrift}
   348  }
   349  
   350  func (a workerAPIthriftAdapter) PollForDecisionTask(ctx context.Context, request *apiv1.PollForDecisionTaskRequest, opts ...yarpc.CallOption) (*apiv1.PollForDecisionTaskResponse, error) {
   351  	response, err := a.service.PollForDecisionTask(ctx, thrift.PollForDecisionTaskRequest(request), opts...)
   352  	return proto.PollForDecisionTaskResponse(response), proto.Error(err)
   353  }
   354  func (a workerAPIthriftAdapter) RespondDecisionTaskCompleted(ctx context.Context, request *apiv1.RespondDecisionTaskCompletedRequest, opts ...yarpc.CallOption) (*apiv1.RespondDecisionTaskCompletedResponse, error) {
   355  	response, err := a.service.RespondDecisionTaskCompleted(ctx, thrift.RespondDecisionTaskCompletedRequest(request), opts...)
   356  	return proto.RespondDecisionTaskCompletedResponse(response), proto.Error(err)
   357  }
   358  func (a workerAPIthriftAdapter) RespondDecisionTaskFailed(ctx context.Context, request *apiv1.RespondDecisionTaskFailedRequest, opts ...yarpc.CallOption) (*apiv1.RespondDecisionTaskFailedResponse, error) {
   359  	err := a.service.RespondDecisionTaskFailed(ctx, thrift.RespondDecisionTaskFailedRequest(request), opts...)
   360  	return &apiv1.RespondDecisionTaskFailedResponse{}, proto.Error(err)
   361  }
   362  func (a workerAPIthriftAdapter) PollForActivityTask(ctx context.Context, request *apiv1.PollForActivityTaskRequest, opts ...yarpc.CallOption) (*apiv1.PollForActivityTaskResponse, error) {
   363  	response, err := a.service.PollForActivityTask(ctx, thrift.PollForActivityTaskRequest(request), opts...)
   364  	return proto.PollForActivityTaskResponse(response), proto.Error(err)
   365  }
   366  func (a workerAPIthriftAdapter) RespondActivityTaskCompleted(ctx context.Context, request *apiv1.RespondActivityTaskCompletedRequest, opts ...yarpc.CallOption) (*apiv1.RespondActivityTaskCompletedResponse, error) {
   367  	err := a.service.RespondActivityTaskCompleted(ctx, thrift.RespondActivityTaskCompletedRequest(request), opts...)
   368  	return &apiv1.RespondActivityTaskCompletedResponse{}, proto.Error(err)
   369  }
   370  func (a workerAPIthriftAdapter) RespondActivityTaskCompletedByID(ctx context.Context, request *apiv1.RespondActivityTaskCompletedByIDRequest, opts ...yarpc.CallOption) (*apiv1.RespondActivityTaskCompletedByIDResponse, error) {
   371  	err := a.service.RespondActivityTaskCompletedByID(ctx, thrift.RespondActivityTaskCompletedByIdRequest(request), opts...)
   372  	return &apiv1.RespondActivityTaskCompletedByIDResponse{}, proto.Error(err)
   373  }
   374  func (a workerAPIthriftAdapter) RespondActivityTaskFailed(ctx context.Context, request *apiv1.RespondActivityTaskFailedRequest, opts ...yarpc.CallOption) (*apiv1.RespondActivityTaskFailedResponse, error) {
   375  	err := a.service.RespondActivityTaskFailed(ctx, thrift.RespondActivityTaskFailedRequest(request), opts...)
   376  	return &apiv1.RespondActivityTaskFailedResponse{}, proto.Error(err)
   377  }
   378  func (a workerAPIthriftAdapter) RespondActivityTaskFailedByID(ctx context.Context, request *apiv1.RespondActivityTaskFailedByIDRequest, opts ...yarpc.CallOption) (*apiv1.RespondActivityTaskFailedByIDResponse, error) {
   379  	err := a.service.RespondActivityTaskFailedByID(ctx, thrift.RespondActivityTaskFailedByIdRequest(request), opts...)
   380  	return &apiv1.RespondActivityTaskFailedByIDResponse{}, proto.Error(err)
   381  }
   382  func (a workerAPIthriftAdapter) RespondActivityTaskCanceled(ctx context.Context, request *apiv1.RespondActivityTaskCanceledRequest, opts ...yarpc.CallOption) (*apiv1.RespondActivityTaskCanceledResponse, error) {
   383  	err := a.service.RespondActivityTaskCanceled(ctx, thrift.RespondActivityTaskCanceledRequest(request), opts...)
   384  	return &apiv1.RespondActivityTaskCanceledResponse{}, proto.Error(err)
   385  }
   386  func (a workerAPIthriftAdapter) RespondActivityTaskCanceledByID(ctx context.Context, request *apiv1.RespondActivityTaskCanceledByIDRequest, opts ...yarpc.CallOption) (*apiv1.RespondActivityTaskCanceledByIDResponse, error) {
   387  	err := a.service.RespondActivityTaskCanceledByID(ctx, thrift.RespondActivityTaskCanceledByIdRequest(request), opts...)
   388  	return &apiv1.RespondActivityTaskCanceledByIDResponse{}, proto.Error(err)
   389  }
   390  func (a workerAPIthriftAdapter) RecordActivityTaskHeartbeat(ctx context.Context, request *apiv1.RecordActivityTaskHeartbeatRequest, opts ...yarpc.CallOption) (*apiv1.RecordActivityTaskHeartbeatResponse, error) {
   391  	response, err := a.service.RecordActivityTaskHeartbeat(ctx, thrift.RecordActivityTaskHeartbeatRequest(request), opts...)
   392  	return proto.RecordActivityTaskHeartbeatResponse(response), proto.Error(err)
   393  }
   394  func (a workerAPIthriftAdapter) RecordActivityTaskHeartbeatByID(ctx context.Context, request *apiv1.RecordActivityTaskHeartbeatByIDRequest, opts ...yarpc.CallOption) (*apiv1.RecordActivityTaskHeartbeatByIDResponse, error) {
   395  	response, err := a.service.RecordActivityTaskHeartbeatByID(ctx, thrift.RecordActivityTaskHeartbeatByIdRequest(request), opts...)
   396  	return proto.RecordActivityTaskHeartbeatByIdResponse(response), proto.Error(err)
   397  }
   398  func (a workerAPIthriftAdapter) RespondQueryTaskCompleted(ctx context.Context, request *apiv1.RespondQueryTaskCompletedRequest, opts ...yarpc.CallOption) (*apiv1.RespondQueryTaskCompletedResponse, error) {
   399  	err := a.service.RespondQueryTaskCompleted(ctx, thrift.RespondQueryTaskCompletedRequest(request), opts...)
   400  	return &apiv1.RespondQueryTaskCompletedResponse{}, proto.Error(err)
   401  }
   402  func (a workerAPIthriftAdapter) ResetStickyTaskList(ctx context.Context, request *apiv1.ResetStickyTaskListRequest, opts ...yarpc.CallOption) (*apiv1.ResetStickyTaskListResponse, error) {
   403  	_, err := a.service.ResetStickyTaskList(ctx, thrift.ResetStickyTaskListRequest(request), opts...)
   404  	return &apiv1.ResetStickyTaskListResponse{}, proto.Error(err)
   405  }
   406  
   407  type visibilityAPIthriftAdapter struct {
   408  	service workflowserviceclient.Interface
   409  }
   410  
   411  func NewVisibilityAPITriftAdapter(thrift workflowserviceclient.Interface) visibilityAPIthriftAdapter {
   412  	return visibilityAPIthriftAdapter{thrift}
   413  }
   414  
   415  func (a visibilityAPIthriftAdapter) ListWorkflowExecutions(ctx context.Context, request *apiv1.ListWorkflowExecutionsRequest, opts ...yarpc.CallOption) (*apiv1.ListWorkflowExecutionsResponse, error) {
   416  	response, err := a.service.ListWorkflowExecutions(ctx, thrift.ListWorkflowExecutionsRequest(request), opts...)
   417  	return proto.ListWorkflowExecutionsResponse(response), proto.Error(err)
   418  }
   419  func (a visibilityAPIthriftAdapter) ListOpenWorkflowExecutions(ctx context.Context, request *apiv1.ListOpenWorkflowExecutionsRequest, opts ...yarpc.CallOption) (*apiv1.ListOpenWorkflowExecutionsResponse, error) {
   420  	response, err := a.service.ListOpenWorkflowExecutions(ctx, thrift.ListOpenWorkflowExecutionsRequest(request), opts...)
   421  	return proto.ListOpenWorkflowExecutionsResponse(response), proto.Error(err)
   422  }
   423  func (a visibilityAPIthriftAdapter) ListClosedWorkflowExecutions(ctx context.Context, request *apiv1.ListClosedWorkflowExecutionsRequest, opts ...yarpc.CallOption) (*apiv1.ListClosedWorkflowExecutionsResponse, error) {
   424  	response, err := a.service.ListClosedWorkflowExecutions(ctx, thrift.ListClosedWorkflowExecutionsRequest(request), opts...)
   425  	return proto.ListClosedWorkflowExecutionsResponse(response), proto.Error(err)
   426  }
   427  func (a visibilityAPIthriftAdapter) ListArchivedWorkflowExecutions(ctx context.Context, request *apiv1.ListArchivedWorkflowExecutionsRequest, opts ...yarpc.CallOption) (*apiv1.ListArchivedWorkflowExecutionsResponse, error) {
   428  	response, err := a.service.ListArchivedWorkflowExecutions(ctx, thrift.ListArchivedWorkflowExecutionsRequest(request), opts...)
   429  	return proto.ListArchivedWorkflowExecutionsResponse(response), proto.Error(err)
   430  }
   431  func (a visibilityAPIthriftAdapter) ScanWorkflowExecutions(ctx context.Context, request *apiv1.ScanWorkflowExecutionsRequest, opts ...yarpc.CallOption) (*apiv1.ScanWorkflowExecutionsResponse, error) {
   432  	response, err := a.service.ScanWorkflowExecutions(ctx, thrift.ScanWorkflowExecutionsRequest(request), opts...)
   433  	return proto.ScanWorkflowExecutionsResponse(response), proto.Error(err)
   434  }
   435  func (a visibilityAPIthriftAdapter) CountWorkflowExecutions(ctx context.Context, request *apiv1.CountWorkflowExecutionsRequest, opts ...yarpc.CallOption) (*apiv1.CountWorkflowExecutionsResponse, error) {
   436  	response, err := a.service.CountWorkflowExecutions(ctx, thrift.CountWorkflowExecutionsRequest(request), opts...)
   437  	return proto.CountWorkflowExecutionsResponse(response), proto.Error(err)
   438  }
   439  func (a visibilityAPIthriftAdapter) GetSearchAttributes(ctx context.Context, request *apiv1.GetSearchAttributesRequest, opts ...yarpc.CallOption) (*apiv1.GetSearchAttributesResponse, error) {
   440  	response, err := a.service.GetSearchAttributes(ctx, opts...)
   441  	return proto.GetSearchAttributesResponse(response), proto.Error(err)
   442  }