From 08cde0b8fd572057841ac6a84cf789284f70c38d Mon Sep 17 00:00:00 2001 From: taylan isikdemir Date: Mon, 18 Mar 2024 11:42:27 -0700 Subject: [PATCH] compat layer --- internal/compatibility/adapter.go | 10 ++++++++++ internal/compatibility/proto/request.go | 19 +++++++++++++++++++ internal/compatibility/thrift/response.go | 14 ++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/internal/compatibility/adapter.go b/internal/compatibility/adapter.go index 5a7709b11..93846088c 100644 --- a/internal/compatibility/adapter.go +++ b/internal/compatibility/adapter.go @@ -219,6 +219,11 @@ func (a thrift2protoAdapter) SignalWithStartWorkflowExecution(ctx context.Contex return thrift.SignalWithStartWorkflowExecutionResponse(response), thrift.Error(err) } +func (a thrift2protoAdapter) SignalWithStartWorkflowExecutionAsync(ctx context.Context, request *shared.SignalWithStartWorkflowExecutionAsyncRequest, opts ...yarpc.CallOption) (*shared.SignalWithStartWorkflowExecutionAsyncResponse, error) { + response, err := a.workflow.SignalWithStartWorkflowExecutionAsync(ctx, proto.SignalWithStartWorkflowExecutionAsyncRequest(request), opts...) + return thrift.SignalWithStartWorkflowExecutionAsyncResponse(response), thrift.Error(err) +} + func (a thrift2protoAdapter) SignalWorkflowExecution(ctx context.Context, request *shared.SignalWorkflowExecutionRequest, opts ...yarpc.CallOption) error { _, err := a.workflow.SignalWorkflowExecution(ctx, proto.SignalWorkflowExecutionRequest(request), opts...) return thrift.Error(err) @@ -229,6 +234,11 @@ func (a thrift2protoAdapter) StartWorkflowExecution(ctx context.Context, request return thrift.StartWorkflowExecutionResponse(response), thrift.Error(err) } +func (a thrift2protoAdapter) StartWorkflowExecutionAsync(ctx context.Context, request *shared.StartWorkflowExecutionAsyncRequest, opts ...yarpc.CallOption) (*shared.StartWorkflowExecutionAsyncResponse, error) { + response, err := a.workflow.StartWorkflowExecutionAsync(ctx, proto.StartWorkflowExecutionAsyncRequest(request), opts...) + return thrift.StartWorkflowExecutionAsyncResponse(response), thrift.Error(err) +} + func (a thrift2protoAdapter) TerminateWorkflowExecution(ctx context.Context, request *shared.TerminateWorkflowExecutionRequest, opts ...yarpc.CallOption) error { _, err := a.workflow.TerminateWorkflowExecution(ctx, proto.TerminateWorkflowExecutionRequest(request), opts...) return thrift.Error(err) diff --git a/internal/compatibility/proto/request.go b/internal/compatibility/proto/request.go index 368040994..29d7dc654 100644 --- a/internal/compatibility/proto/request.go +++ b/internal/compatibility/proto/request.go @@ -417,6 +417,16 @@ func SignalWithStartWorkflowExecutionRequest(t *shared.SignalWithStartWorkflowEx } } +func SignalWithStartWorkflowExecutionAsyncRequest(t *shared.SignalWithStartWorkflowExecutionAsyncRequest) *apiv1.SignalWithStartWorkflowExecutionAsyncRequest { + if t == nil { + return nil + } + + return &apiv1.SignalWithStartWorkflowExecutionAsyncRequest{ + Request: SignalWithStartWorkflowExecutionRequest(t.GetRequest()), + } +} + func SignalWorkflowExecutionRequest(t *shared.SignalWorkflowExecutionRequest) *apiv1.SignalWorkflowExecutionRequest { if t == nil { return nil @@ -457,6 +467,15 @@ func StartWorkflowExecutionRequest(t *shared.StartWorkflowExecutionRequest) *api } } +func StartWorkflowExecutionAsyncRequest(t *shared.StartWorkflowExecutionAsyncRequest) *apiv1.StartWorkflowExecutionAsyncRequest { + if t == nil { + return nil + } + return &apiv1.StartWorkflowExecutionAsyncRequest{ + Request: StartWorkflowExecutionRequest(t.GetRequest()), + } +} + func TerminateWorkflowExecutionRequest(t *shared.TerminateWorkflowExecutionRequest) *apiv1.TerminateWorkflowExecutionRequest { if t == nil { return nil diff --git a/internal/compatibility/thrift/response.go b/internal/compatibility/thrift/response.go index 1247618b6..7f24d7364 100644 --- a/internal/compatibility/thrift/response.go +++ b/internal/compatibility/thrift/response.go @@ -293,6 +293,13 @@ func SignalWithStartWorkflowExecutionResponse(t *apiv1.SignalWithStartWorkflowEx } } +func SignalWithStartWorkflowExecutionAsyncResponse(t *apiv1.SignalWithStartWorkflowExecutionAsyncResponse) *shared.SignalWithStartWorkflowExecutionAsyncResponse { + if t == nil { + return nil + } + return &shared.SignalWithStartWorkflowExecutionAsyncResponse{} +} + func StartWorkflowExecutionResponse(t *apiv1.StartWorkflowExecutionResponse) *shared.StartWorkflowExecutionResponse { if t == nil { return nil @@ -302,6 +309,13 @@ func StartWorkflowExecutionResponse(t *apiv1.StartWorkflowExecutionResponse) *sh } } +func StartWorkflowExecutionAsyncResponse(t *apiv1.StartWorkflowExecutionAsyncResponse) *shared.StartWorkflowExecutionAsyncResponse { + if t == nil { + return nil + } + return &shared.StartWorkflowExecutionAsyncResponse{} +} + func UpdateDomainResponse(t *apiv1.UpdateDomainResponse) *shared.UpdateDomainResponse { if t == nil || t.Domain == nil { return nil