Skip to content

Commit

Permalink
Switch frontend handlers to use internal types (cadence-workflow#3828)
Browse files Browse the repository at this point in the history
  • Loading branch information
vytautas-karpavicius authored Dec 7, 2020
1 parent b786d3c commit 0f02810
Show file tree
Hide file tree
Showing 9 changed files with 676 additions and 727 deletions.
87 changes: 43 additions & 44 deletions service/frontend/accessControlledHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"context"

health "github.com/uber/cadence/.gen/go/health"
"github.com/uber/cadence/.gen/go/shared"
"github.com/uber/cadence/common/authorization"
"github.com/uber/cadence/common/metrics"
"github.com/uber/cadence/common/resource"
Expand Down Expand Up @@ -133,8 +132,8 @@ func (a *AccessControlledWorkflowHandler) DescribeDomain(
// DescribeTaskList API call
func (a *AccessControlledWorkflowHandler) DescribeTaskList(
ctx context.Context,
request *shared.DescribeTaskListRequest,
) (*shared.DescribeTaskListResponse, error) {
request *types.DescribeTaskListRequest,
) (*types.DescribeTaskListResponse, error) {

scope := a.getMetricsScopeWithDomain(metrics.FrontendDescribeTaskListScope, request)

Expand All @@ -156,8 +155,8 @@ func (a *AccessControlledWorkflowHandler) DescribeTaskList(
// DescribeWorkflowExecution API call
func (a *AccessControlledWorkflowHandler) DescribeWorkflowExecution(
ctx context.Context,
request *shared.DescribeWorkflowExecutionRequest,
) (*shared.DescribeWorkflowExecutionResponse, error) {
request *types.DescribeWorkflowExecutionRequest,
) (*types.DescribeWorkflowExecutionResponse, error) {

scope := a.getMetricsScopeWithDomain(metrics.FrontendDescribeWorkflowExecutionScope, request)

Expand All @@ -179,15 +178,15 @@ func (a *AccessControlledWorkflowHandler) DescribeWorkflowExecution(
// GetSearchAttributes API call
func (a *AccessControlledWorkflowHandler) GetSearchAttributes(
ctx context.Context,
) (*shared.GetSearchAttributesResponse, error) {
) (*types.GetSearchAttributesResponse, error) {
return a.frontendHandler.GetSearchAttributes(ctx)
}

// GetWorkflowExecutionHistory API call
func (a *AccessControlledWorkflowHandler) GetWorkflowExecutionHistory(
ctx context.Context,
request *shared.GetWorkflowExecutionHistoryRequest,
) (*shared.GetWorkflowExecutionHistoryResponse, error) {
request *types.GetWorkflowExecutionHistoryRequest,
) (*types.GetWorkflowExecutionHistoryResponse, error) {

scope := a.getMetricsScopeWithDomain(metrics.FrontendGetWorkflowExecutionHistoryScope, request)

Expand All @@ -209,8 +208,8 @@ func (a *AccessControlledWorkflowHandler) GetWorkflowExecutionHistory(
// ListArchivedWorkflowExecutions API call
func (a *AccessControlledWorkflowHandler) ListArchivedWorkflowExecutions(
ctx context.Context,
request *shared.ListArchivedWorkflowExecutionsRequest,
) (*shared.ListArchivedWorkflowExecutionsResponse, error) {
request *types.ListArchivedWorkflowExecutionsRequest,
) (*types.ListArchivedWorkflowExecutionsResponse, error) {

scope := a.getMetricsScopeWithDomain(metrics.FrontendListArchivedWorkflowExecutionsScope, request)

Expand Down Expand Up @@ -323,8 +322,8 @@ func (a *AccessControlledWorkflowHandler) ListWorkflowExecutions(
// PollForActivityTask API call
func (a *AccessControlledWorkflowHandler) PollForActivityTask(
ctx context.Context,
request *shared.PollForActivityTaskRequest,
) (*shared.PollForActivityTaskResponse, error) {
request *types.PollForActivityTaskRequest,
) (*types.PollForActivityTaskResponse, error) {

scope := a.getMetricsScopeWithDomain(metrics.FrontendPollForActivityTaskScope, request)

Expand All @@ -346,8 +345,8 @@ func (a *AccessControlledWorkflowHandler) PollForActivityTask(
// PollForDecisionTask API call
func (a *AccessControlledWorkflowHandler) PollForDecisionTask(
ctx context.Context,
request *shared.PollForDecisionTaskRequest,
) (*shared.PollForDecisionTaskResponse, error) {
request *types.PollForDecisionTaskRequest,
) (*types.PollForDecisionTaskResponse, error) {

scope := a.getMetricsScopeWithDomain(metrics.FrontendPollForDecisionTaskScope, request)

Expand All @@ -369,8 +368,8 @@ func (a *AccessControlledWorkflowHandler) PollForDecisionTask(
// QueryWorkflow API call
func (a *AccessControlledWorkflowHandler) QueryWorkflow(
ctx context.Context,
request *shared.QueryWorkflowRequest,
) (*shared.QueryWorkflowResponse, error) {
request *types.QueryWorkflowRequest,
) (*types.QueryWorkflowResponse, error) {

scope := a.getMetricsScopeWithDomain(metrics.FrontendQueryWorkflowScope, request)

Expand All @@ -392,24 +391,24 @@ func (a *AccessControlledWorkflowHandler) QueryWorkflow(
// GetClusterInfo API call
func (a *AccessControlledWorkflowHandler) GetClusterInfo(
ctx context.Context,
) (*shared.ClusterInfo, error) {
) (*types.ClusterInfo, error) {
return a.frontendHandler.GetClusterInfo(ctx)
}

// RecordActivityTaskHeartbeat API call
func (a *AccessControlledWorkflowHandler) RecordActivityTaskHeartbeat(
ctx context.Context,
request *shared.RecordActivityTaskHeartbeatRequest,
) (*shared.RecordActivityTaskHeartbeatResponse, error) {
request *types.RecordActivityTaskHeartbeatRequest,
) (*types.RecordActivityTaskHeartbeatResponse, error) {
// TODO(vancexu): add auth check for service API
return a.frontendHandler.RecordActivityTaskHeartbeat(ctx, request)
}

// RecordActivityTaskHeartbeatByID API call
func (a *AccessControlledWorkflowHandler) RecordActivityTaskHeartbeatByID(
ctx context.Context,
request *shared.RecordActivityTaskHeartbeatByIDRequest,
) (*shared.RecordActivityTaskHeartbeatResponse, error) {
request *types.RecordActivityTaskHeartbeatByIDRequest,
) (*types.RecordActivityTaskHeartbeatResponse, error) {
return a.frontendHandler.RecordActivityTaskHeartbeatByID(ctx, request)
}

Expand Down Expand Up @@ -439,7 +438,7 @@ func (a *AccessControlledWorkflowHandler) RegisterDomain(
// RequestCancelWorkflowExecution API call
func (a *AccessControlledWorkflowHandler) RequestCancelWorkflowExecution(
ctx context.Context,
request *shared.RequestCancelWorkflowExecutionRequest,
request *types.RequestCancelWorkflowExecutionRequest,
) error {

scope := a.getMetricsScopeWithDomain(metrics.FrontendRequestCancelWorkflowExecutionScope, request)
Expand All @@ -462,8 +461,8 @@ func (a *AccessControlledWorkflowHandler) RequestCancelWorkflowExecution(
// ResetStickyTaskList API call
func (a *AccessControlledWorkflowHandler) ResetStickyTaskList(
ctx context.Context,
request *shared.ResetStickyTaskListRequest,
) (*shared.ResetStickyTaskListResponse, error) {
request *types.ResetStickyTaskListRequest,
) (*types.ResetStickyTaskListResponse, error) {

scope := a.getMetricsScopeWithDomain(metrics.FrontendResetStickyTaskListScope, request)

Expand All @@ -485,8 +484,8 @@ func (a *AccessControlledWorkflowHandler) ResetStickyTaskList(
// ResetWorkflowExecution API call
func (a *AccessControlledWorkflowHandler) ResetWorkflowExecution(
ctx context.Context,
request *shared.ResetWorkflowExecutionRequest,
) (*shared.ResetWorkflowExecutionResponse, error) {
request *types.ResetWorkflowExecutionRequest,
) (*types.ResetWorkflowExecutionResponse, error) {

scope := a.getMetricsScopeWithDomain(metrics.FrontendResetWorkflowExecutionScope, request)

Expand All @@ -508,71 +507,71 @@ func (a *AccessControlledWorkflowHandler) ResetWorkflowExecution(
// RespondActivityTaskCanceled API call
func (a *AccessControlledWorkflowHandler) RespondActivityTaskCanceled(
ctx context.Context,
request *shared.RespondActivityTaskCanceledRequest,
request *types.RespondActivityTaskCanceledRequest,
) error {
return a.frontendHandler.RespondActivityTaskCanceled(ctx, request)
}

// RespondActivityTaskCanceledByID API call
func (a *AccessControlledWorkflowHandler) RespondActivityTaskCanceledByID(
ctx context.Context,
request *shared.RespondActivityTaskCanceledByIDRequest,
request *types.RespondActivityTaskCanceledByIDRequest,
) error {
return a.frontendHandler.RespondActivityTaskCanceledByID(ctx, request)
}

// RespondActivityTaskCompleted API call
func (a *AccessControlledWorkflowHandler) RespondActivityTaskCompleted(
ctx context.Context,
request *shared.RespondActivityTaskCompletedRequest,
request *types.RespondActivityTaskCompletedRequest,
) error {
return a.frontendHandler.RespondActivityTaskCompleted(ctx, request)
}

// RespondActivityTaskCompletedByID API call
func (a *AccessControlledWorkflowHandler) RespondActivityTaskCompletedByID(
ctx context.Context,
request *shared.RespondActivityTaskCompletedByIDRequest,
request *types.RespondActivityTaskCompletedByIDRequest,
) error {
return a.frontendHandler.RespondActivityTaskCompletedByID(ctx, request)
}

// RespondActivityTaskFailed API call
func (a *AccessControlledWorkflowHandler) RespondActivityTaskFailed(
ctx context.Context,
request *shared.RespondActivityTaskFailedRequest,
request *types.RespondActivityTaskFailedRequest,
) error {
return a.frontendHandler.RespondActivityTaskFailed(ctx, request)
}

// RespondActivityTaskFailedByID API call
func (a *AccessControlledWorkflowHandler) RespondActivityTaskFailedByID(
ctx context.Context,
request *shared.RespondActivityTaskFailedByIDRequest,
request *types.RespondActivityTaskFailedByIDRequest,
) error {
return a.frontendHandler.RespondActivityTaskFailedByID(ctx, request)
}

// RespondDecisionTaskCompleted API call
func (a *AccessControlledWorkflowHandler) RespondDecisionTaskCompleted(
ctx context.Context,
request *shared.RespondDecisionTaskCompletedRequest,
) (*shared.RespondDecisionTaskCompletedResponse, error) {
request *types.RespondDecisionTaskCompletedRequest,
) (*types.RespondDecisionTaskCompletedResponse, error) {
return a.frontendHandler.RespondDecisionTaskCompleted(ctx, request)
}

// RespondDecisionTaskFailed API call
func (a *AccessControlledWorkflowHandler) RespondDecisionTaskFailed(
ctx context.Context,
request *shared.RespondDecisionTaskFailedRequest,
request *types.RespondDecisionTaskFailedRequest,
) error {
return a.frontendHandler.RespondDecisionTaskFailed(ctx, request)
}

// RespondQueryTaskCompleted API call
func (a *AccessControlledWorkflowHandler) RespondQueryTaskCompleted(
ctx context.Context,
request *shared.RespondQueryTaskCompletedRequest,
request *types.RespondQueryTaskCompletedRequest,
) error {
return a.frontendHandler.RespondQueryTaskCompleted(ctx, request)
}
Expand Down Expand Up @@ -603,8 +602,8 @@ func (a *AccessControlledWorkflowHandler) ScanWorkflowExecutions(
// SignalWithStartWorkflowExecution API call
func (a *AccessControlledWorkflowHandler) SignalWithStartWorkflowExecution(
ctx context.Context,
request *shared.SignalWithStartWorkflowExecutionRequest,
) (*shared.StartWorkflowExecutionResponse, error) {
request *types.SignalWithStartWorkflowExecutionRequest,
) (*types.StartWorkflowExecutionResponse, error) {

scope := a.getMetricsScopeWithDomain(metrics.FrontendSignalWithStartWorkflowExecutionScope, request)

Expand All @@ -626,7 +625,7 @@ func (a *AccessControlledWorkflowHandler) SignalWithStartWorkflowExecution(
// SignalWorkflowExecution API call
func (a *AccessControlledWorkflowHandler) SignalWorkflowExecution(
ctx context.Context,
request *shared.SignalWorkflowExecutionRequest,
request *types.SignalWorkflowExecutionRequest,
) error {

scope := a.getMetricsScopeWithDomain(metrics.FrontendSignalWorkflowExecutionScope, request)
Expand All @@ -649,8 +648,8 @@ func (a *AccessControlledWorkflowHandler) SignalWorkflowExecution(
// StartWorkflowExecution API call
func (a *AccessControlledWorkflowHandler) StartWorkflowExecution(
ctx context.Context,
request *shared.StartWorkflowExecutionRequest,
) (*shared.StartWorkflowExecutionResponse, error) {
request *types.StartWorkflowExecutionRequest,
) (*types.StartWorkflowExecutionResponse, error) {

scope := a.getMetricsScopeWithDomain(metrics.FrontendStartWorkflowExecutionScope, request)

Expand All @@ -672,7 +671,7 @@ func (a *AccessControlledWorkflowHandler) StartWorkflowExecution(
// TerminateWorkflowExecution API call
func (a *AccessControlledWorkflowHandler) TerminateWorkflowExecution(
ctx context.Context,
request *shared.TerminateWorkflowExecutionRequest,
request *types.TerminateWorkflowExecutionRequest,
) error {

scope := a.getMetricsScopeWithDomain(metrics.FrontendTerminateWorkflowExecutionScope, request)
Expand All @@ -695,8 +694,8 @@ func (a *AccessControlledWorkflowHandler) TerminateWorkflowExecution(
// ListTaskListPartitions API call
func (a *AccessControlledWorkflowHandler) ListTaskListPartitions(
ctx context.Context,
request *shared.ListTaskListPartitionsRequest,
) (*shared.ListTaskListPartitionsResponse, error) {
request *types.ListTaskListPartitionsRequest,
) (*types.ListTaskListPartitionsResponse, error) {

scope := a.getMetricsScopeWithDomain(metrics.FrontendListTaskListPartitionsScope, request)

Expand Down
Loading

0 comments on commit 0f02810

Please sign in to comment.