Skip to content

Commit b9e0f97

Browse files
committed
Revert back to single line methods
1 parent f97450b commit b9e0f97

File tree

1 file changed

+28
-100
lines changed

1 file changed

+28
-100
lines changed

service/history/handler.go

Lines changed: 28 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,7 @@ func (h *Handler) IsActivityTaskValid(ctx context.Context, request *historyservi
274274
return response, nil
275275
}
276276

277-
func (h *Handler) RecordActivityTaskHeartbeat(
278-
ctx context.Context,
279-
request *historyservice.RecordActivityTaskHeartbeatRequest,
280-
) (_ *historyservice.RecordActivityTaskHeartbeatResponse, retError error) {
277+
func (h *Handler) RecordActivityTaskHeartbeat(ctx context.Context, request *historyservice.RecordActivityTaskHeartbeatRequest) (_ *historyservice.RecordActivityTaskHeartbeatResponse, retError error) {
281278
defer log.CapturePanic(h.logger, &retError)
282279
h.startWG.Wait()
283280

@@ -321,10 +318,7 @@ func (h *Handler) RecordActivityTaskHeartbeat(
321318
}
322319

323320
// RecordActivityTaskStarted - Record Activity Task started.
324-
func (h *Handler) RecordActivityTaskStarted(
325-
ctx context.Context,
326-
request *historyservice.RecordActivityTaskStartedRequest,
327-
) (_ *historyservice.RecordActivityTaskStartedResponse, retError error) {
321+
func (h *Handler) RecordActivityTaskStarted(ctx context.Context, request *historyservice.RecordActivityTaskStartedRequest) (_ *historyservice.RecordActivityTaskStartedResponse, retError error) {
328322
defer log.CapturePanic(h.logger, &retError)
329323
h.startWG.Wait()
330324

@@ -361,10 +355,7 @@ func (h *Handler) RecordActivityTaskStarted(
361355
}
362356

363357
// RecordWorkflowTaskStarted - Record Workflow Task started.
364-
func (h *Handler) RecordWorkflowTaskStarted(
365-
ctx context.Context,
366-
request *historyservice.RecordWorkflowTaskStartedRequest,
367-
) (_ *historyservice.RecordWorkflowTaskStartedResponseWithRawHistory, retError error) {
358+
func (h *Handler) RecordWorkflowTaskStarted(ctx context.Context, request *historyservice.RecordWorkflowTaskStartedRequest) (_ *historyservice.RecordWorkflowTaskStartedResponseWithRawHistory, retError error) {
368359
defer log.CapturePanic(h.logger, &retError)
369360
h.startWG.Wait()
370361

@@ -380,10 +371,6 @@ func (h *Handler) RecordWorkflowTaskStarted(
380371
}
381372

382373
shardContext, err := h.controller.GetShardByNamespaceWorkflow(namespaceID, workflowID)
383-
if err != nil {
384-
return nil, h.convertError(err)
385-
}
386-
engine, err := shardContext.GetEngine(ctx)
387374
if err != nil {
388375
h.logger.Error("RecordWorkflowTaskStarted failed.",
389376
tag.Error(err),
@@ -393,6 +380,10 @@ func (h *Handler) RecordWorkflowTaskStarted(
393380
)
394381
return nil, h.convertError(err)
395382
}
383+
engine, err := shardContext.GetEngine(ctx)
384+
if err != nil {
385+
return nil, h.convertError(err)
386+
}
396387

397388
startTime := h.timeSource.Now()
398389
defer func() {
@@ -411,10 +402,7 @@ func (h *Handler) RecordWorkflowTaskStarted(
411402
}
412403

413404
// RespondActivityTaskCompleted - records completion of an activity task
414-
func (h *Handler) RespondActivityTaskCompleted(
415-
ctx context.Context,
416-
request *historyservice.RespondActivityTaskCompletedRequest,
417-
) (_ *historyservice.RespondActivityTaskCompletedResponse, retError error) {
405+
func (h *Handler) RespondActivityTaskCompleted(ctx context.Context, request *historyservice.RespondActivityTaskCompletedRequest) (_ *historyservice.RespondActivityTaskCompletedResponse, retError error) {
418406
defer log.CapturePanic(h.logger, &retError)
419407
h.startWG.Wait()
420408

@@ -458,10 +446,7 @@ func (h *Handler) RespondActivityTaskCompleted(
458446
}
459447

460448
// RespondActivityTaskFailed - records failure of an activity task
461-
func (h *Handler) RespondActivityTaskFailed(
462-
ctx context.Context,
463-
request *historyservice.RespondActivityTaskFailedRequest,
464-
) (_ *historyservice.RespondActivityTaskFailedResponse, retError error) {
449+
func (h *Handler) RespondActivityTaskFailed(ctx context.Context, request *historyservice.RespondActivityTaskFailedRequest) (_ *historyservice.RespondActivityTaskFailedResponse, retError error) {
465450
defer log.CapturePanic(h.logger, &retError)
466451
h.startWG.Wait()
467452

@@ -505,10 +490,7 @@ func (h *Handler) RespondActivityTaskFailed(
505490
}
506491

507492
// RespondActivityTaskCanceled - records failure of an activity task
508-
func (h *Handler) RespondActivityTaskCanceled(
509-
ctx context.Context,
510-
request *historyservice.RespondActivityTaskCanceledRequest,
511-
) (_ *historyservice.RespondActivityTaskCanceledResponse, retError error) {
493+
func (h *Handler) RespondActivityTaskCanceled(ctx context.Context, request *historyservice.RespondActivityTaskCanceledRequest) (_ *historyservice.RespondActivityTaskCanceledResponse, retError error) {
512494
defer log.CapturePanic(h.logger, &retError)
513495
h.startWG.Wait()
514496

@@ -552,10 +534,7 @@ func (h *Handler) RespondActivityTaskCanceled(
552534
}
553535

554536
// RespondWorkflowTaskCompleted - records completion of a workflow task
555-
func (h *Handler) RespondWorkflowTaskCompleted(
556-
ctx context.Context,
557-
request *historyservice.RespondWorkflowTaskCompletedRequest,
558-
) (_ *historyservice.RespondWorkflowTaskCompletedResponse, retError error) {
537+
func (h *Handler) RespondWorkflowTaskCompleted(ctx context.Context, request *historyservice.RespondWorkflowTaskCompletedRequest) (_ *historyservice.RespondWorkflowTaskCompletedResponse, retError error) {
559538
defer log.CapturePanic(h.logger, &retError)
560539
h.startWG.Wait()
561540

@@ -605,10 +584,7 @@ func (h *Handler) RespondWorkflowTaskCompleted(
605584
}
606585

607586
// RespondWorkflowTaskFailed - failed response to workflow task
608-
func (h *Handler) RespondWorkflowTaskFailed(
609-
ctx context.Context,
610-
request *historyservice.RespondWorkflowTaskFailedRequest,
611-
) (_ *historyservice.RespondWorkflowTaskFailedResponse, retError error) {
587+
func (h *Handler) RespondWorkflowTaskFailed(ctx context.Context, request *historyservice.RespondWorkflowTaskFailedRequest) (_ *historyservice.RespondWorkflowTaskFailedResponse, retError error) {
612588
defer log.CapturePanic(h.logger, &retError)
613589
h.startWG.Wait()
614590

@@ -658,10 +634,7 @@ func (h *Handler) RespondWorkflowTaskFailed(
658634
}
659635

660636
// StartWorkflowExecution - creates a new workflow execution
661-
func (h *Handler) StartWorkflowExecution(
662-
ctx context.Context,
663-
request *historyservice.StartWorkflowExecutionRequest,
664-
) (_ *historyservice.StartWorkflowExecutionResponse, retError error) {
637+
func (h *Handler) StartWorkflowExecution(ctx context.Context, request *historyservice.StartWorkflowExecutionRequest) (_ *historyservice.StartWorkflowExecutionResponse, retError error) {
665638
defer log.CapturePanic(h.logger, &retError)
666639
h.startWG.Wait()
667640

@@ -700,10 +673,7 @@ func (h *Handler) StartWorkflowExecution(
700673
return response, nil
701674
}
702675

703-
func (h *Handler) ExecuteMultiOperation(
704-
ctx context.Context,
705-
request *historyservice.ExecuteMultiOperationRequest,
706-
) (_ *historyservice.ExecuteMultiOperationResponse, retError error) {
676+
func (h *Handler) ExecuteMultiOperation(ctx context.Context, request *historyservice.ExecuteMultiOperationRequest) (_ *historyservice.ExecuteMultiOperationResponse, retError error) {
707677
defer metrics.CapturePanic(h.logger, h.metricsHandler, &retError)
708678
h.startWG.Wait()
709679

@@ -818,10 +788,7 @@ func (h *Handler) GetShard(ctx context.Context, request *historyservice.GetShard
818788
}
819789

820790
// RebuildMutableState attempts to rebuild mutable state according to persisted history events
821-
func (h *Handler) RebuildMutableState(
822-
ctx context.Context,
823-
request *historyservice.RebuildMutableStateRequest,
824-
) (_ *historyservice.RebuildMutableStateResponse, retError error) {
791+
func (h *Handler) RebuildMutableState(ctx context.Context, request *historyservice.RebuildMutableStateRequest) (_ *historyservice.RebuildMutableStateResponse, retError error) {
825792
defer log.CapturePanic(h.logger, &retError)
826793
h.startWG.Wait()
827794

@@ -860,10 +827,7 @@ func (h *Handler) RebuildMutableState(
860827
}
861828

862829
// ImportWorkflowExecution attempts to workflow execution according to persisted history events
863-
func (h *Handler) ImportWorkflowExecution(
864-
ctx context.Context,
865-
request *historyservice.ImportWorkflowExecutionRequest,
866-
) (_ *historyservice.ImportWorkflowExecutionResponse, retError error) {
830+
func (h *Handler) ImportWorkflowExecution(ctx context.Context, request *historyservice.ImportWorkflowExecutionRequest) (_ *historyservice.ImportWorkflowExecutionResponse, retError error) {
867831
defer log.CapturePanic(h.logger, &retError)
868832
h.startWG.Wait()
869833

@@ -948,10 +912,7 @@ func (h *Handler) DescribeMutableState(ctx context.Context, request *historyserv
948912
}
949913

950914
// GetMutableState - returns the id of the next event in the execution's history
951-
func (h *Handler) GetMutableState(
952-
ctx context.Context,
953-
request *historyservice.GetMutableStateRequest,
954-
) (_ *historyservice.GetMutableStateResponse, retError error) {
915+
func (h *Handler) GetMutableState(ctx context.Context, request *historyservice.GetMutableStateRequest) (_ *historyservice.GetMutableStateResponse, retError error) {
955916
defer log.CapturePanic(h.logger, &retError)
956917
h.startWG.Wait()
957918

@@ -988,10 +949,7 @@ func (h *Handler) GetMutableState(
988949
}
989950

990951
// PollMutableState - returns the id of the next event in the execution's history
991-
func (h *Handler) PollMutableState(
992-
ctx context.Context,
993-
request *historyservice.PollMutableStateRequest,
994-
) (_ *historyservice.PollMutableStateResponse, retError error) {
952+
func (h *Handler) PollMutableState(ctx context.Context, request *historyservice.PollMutableStateRequest) (_ *historyservice.PollMutableStateResponse, retError error) {
995953
defer log.CapturePanic(h.logger, &retError)
996954
h.startWG.Wait()
997955

@@ -1028,10 +986,7 @@ func (h *Handler) PollMutableState(
1028986
}
1029987

1030988
// DescribeWorkflowExecution returns information about the specified workflow execution.
1031-
func (h *Handler) DescribeWorkflowExecution(
1032-
ctx context.Context,
1033-
request *historyservice.DescribeWorkflowExecutionRequest,
1034-
) (_ *historyservice.DescribeWorkflowExecutionResponse, retError error) {
989+
func (h *Handler) DescribeWorkflowExecution(ctx context.Context, request *historyservice.DescribeWorkflowExecutionRequest) (_ *historyservice.DescribeWorkflowExecutionResponse, retError error) {
1035990
defer log.CapturePanic(h.logger, &retError)
1036991
h.startWG.Wait()
1037992

@@ -1068,10 +1023,7 @@ func (h *Handler) DescribeWorkflowExecution(
10681023
}
10691024

10701025
// RequestCancelWorkflowExecution - requests cancellation of a workflow
1071-
func (h *Handler) RequestCancelWorkflowExecution(
1072-
ctx context.Context,
1073-
request *historyservice.RequestCancelWorkflowExecutionRequest,
1074-
) (_ *historyservice.RequestCancelWorkflowExecutionResponse, retError error) {
1026+
func (h *Handler) RequestCancelWorkflowExecution(ctx context.Context, request *historyservice.RequestCancelWorkflowExecutionRequest) (_ *historyservice.RequestCancelWorkflowExecutionResponse, retError error) {
10751027
defer log.CapturePanic(h.logger, &retError)
10761028
h.startWG.Wait()
10771029

@@ -1112,10 +1064,7 @@ func (h *Handler) RequestCancelWorkflowExecution(
11121064

11131065
// SignalWorkflowExecution is used to send a signal event to running workflow execution. This results in
11141066
// WorkflowExecutionSignaled event recorded in the history and a workflow task being created for the execution.
1115-
func (h *Handler) SignalWorkflowExecution(
1116-
ctx context.Context,
1117-
request *historyservice.SignalWorkflowExecutionRequest,
1118-
) (_ *historyservice.SignalWorkflowExecutionResponse, retError error) {
1067+
func (h *Handler) SignalWorkflowExecution(ctx context.Context, request *historyservice.SignalWorkflowExecutionRequest) (_ *historyservice.SignalWorkflowExecutionResponse, retError error) {
11191068
defer log.CapturePanic(h.logger, &retError)
11201069
h.startWG.Wait()
11211070

@@ -1153,10 +1102,7 @@ func (h *Handler) SignalWorkflowExecution(
11531102
// and a workflow task being created for the execution.
11541103
// If workflow is not running or not found, this results in WorkflowExecutionStarted and WorkflowExecutionSignaled
11551104
// event recorded in history, and a workflow task being created for the execution
1156-
func (h *Handler) SignalWithStartWorkflowExecution(
1157-
ctx context.Context,
1158-
request *historyservice.SignalWithStartWorkflowExecutionRequest,
1159-
) (_ *historyservice.SignalWithStartWorkflowExecutionResponse, retError error) {
1105+
func (h *Handler) SignalWithStartWorkflowExecution(ctx context.Context, request *historyservice.SignalWithStartWorkflowExecutionRequest) (_ *historyservice.SignalWithStartWorkflowExecutionResponse, retError error) {
11601106
defer log.CapturePanic(h.logger, &retError)
11611107
h.startWG.Wait()
11621108

@@ -1214,10 +1160,7 @@ func (h *Handler) SignalWithStartWorkflowExecution(
12141160

12151161
// RemoveSignalMutableState is used to remove a signal request ID that was previously recorded. This is currently
12161162
// used to clean execution info when signal workflow task finished.
1217-
func (h *Handler) RemoveSignalMutableState(
1218-
ctx context.Context,
1219-
request *historyservice.RemoveSignalMutableStateRequest,
1220-
) (_ *historyservice.RemoveSignalMutableStateResponse, retError error) {
1163+
func (h *Handler) RemoveSignalMutableState(ctx context.Context, request *historyservice.RemoveSignalMutableStateRequest) (_ *historyservice.RemoveSignalMutableStateResponse, retError error) {
12211164
defer log.CapturePanic(h.logger, &retError)
12221165
h.startWG.Wait()
12231166

@@ -1256,10 +1199,7 @@ func (h *Handler) RemoveSignalMutableState(
12561199

12571200
// TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event
12581201
// in the history and immediately terminating the execution instance.
1259-
func (h *Handler) TerminateWorkflowExecution(
1260-
ctx context.Context,
1261-
request *historyservice.TerminateWorkflowExecutionRequest,
1262-
) (_ *historyservice.TerminateWorkflowExecutionResponse, retError error) {
1202+
func (h *Handler) TerminateWorkflowExecution(ctx context.Context, request *historyservice.TerminateWorkflowExecutionRequest) (_ *historyservice.TerminateWorkflowExecutionResponse, retError error) {
12631203
defer log.CapturePanic(h.logger, &retError)
12641204
h.startWG.Wait()
12651205

@@ -1292,10 +1232,7 @@ func (h *Handler) TerminateWorkflowExecution(
12921232
return resp, nil
12931233
}
12941234

1295-
func (h *Handler) DeleteWorkflowExecution(
1296-
ctx context.Context,
1297-
request *historyservice.DeleteWorkflowExecutionRequest,
1298-
) (_ *historyservice.DeleteWorkflowExecutionResponse, retError error) {
1235+
func (h *Handler) DeleteWorkflowExecution(ctx context.Context, request *historyservice.DeleteWorkflowExecutionRequest) (_ *historyservice.DeleteWorkflowExecutionResponse, retError error) {
12991236
defer log.CapturePanic(h.logger, &retError)
13001237
h.startWG.Wait()
13011238

@@ -1334,10 +1271,7 @@ func (h *Handler) DeleteWorkflowExecution(
13341271

13351272
// ResetWorkflowExecution reset an existing workflow execution
13361273
// in the history and immediately terminating the execution instance.
1337-
func (h *Handler) ResetWorkflowExecution(
1338-
ctx context.Context,
1339-
request *historyservice.ResetWorkflowExecutionRequest,
1340-
) (_ *historyservice.ResetWorkflowExecutionResponse, retError error) {
1274+
func (h *Handler) ResetWorkflowExecution(ctx context.Context, request *historyservice.ResetWorkflowExecutionRequest) (_ *historyservice.ResetWorkflowExecutionResponse, retError error) {
13411275
defer log.CapturePanic(h.logger, &retError)
13421276
h.startWG.Wait()
13431277

@@ -1372,10 +1306,7 @@ func (h *Handler) ResetWorkflowExecution(
13721306

13731307
// UpdateWorkflowExecutionOptions updates the options of a workflow execution.
13741308
// Can be used to set and unset versioning behavior override.
1375-
func (h *Handler) UpdateWorkflowExecutionOptions(
1376-
ctx context.Context,
1377-
request *historyservice.UpdateWorkflowExecutionOptionsRequest,
1378-
) (_ *historyservice.UpdateWorkflowExecutionOptionsResponse, retError error) {
1309+
func (h *Handler) UpdateWorkflowExecutionOptions(ctx context.Context, request *historyservice.UpdateWorkflowExecutionOptionsRequest) (_ *historyservice.UpdateWorkflowExecutionOptionsResponse, retError error) {
13791310
defer log.CapturePanic(h.logger, &retError)
13801311
h.startWG.Wait()
13811312

@@ -1409,10 +1340,7 @@ func (h *Handler) UpdateWorkflowExecutionOptions(
14091340
}
14101341

14111342
// QueryWorkflow queries a workflow.
1412-
func (h *Handler) QueryWorkflow(
1413-
ctx context.Context,
1414-
request *historyservice.QueryWorkflowRequest,
1415-
) (_ *historyservice.QueryWorkflowResponse, retError error) {
1343+
func (h *Handler) QueryWorkflow(ctx context.Context, request *historyservice.QueryWorkflowRequest) (_ *historyservice.QueryWorkflowResponse, retError error) {
14161344
defer log.CapturePanic(h.logger, &retError)
14171345
h.startWG.Wait()
14181346

0 commit comments

Comments
 (0)