Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite service proxy and interceptor to use new api-go code. #974

Merged
merged 15 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ copyright $(BUILD)/copyright:
@mkdir -p $(BUILD)
@touch $(BUILD)/copyright

# Ensure generated code dependent on the API is not stale
generatorcheck:
(cd converter && go run ../internal/cmd/generateinterceptor/main.go -verifyOnly)
(cd client && go run ../internal/cmd/generateproxy/main.go -verifyOnly)

$(BUILD)/dummy:
go build -o $@ internal/cmd/dummy/dummy.go

Expand Down Expand Up @@ -103,4 +98,4 @@ fmt:
clean:
rm -rf $(BUILD)

check: vet errcheck staticcheck copyright generatorcheck bins
check: vet errcheck staticcheck copyright bins
234 changes: 2 additions & 232 deletions client/service_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

// Code generated by go generate; DO NOT EDIT.

package client

import (
"context"

"go.temporal.io/api/proxy"
"go.temporal.io/api/workflowservice/v1"
)

Expand All @@ -39,236 +36,9 @@ type WorkflowServiceProxyOptions struct {
Client workflowservice.WorkflowServiceClient
}

type workflowServiceProxyServer struct {
workflowservice.UnimplementedWorkflowServiceServer
client workflowservice.WorkflowServiceClient
}

// NewWorkflowServiceProxyServer creates a WorkflowServiceServer suitable for registering with a GRPC Server. Requests will
// be forwarded to the passed in WorkflowService Client. GRPC interceptors can be added on the Server or Client to adjust
// requests and responses.
func NewWorkflowServiceProxyServer(options WorkflowServiceProxyOptions) (workflowservice.WorkflowServiceServer, error) {
return &workflowServiceProxyServer{
client: options.Client,
}, nil
}

func (wh *workflowServiceProxyServer) CountWorkflowExecutions(ctx context.Context, req *workflowservice.CountWorkflowExecutionsRequest) (*workflowservice.CountWorkflowExecutionsResponse, error) {
return wh.client.CountWorkflowExecutions(ctx, req)
}

func (wh *workflowServiceProxyServer) CreateSchedule(ctx context.Context, req *workflowservice.CreateScheduleRequest) (*workflowservice.CreateScheduleResponse, error) {
return wh.client.CreateSchedule(ctx, req)
}

func (wh *workflowServiceProxyServer) DeleteSchedule(ctx context.Context, req *workflowservice.DeleteScheduleRequest) (*workflowservice.DeleteScheduleResponse, error) {
return wh.client.DeleteSchedule(ctx, req)
}

func (wh *workflowServiceProxyServer) DeleteWorkflowExecution(ctx context.Context, req *workflowservice.DeleteWorkflowExecutionRequest) (*workflowservice.DeleteWorkflowExecutionResponse, error) {
return wh.client.DeleteWorkflowExecution(ctx, req)
}

func (wh *workflowServiceProxyServer) DeprecateNamespace(ctx context.Context, req *workflowservice.DeprecateNamespaceRequest) (*workflowservice.DeprecateNamespaceResponse, error) {
return wh.client.DeprecateNamespace(ctx, req)
}

func (wh *workflowServiceProxyServer) DescribeBatchOperation(ctx context.Context, req *workflowservice.DescribeBatchOperationRequest) (*workflowservice.DescribeBatchOperationResponse, error) {
return wh.client.DescribeBatchOperation(ctx, req)
}

func (wh *workflowServiceProxyServer) DescribeNamespace(ctx context.Context, req *workflowservice.DescribeNamespaceRequest) (*workflowservice.DescribeNamespaceResponse, error) {
return wh.client.DescribeNamespace(ctx, req)
}

func (wh *workflowServiceProxyServer) DescribeSchedule(ctx context.Context, req *workflowservice.DescribeScheduleRequest) (*workflowservice.DescribeScheduleResponse, error) {
return wh.client.DescribeSchedule(ctx, req)
}

func (wh *workflowServiceProxyServer) DescribeTaskQueue(ctx context.Context, req *workflowservice.DescribeTaskQueueRequest) (*workflowservice.DescribeTaskQueueResponse, error) {
return wh.client.DescribeTaskQueue(ctx, req)
}

func (wh *workflowServiceProxyServer) DescribeWorkflowExecution(ctx context.Context, req *workflowservice.DescribeWorkflowExecutionRequest) (*workflowservice.DescribeWorkflowExecutionResponse, error) {
return wh.client.DescribeWorkflowExecution(ctx, req)
}

