Skip to content

Commit

Permalink
compat layer
Browse files Browse the repository at this point in the history
  • Loading branch information
taylanisikdemir committed Mar 18, 2024
1 parent 6425011 commit 08cde0b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/compatibility/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
19 changes: 19 additions & 0 deletions internal/compatibility/proto/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions internal/compatibility/thrift/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 08cde0b

Please sign in to comment.