func (wh *workflowServiceProxyServer) GetClusterInfo(ctx context.Context, req *workflowservice.GetClusterInfoRequest) (*workflowservice.GetClusterInfoResponse, error) {
return wh.client.GetClusterInfo(ctx, req)
}

func (wh *workflowServiceProxyServer) GetSearchAttributes(ctx context.Context, req *workflowservice.GetSearchAttributesRequest) (*workflowservice.GetSearchAttributesResponse, error) {
return wh.client.GetSearchAttributes(ctx, req)
}

func (wh *workflowServiceProxyServer) GetSystemInfo(ctx context.Context, req *workflowservice.GetSystemInfoRequest) (*workflowservice.GetSystemInfoResponse, error) {
return wh.client.GetSystemInfo(ctx, req)
}

func (wh *workflowServiceProxyServer) GetWorkerBuildIdOrdering(ctx context.Context, req *workflowservice.GetWorkerBuildIdOrderingRequest) (*workflowservice.GetWorkerBuildIdOrderingResponse, error) {
return wh.client.GetWorkerBuildIdOrdering(ctx, req)
}

func (wh *workflowServiceProxyServer) GetWorkflowExecutionHistory(ctx context.Context, req *workflowservice.GetWorkflowExecutionHistoryRequest) (*workflowservice.GetWorkflowExecutionHistoryResponse, error) {
return wh.client.GetWorkflowExecutionHistory(ctx, req)
}

func (wh *workflowServiceProxyServer) GetWorkflowExecutionHistoryReverse(ctx context.Context, req *workflowservice.GetWorkflowExecutionHistoryReverseRequest) (*workflowservice.GetWorkflowExecutionHistoryReverseResponse, error) {
return wh.client.GetWorkflowExecutionHistoryReverse(ctx, req)
}

func (wh *workflowServiceProxyServer) ListArchivedWorkflowExecutions(ctx context.Context, req *workflowservice.ListArchivedWorkflowExecutionsRequest) (*workflowservice.ListArchivedWorkflowExecutionsResponse, error) {
return wh.client.ListArchivedWorkflowExecutions(ctx, req)
}

func (wh *workflowServiceProxyServer) ListBatchOperations(ctx context.Context, req *workflowservice.ListBatchOperationsRequest) (*workflowservice.ListBatchOperationsResponse, error) {
return wh.client.ListBatchOperations(ctx, req)
}

func (wh *workflowServiceProxyServer) ListClosedWorkflowExecutions(ctx context.Context, req *workflowservice.ListClosedWorkflowExecutionsRequest) (*workflowservice.ListClosedWorkflowExecutionsResponse, error) {
return wh.client.ListClosedWorkflowExecutions(ctx, req)
}

func (wh *workflowServiceProxyServer) ListNamespaces(ctx context.Context, req *workflowservice.ListNamespacesRequest) (*workflowservice.ListNamespacesResponse, error) {
return wh.client.ListNamespaces(ctx, req)
}

func (wh *workflowServiceProxyServer) ListOpenWorkflowExecutions(ctx context.Context, req *workflowservice.ListOpenWorkflowExecutionsRequest) (*workflowservice.ListOpenWorkflowExecutionsResponse, error) {
return wh.client.ListOpenWorkflowExecutions(ctx, req)
}

func (wh *workflowServiceProxyServer) ListScheduleMatchingTimes(ctx context.Context, req *workflowservice.ListScheduleMatchingTimesRequest) (*workflowservice.ListScheduleMatchingTimesResponse, error) {
return wh.client.ListScheduleMatchingTimes(ctx, req)
}

func (wh *workflowServiceProxyServer) ListSchedules(ctx context.Context, req *workflowservice.ListSchedulesRequest) (*workflowservice.ListSchedulesResponse, error) {
return wh.client.ListSchedules(ctx, req)
}

func (wh *workflowServiceProxyServer) ListTaskQueuePartitions(ctx context.Context, req *workflowservice.ListTaskQueuePartitionsRequest) (*workflowservice.ListTaskQueuePartitionsResponse, error) {
return wh.client.ListTaskQueuePartitions(ctx, req)
}

func (wh *workflowServiceProxyServer) ListWorkflowExecutions(ctx context.Context, req *workflowservice.ListWorkflowExecutionsRequest) (*workflowservice.ListWorkflowExecutionsResponse, error) {
return wh.client.ListWorkflowExecutions(ctx, req)
}

func (wh *workflowServiceProxyServer) PatchSchedule(ctx context.Context, req *workflowservice.PatchScheduleRequest) (*workflowservice.PatchScheduleResponse, error) {
return wh.client.PatchSchedule(ctx, req)
}

func (wh *workflowServiceProxyServer) PollActivityTaskQueue(ctx context.Context, req *workflowservice.PollActivityTaskQueueRequest) (*workflowservice.PollActivityTaskQueueResponse, error) {
return wh.client.PollActivityTaskQueue(ctx, req)
}

func (wh *workflowServiceProxyServer) PollWorkflowTaskQueue(ctx context.Context, req *workflowservice.PollWorkflowTaskQueueRequest) (*workflowservice.PollWorkflowTaskQueueResponse, error) {
return wh.client.PollWorkflowTaskQueue(ctx, req)
}

func (wh *workflowServiceProxyServer) QueryWorkflow(ctx context.Context, req *workflowservice.QueryWorkflowRequest) (*workflowservice.QueryWorkflowResponse, error) {
return wh.client.QueryWorkflow(ctx, req)
}

func (wh *workflowServiceProxyServer) RecordActivityTaskHeartbeat(ctx context.Context, req *workflowservice.RecordActivityTaskHeartbeatRequest) (*workflowservice.RecordActivityTaskHeartbeatResponse, error) {
return wh.client.RecordActivityTaskHeartbeat(ctx, req)
}

func (wh *workflowServiceProxyServer) RecordActivityTaskHeartbeatById(ctx context.Context, req *workflowservice.RecordActivityTaskHeartbeatByIdRequest) (*workflowservice.RecordActivityTaskHeartbeatByIdResponse, error) {
return wh.client.RecordActivityTaskHeartbeatById(ctx, req)
}

func (wh *workflowServiceProxyServer) RegisterNamespace(ctx context.Context, req *workflowservice.RegisterNamespaceRequest) (*workflowservice.RegisterNamespaceResponse, error) {
return wh.client.RegisterNamespace(ctx, req)
}

func (wh *workflowServiceProxyServer) RequestCancelWorkflowExecution(ctx context.Context, req *workflowservice.RequestCancelWorkflowExecutionRequest) (*workflowservice.RequestCancelWorkflowExecutionResponse, error) {
return wh.client.RequestCancelWorkflowExecution(ctx, req)
}

func (wh *workflowServiceProxyServer) ResetStickyTaskQueue(ctx context.Context, req *workflowservice.ResetStickyTaskQueueRequest) (*workflowservice.ResetStickyTaskQueueResponse, error) {
return wh.client.ResetStickyTaskQueue(ctx, req)
}

func (wh *workflowServiceProxyServer) ResetWorkflowExecution(ctx context.Context, req *workflowservice.ResetWorkflowExecutionRequest) (*workflowservice.ResetWorkflowExecutionResponse, error) {
return wh.client.ResetWorkflowExecution(ctx, req)
}

func (wh *workflowServiceProxyServer) RespondActivityTaskCanceled(ctx context.Context, req *workflowservice.RespondActivityTaskCanceledRequest) (*workflowservice.RespondActivityTaskCanceledResponse, error) {
return wh.client.RespondActivityTaskCanceled(ctx, req)
}

func (wh *workflowServiceProxyServer) RespondActivityTaskCanceledById(ctx context.Context, req *workflowservice.RespondActivityTaskCanceledByIdRequest) (*workflowservice.RespondActivityTaskCanceledByIdResponse, error) {
return wh.client.RespondActivityTaskCanceledById(ctx, req)
}

func (wh *workflowServiceProxyServer) RespondActivityTaskCompleted(ctx context.Context, req *workflowservice.RespondActivityTaskCompletedRequest) (*workflowservice.RespondActivityTaskCompletedResponse, error) {
return wh.client.RespondActivityTaskCompleted(ctx, req)
}

func (wh *workflowServiceProxyServer) RespondActivityTaskCompletedById(ctx context.Context, req *workflowservice.RespondActivityTaskCompletedByIdRequest) (*workflowservice.RespondActivityTaskCompletedByIdResponse, error) {
return wh.client.RespondActivityTaskCompletedById(ctx, req)
}

func (wh *workflowServiceProxyServer) RespondActivityTaskFailed(ctx context.Context, req *workflowservice.RespondActivityTaskFailedRequest) (*workflowservice.RespondActivityTaskFailedResponse, error) {
return wh.client.RespondActivityTaskFailed(ctx, req)
}

func (wh *workflowServiceProxyServer) RespondActivityTaskFailedById(ctx context.Context, req *workflowservice.RespondActivityTaskFailedByIdRequest) (*workflowservice.RespondActivityTaskFailedByIdResponse, error) {
return wh.client.RespondActivityTaskFailedById(ctx, req)
}

func (wh *workflowServiceProxyServer) RespondQueryTaskCompleted(ctx context.Context, req *workflowservice.RespondQueryTaskCompletedRequest) (*workflowservice.RespondQueryTaskCompletedResponse, error) {
return wh.client.RespondQueryTaskCompleted(ctx, req)
}

func (wh *workflowServiceProxyServer) RespondWorkflowTaskCompleted(ctx context.Context, req *workflowservice.RespondWorkflowTaskCompletedRequest) (*workflowservice.RespondWorkflowTaskCompletedResponse, error) {
return wh.client.RespondWorkflowTaskCompleted(ctx, req)
}

func (wh *workflowServiceProxyServer) RespondWorkflowTaskFailed(ctx context.Context, req *workflowservice.RespondWorkflowTaskFailedRequest) (*workflowservice.RespondWorkflowTaskFailedResponse, error) {
return wh.client.RespondWorkflowTaskFailed(ctx, req)
}

func (wh *workflowServiceProxyServer) ScanWorkflowExecutions(ctx context.Context, req *workflowservice.ScanWorkflowExecutionsRequest) (*workflowservice.ScanWorkflowExecutionsResponse, error) {
return wh.client.ScanWorkflowExecutions(ctx, req)
}

func (wh *workflowServiceProxyServer) SignalWithStartWorkflowExecution(ctx context.Context, req *workflowservice.SignalWithStartWorkflowExecutionRequest) (*workflowservice.SignalWithStartWorkflowExecutionResponse, error) {
return wh.client.SignalWithStartWorkflowExecution(ctx, req)
}

func (wh *workflowServiceProxyServer) SignalWorkflowExecution(ctx context.Context, req *workflowservice.SignalWorkflowExecutionRequest) (*workflowservice.SignalWorkflowExecutionResponse, error) {
return wh.client.SignalWorkflowExecution(ctx, req)
}

func (wh *workflowServiceProxyServer) StartBatchOperation(ctx context.Context, req *workflowservice.StartBatchOperationRequest) (*workflowservice.StartBatchOperationResponse, error) {
return wh.client.StartBatchOperation(ctx, req)
}

func (wh *workflowServiceProxyServer) StartWorkflowExecution(ctx context.Context, req *workflowservice.StartWorkflowExecutionRequest) (*workflowservice.StartWorkflowExecutionResponse, error) {
return wh.client.StartWorkflowExecution(ctx, req)
}

func (wh *workflowServiceProxyServer) StopBatchOperation(ctx context.Context, req *workflowservice.StopBatchOperationRequest) (*workflowservice.StopBatchOperationResponse, error) {
return wh.client.StopBatchOperation(ctx, req)
}

func (wh *workflowServiceProxyServer) TerminateWorkflowExecution(ctx context.Context, req *workflowservice.TerminateWorkflowExecutionRequest) (*workflowservice.TerminateWorkflowExecutionResponse, error) {
return wh.client.TerminateWorkflowExecution(ctx, req)
}

func (wh *workflowServiceProxyServer) UpdateNamespace(ctx context.Context, req *workflowservice.UpdateNamespaceRequest) (*workflowservice.UpdateNamespaceResponse, error) {
return wh.client.UpdateNamespace(ctx, req)
}

func (wh *workflowServiceProxyServer) UpdateSchedule(ctx context.Context, req *workflowservice.UpdateScheduleRequest) (*workflowservice.UpdateScheduleResponse, error) {
return wh.client.UpdateSchedule(ctx, req)
}

func (wh *workflowServiceProxyServer) UpdateWorkerBuildIdOrdering(ctx context.Context, req *workflowservice.UpdateWorkerBuildIdOrderingRequest) (*workflowservice.UpdateWorkerBuildIdOrderingResponse, error) {
return wh.client.UpdateWorkerBuildIdOrdering(ctx, req)
}

func (wh *workflowServiceProxyServer) UpdateWorkflow(ctx context.Context, req *workflowservice.UpdateWorkflowRequest) (*workflowservice.UpdateWorkflowResponse, error) {
return wh.client.UpdateWorkflow(ctx, req)
return proxy.NewWorkflowServiceProxyServer(proxy.WorkflowServiceProxyOptions(options))
}
Loading