diff --git a/service/history/api/respondworkflowtaskcompleted/api_test.go b/service/history/api/respondworkflowtaskcompleted/api_test.go index 7e1c5eef710..a2e13b293b5 100644 --- a/service/history/api/respondworkflowtaskcompleted/api_test.go +++ b/service/history/api/respondworkflowtaskcompleted/api_test.go @@ -63,7 +63,7 @@ import ( "go.temporal.io/server/service/history/api" "go.temporal.io/server/service/history/events" "go.temporal.io/server/service/history/hsm" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tests" "go.temporal.io/server/service/history/workflow" @@ -119,7 +119,7 @@ func (s *WorkflowTaskCompletedHandlerSuite) SetupSubTest() { s.NoError(err) s.mockShard.SetStateMachineRegistry(reg) - mockEngine := history.NewMockEngine(s.controller) + mockEngine := historyi.NewMockEngine(s.controller) mockEngine.EXPECT().NotifyNewHistoryEvent(gomock.Any()).AnyTimes() mockEngine.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() s.mockShard.SetEngineForTesting(mockEngine) diff --git a/service/history/history_engine.go b/service/history/history_engine.go index ba6be3a5f7d..5508aea2c17 100644 --- a/service/history/history_engine.go +++ b/service/history/history_engine.go @@ -106,7 +106,7 @@ import ( "go.temporal.io/server/service/history/deletemanager" "go.temporal.io/server/service/history/events" "go.temporal.io/server/service/history/hsm" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/ndc" "go.temporal.io/server/service/history/queues" "go.temporal.io/server/service/history/replication" @@ -184,7 +184,7 @@ func NewEngineWithShardContext( dlqWriter replication.DLQWriter, commandHandlerRegistry *workflow.CommandHandlerRegistry, outboundQueueCBPool *circuitbreakerpool.OutboundQueueCircuitBreakerPool, -) history.Engine { +) historyi.Engine { currentClusterName := shard.GetClusterMetadata().GetCurrentClusterName() logger := shard.GetLogger() @@ -760,14 +760,14 @@ func (e *historyEngineImpl) SyncActivities( func (e *historyEngineImpl) SyncHSM( ctx context.Context, - request *history.SyncHSMRequest, + request *historyi.SyncHSMRequest, ) error { return e.nDCHSMStateReplicator.SyncHSMState(ctx, request) } func (e *historyEngineImpl) BackfillHistoryEvents( ctx context.Context, - request *history.BackfillHistoryEventsRequest, + request *historyi.BackfillHistoryEventsRequest, ) error { return e.nDCHistoryReplicator.BackfillHistoryEvents(ctx, request) } diff --git a/service/history/history_engine_factory.go b/service/history/history_engine_factory.go index 02d3bbe764e..4bea26083b3 100644 --- a/service/history/history_engine_factory.go +++ b/service/history/history_engine_factory.go @@ -36,7 +36,7 @@ import ( "go.temporal.io/server/service/history/circuitbreakerpool" "go.temporal.io/server/service/history/configs" "go.temporal.io/server/service/history/events" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/replication" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tasks" @@ -78,7 +78,7 @@ type ( func (f *historyEngineFactory) CreateEngine( shard shard.Context, -) history.Engine { +) historyi.Engine { var wfCache wcache.Cache if shard.GetConfig().EnableHostLevelHistoryCache() { wfCache = f.WorkflowCache diff --git a/service/history/ndc/history_replicator.go b/service/history/ndc/history_replicator.go index 70e861443ac..09731b2325f 100644 --- a/service/history/ndc/history_replicator.go +++ b/service/history/ndc/history_replicator.go @@ -48,7 +48,7 @@ import ( "go.temporal.io/server/common/persistence/versionhistory" "go.temporal.io/server/common/primitives/timestamp" serviceerrors "go.temporal.io/server/common/serviceerror" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/workflow" wcache "go.temporal.io/server/service/history/workflow/cache" @@ -114,7 +114,7 @@ type ( newEvents []*historypb.HistoryEvent, newRunID string, ) error - BackfillHistoryEvents(ctx context.Context, request *history.BackfillHistoryEventsRequest) error + BackfillHistoryEvents(ctx context.Context, request *historyi.BackfillHistoryEventsRequest) error } HistoryReplicatorImpl struct { @@ -230,7 +230,7 @@ func (r *HistoryReplicatorImpl) ApplyEvents( func (r *HistoryReplicatorImpl) BackfillHistoryEvents( ctx context.Context, - request *history.BackfillHistoryEventsRequest, + request *historyi.BackfillHistoryEventsRequest, ) error { task, err := newReplicationTaskFromBatch( r.clusterMetadata, diff --git a/service/history/ndc/hsm_state_replicator.go b/service/history/ndc/hsm_state_replicator.go index 8be8cffa75b..4f7e23e9a1d 100644 --- a/service/history/ndc/hsm_state_replicator.go +++ b/service/history/ndc/hsm_state_replicator.go @@ -41,7 +41,7 @@ import ( "go.temporal.io/server/common/persistence/versionhistory" serviceerrors "go.temporal.io/server/common/serviceerror" "go.temporal.io/server/service/history/hsm" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/workflow" wcache "go.temporal.io/server/service/history/workflow/cache" @@ -51,7 +51,7 @@ type ( HSMStateReplicator interface { SyncHSMState( ctx context.Context, - request *history.SyncHSMRequest, + request *historyi.SyncHSMRequest, ) error } @@ -77,7 +77,7 @@ func NewHSMStateReplicator( func (r *HSMStateReplicatorImpl) SyncHSMState( ctx context.Context, - request *history.SyncHSMRequest, + request *historyi.SyncHSMRequest, ) (retError error) { namespaceID := namespace.ID(request.WorkflowKey.GetNamespaceID()) execution := &commonpb.WorkflowExecution{ @@ -151,7 +151,7 @@ func (r *HSMStateReplicatorImpl) SyncHSMState( func (r *HSMStateReplicatorImpl) syncHSMNode( mutableState workflow.MutableState, - request *history.SyncHSMRequest, + request *historyi.SyncHSMRequest, ) (bool, error) { shouldSync, err := r.compareVersionHistory(mutableState, request.EventVersionHistory) diff --git a/service/history/ndc/hsm_state_replicator_test.go b/service/history/ndc/hsm_state_replicator_test.go index 289f1b7a6d6..472c9d80fdd 100644 --- a/service/history/ndc/hsm_state_replicator_test.go +++ b/service/history/ndc/hsm_state_replicator_test.go @@ -44,7 +44,7 @@ import ( serviceerrors "go.temporal.io/server/common/serviceerror" "go.temporal.io/server/service/history/hsm" "go.temporal.io/server/service/history/hsm/hsmtest" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tasks" "go.temporal.io/server/service/history/tests" @@ -95,7 +95,7 @@ func (s *hsmStateReplicatorSuite) SetupTest() { }, tests.NewDynamicConfig(), ) - mockEngine := history.NewMockEngine(s.controller) + mockEngine := historyi.NewMockEngine(s.controller) mockEngine.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() mockEngine.EXPECT().NotifyNewHistoryEvent(gomock.Any()).AnyTimes() mockEngine.EXPECT().Stop().MaxTimes(1) @@ -155,7 +155,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_WorkflowNotFound() { }).Return(nil, serviceerror.NewNotFound("")).Times(1) lastEventID := int64(10) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: nonExistKey, EventVersionHistory: &historyspb.VersionHistory{ Items: []*historyspb.VersionHistoryItem{ @@ -188,7 +188,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_Diverge_LocalEventVersionLarger() DBRecordVersion: 777, }, nil).Times(1) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: s.workflowKey, EventVersionHistory: &historyspb.VersionHistory{ Items: []*historyspb.VersionHistoryItem{ @@ -213,7 +213,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_Diverge_IncomingEventVersionLarger DBRecordVersion: 777, }, nil).Times(1) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: s.workflowKey, EventVersionHistory: &historyspb.VersionHistory{ Items: []*historyspb.VersionHistoryItem{ @@ -256,7 +256,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_LocalEventVersionSuperSet() { }, }, nil).Times(1) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: s.workflowKey, EventVersionHistory: &historyspb.VersionHistory{ Items: []*historyspb.VersionHistoryItem{ @@ -301,7 +301,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_IncomingEventVersionSuperSet() { DBRecordVersion: 777, }, nil).Times(1) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: s.workflowKey, EventVersionHistory: &historyspb.VersionHistory{ Items: []*historyspb.VersionHistoryItem{ @@ -337,7 +337,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_IncomingStateStale() { DBRecordVersion: 777, }, nil).Times(1) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: s.workflowKey, EventVersionHistory: persistedState.ExecutionInfo.VersionHistories.Histories[0], StateMachineNode: &persistencespb.StateMachineNode{ @@ -375,7 +375,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_IncomingLastUpdateVersionStale() { DBRecordVersion: 777, }, nil).Times(1) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: s.workflowKey, EventVersionHistory: persistedState.ExecutionInfo.VersionHistories.Histories[0], StateMachineNode: &persistencespb.StateMachineNode{ @@ -414,7 +414,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_IncomingLastUpdateVersionedTransit DBRecordVersion: 777, }, nil).Times(1) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: s.workflowKey, EventVersionHistory: persistedState.ExecutionInfo.VersionHistories.Histories[0], StateMachineNode: &persistencespb.StateMachineNode{ @@ -460,7 +460,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_IncomingLastUpdateVersionNewer() { }, }, nil).Times(1) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: s.workflowKey, EventVersionHistory: persistedState.ExecutionInfo.VersionHistories.Histories[0], StateMachineNode: &persistencespb.StateMachineNode{ @@ -506,7 +506,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_IncomingLastUpdateVersionedTransit }, }, nil).Times(1) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: s.workflowKey, EventVersionHistory: persistedState.ExecutionInfo.VersionHistories.Histories[0], StateMachineNode: &persistencespb.StateMachineNode{ @@ -570,7 +570,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_IncomingStateNewer_WorkflowOpen() }, ).Times(1) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: s.workflowKey, EventVersionHistory: persistedState.ExecutionInfo.VersionHistories.Histories[0], StateMachineNode: &persistencespb.StateMachineNode{ @@ -622,7 +622,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_IncomingStateNewer_WorkflowZombie( }, ).Times(1) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: s.workflowKey, EventVersionHistory: persistedState.ExecutionInfo.VersionHistories.Histories[0], StateMachineNode: &persistencespb.StateMachineNode{ @@ -678,7 +678,7 @@ func (s *hsmStateReplicatorSuite) TestSyncHSM_IncomingStateNewer_WorkflowClosed( }, ).Times(1) - err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &history.SyncHSMRequest{ + err := s.nDCHSMStateReplicator.SyncHSMState(context.Background(), &historyi.SyncHSMRequest{ WorkflowKey: s.workflowKey, EventVersionHistory: persistedState.ExecutionInfo.VersionHistories.Histories[0], StateMachineNode: &persistencespb.StateMachineNode{ diff --git a/service/history/ndc/workflow_state_replicator.go b/service/history/ndc/workflow_state_replicator.go index f8e6803af50..9d283599146 100644 --- a/service/history/ndc/workflow_state_replicator.go +++ b/service/history/ndc/workflow_state_replicator.go @@ -60,7 +60,7 @@ import ( serviceerrors "go.temporal.io/server/common/serviceerror" "go.temporal.io/server/service/history/consts" "go.temporal.io/server/service/history/historybuilder" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/workflow" wcache "go.temporal.io/server/service/history/workflow/cache" @@ -193,7 +193,7 @@ func (r *WorkflowStateReplicatorImpl) SyncWorkflowState( } // we don't care about activity state here as activity can't run after workflow is closed. - return engine.SyncHSM(ctx, &history.SyncHSMRequest{ + return engine.SyncHSM(ctx, &historyi.SyncHSMRequest{ WorkflowKey: ms.GetWorkflowKey(), StateMachineNode: &persistencespb.StateMachineNode{ Children: executionInfo.SubStateMachinesByType, @@ -583,7 +583,7 @@ func (r *WorkflowStateReplicatorImpl) backFillEvents( } newRunID = newRunInfo.RunId } - return engine.BackfillHistoryEvents(ctx, &history.BackfillHistoryEventsRequest{ + return engine.BackfillHistoryEvents(ctx, &historyi.BackfillHistoryEventsRequest{ WorkflowKey: definition.NewWorkflowKey(namespaceID.String(), workflowID, runID), SourceClusterName: sourceClusterName, VersionedHistory: destinationVersionedTransition, diff --git a/service/history/ndc/workflow_state_replicator_test.go b/service/history/ndc/workflow_state_replicator_test.go index d1b72c892ca..ac325fbb5d7 100644 --- a/service/history/ndc/workflow_state_replicator_test.go +++ b/service/history/ndc/workflow_state_replicator_test.go @@ -55,7 +55,7 @@ import ( serviceerrors "go.temporal.io/server/common/serviceerror" "go.temporal.io/server/service/history/events" "go.temporal.io/server/service/history/hsm" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tests" "go.temporal.io/server/service/history/workflow" @@ -570,11 +570,11 @@ func (s *workflowReplicatorSuite) Test_ApplyWorkflowState_ExistWorkflow_SyncHSM( }) mockMutableState.EXPECT().GetWorkflowKey().Return(definition.NewWorkflowKey(namespaceID, s.workflowID, s.runID)).AnyTimes() - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.mockShard.SetEngineForTesting(engine) currentVersionHistory, err := versionhistory.GetCurrentVersionHistory(versionHistories) s.NoError(err) - engine.EXPECT().SyncHSM(gomock.Any(), &history.SyncHSMRequest{ + engine.EXPECT().SyncHSM(gomock.Any(), &historyi.SyncHSMRequest{ WorkflowKey: definition.NewWorkflowKey(namespaceID, s.workflowID, s.runID), StateMachineNode: &persistencespb.StateMachineNode{ Children: request.WorkflowState.ExecutionInfo.SubStateMachinesByType, diff --git a/service/history/replication/eventhandler/event_importer.go b/service/history/replication/eventhandler/event_importer.go index 8ad1e7b9875..969cfb11b1e 100644 --- a/service/history/replication/eventhandler/event_importer.go +++ b/service/history/replication/eventhandler/event_importer.go @@ -40,7 +40,7 @@ import ( "go.temporal.io/server/common/namespace" "go.temporal.io/server/common/persistence/serialization" "go.temporal.io/server/common/persistence/versionhistory" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" ) const ( @@ -180,7 +180,7 @@ func (e *eventImporterImpl) ImportHistoryEventsFromBeginning( func invokeImportWorkflowExecutionCall( ctx context.Context, - historyEngine history.Engine, + historyEngine historyi.Engine, workflowKey definition.WorkflowKey, historyBatches []*commonpb.DataBlob, versionHistory *historyspb.VersionHistory, diff --git a/service/history/replication/eventhandler/event_importer_test.go b/service/history/replication/eventhandler/event_importer_test.go index 43130b2ead3..99b038b7140 100644 --- a/service/history/replication/eventhandler/event_importer_test.go +++ b/service/history/replication/eventhandler/event_importer_test.go @@ -43,7 +43,7 @@ import ( "go.temporal.io/server/common/log" "go.temporal.io/server/common/namespace" "go.temporal.io/server/common/persistence/serialization" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.uber.org/mock/gomock" ) @@ -57,7 +57,7 @@ type ( remoteHistoryFetcher *MockHistoryPaginatedFetcher engineProvider historyEngineProvider eventImporter EventImporter - engine *history.MockEngine + engine *historyi.MockEngine } ) @@ -91,8 +91,8 @@ func (s *eventImporterSuite) SetupTest() { s.logger = log.NewNoopLogger() s.eventSerializer = serialization.NewSerializer() s.remoteHistoryFetcher = NewMockHistoryPaginatedFetcher(s.controller) - s.engine = history.NewMockEngine(s.controller) - s.engineProvider = func(ctx context.Context, namespaceId namespace.ID, workflowId string) (history.Engine, error) { + s.engine = historyi.NewMockEngine(s.controller) + s.engineProvider = func(ctx context.Context, namespaceId namespace.ID, workflowId string) (historyi.Engine, error) { return s.engine, nil } s.eventImporter = NewEventImporter( diff --git a/service/history/replication/eventhandler/history_events_handler_test.go b/service/history/replication/eventhandler/history_events_handler_test.go index 956fcfa1102..2cea3784abf 100644 --- a/service/history/replication/eventhandler/history_events_handler_test.go +++ b/service/history/replication/eventhandler/history_events_handler_test.go @@ -40,7 +40,7 @@ import ( "go.temporal.io/server/common/definition" "go.temporal.io/server/common/log" "go.temporal.io/server/common/namespace" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.uber.org/mock/gomock" ) @@ -123,7 +123,7 @@ func (s *historyEventHandlerSuite) TestHandleHistoryEvents_RemoteOnly() { RunID: runId, } shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(namespaceId), workflowId, @@ -201,7 +201,7 @@ func (s *historyEventHandlerSuite) TestHandleHistoryEvents_LocalAndRemote_Handle RunID: runId, } shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(namespaceId), workflowId, @@ -264,7 +264,7 @@ func (s *historyEventHandlerSuite) TestHandleLocalHistoryEvents_AlreadyExist() { RunID: runId, } shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(namespaceId), workflowId, @@ -319,7 +319,7 @@ func (s *historyEventHandlerSuite) TestHandleHistoryEvents_LocalOnly_ImportAllLo } shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(namespaceId), workflowId, @@ -376,7 +376,7 @@ func (s *historyEventHandlerSuite) TestHandleHistoryEvents_LocalOnly_ExistButNot } shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(namespaceId), workflowId, diff --git a/service/history/replication/eventhandler/resend_handler.go b/service/history/replication/eventhandler/resend_handler.go index 1f60c431160..688c30798f5 100644 --- a/service/history/replication/eventhandler/resend_handler.go +++ b/service/history/replication/eventhandler/resend_handler.go @@ -44,11 +44,11 @@ import ( "go.temporal.io/server/common/persistence/serialization" "go.temporal.io/server/common/persistence/versionhistory" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" ) type ( - historyEngineProvider func(ctx context.Context, namespaceId namespace.ID, workflowId string) (history.Engine, error) + historyEngineProvider func(ctx context.Context, namespaceId namespace.ID, workflowId string) (historyi.Engine, error) ResendHandler interface { ResendHistoryEvents( ctx context.Context, @@ -80,7 +80,7 @@ func NewResendHandler( clientBean client.Bean, serializer serialization.Serializer, clusterMetadata cluster.Metadata, - historyEngineProvider func(ctx context.Context, namespaceId namespace.ID, workflowId string) (history.Engine, error), + historyEngineProvider func(ctx context.Context, namespaceId namespace.ID, workflowId string) (historyi.Engine, error), remoteHistoryFetcher HistoryPaginatedFetcher, importer EventImporter, logger log.Logger, diff --git a/service/history/replication/eventhandler/resend_handler_test.go b/service/history/replication/eventhandler/resend_handler_test.go index 65f122e121a..126f157f148 100644 --- a/service/history/replication/eventhandler/resend_handler_test.go +++ b/service/history/replication/eventhandler/resend_handler_test.go @@ -49,7 +49,7 @@ import ( "go.temporal.io/server/common/persistence/serialization" "go.temporal.io/server/common/primitives/timestamp" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/tests" "go.uber.org/mock/gomock" ) @@ -73,7 +73,7 @@ type ( logger log.Logger config *configs.Config resendHandler ResendHandler - engine *history.MockEngine + engine *historyi.MockEngine historyFetcher *MockHistoryPaginatedFetcher importer *MockEventImporter } @@ -124,7 +124,7 @@ func (s *resendHandlerSuite) SetupTest() { ) s.mockNamespaceCache.EXPECT().GetNamespaceByID(s.namespaceID).Return(namespaceEntry, nil).AnyTimes() s.mockNamespaceCache.EXPECT().GetNamespace(s.namespace).Return(namespaceEntry, nil).AnyTimes() - s.engine = history.NewMockEngine(s.controller) + s.engine = historyi.NewMockEngine(s.controller) s.serializer = serialization.NewSerializer() s.importer = NewMockEventImporter(s.controller) s.resendHandler = NewResendHandler( @@ -132,7 +132,7 @@ func (s *resendHandlerSuite) SetupTest() { s.mockClientBean, s.serializer, s.mockClusterMetadata, - func(ctx context.Context, namespaceId namespace.ID, workflowId string) (history.Engine, error) { + func(ctx context.Context, namespaceId namespace.ID, workflowId string) (historyi.Engine, error) { return s.engine, nil }, s.historyFetcher, diff --git a/service/history/replication/executable_activity_state_task_test.go b/service/history/replication/executable_activity_state_task_test.go index 643b044d96f..49ae8027909 100644 --- a/service/history/replication/executable_activity_state_task_test.go +++ b/service/history/replication/executable_activity_state_task_test.go @@ -51,7 +51,7 @@ import ( serviceerrors "go.temporal.io/server/common/serviceerror" "go.temporal.io/server/common/xdc" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tests" "go.uber.org/mock/gomock" @@ -170,7 +170,7 @@ func (s *executableActivityStateTaskSuite) TestExecute_Process() { ).AnyTimes() shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(s.task.NamespaceID), s.task.WorkflowID, @@ -231,7 +231,7 @@ func (s *executableActivityStateTaskSuite) TestHandleErr_Resend_Success() { uuid.NewString(), true, nil, ).AnyTimes() shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(s.task.NamespaceID), s.task.WorkflowID, @@ -392,7 +392,7 @@ func (s *executableActivityStateTaskSuite) TestBatchedTask_ShouldBatchTogether_A uuid.NewString(), true, nil, ).AnyTimes() shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(namespaceId), workflowId, diff --git a/service/history/replication/executable_backfill_history_events_task.go b/service/history/replication/executable_backfill_history_events_task.go index 54a40e5f418..887fe9af44f 100644 --- a/service/history/replication/executable_backfill_history_events_task.go +++ b/service/history/replication/executable_backfill_history_events_task.go @@ -38,7 +38,7 @@ import ( "go.temporal.io/server/common/persistence/versionhistory" serviceerrors "go.temporal.io/server/common/serviceerror" ctasks "go.temporal.io/server/common/tasks" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" ) type ( @@ -138,7 +138,7 @@ func (e *ExecutableBackfillHistoryEventsTask) Execute() error { return err } - return engine.BackfillHistoryEvents(ctx, &history.BackfillHistoryEventsRequest{ + return engine.BackfillHistoryEvents(ctx, &historyi.BackfillHistoryEventsRequest{ WorkflowKey: e.WorkflowKey, SourceClusterName: e.SourceClusterName(), VersionedHistory: e.ReplicationTask().VersionedTransition, diff --git a/service/history/replication/executable_backfill_history_events_task_test.go b/service/history/replication/executable_backfill_history_events_task_test.go index e54116c1c91..0cad3642f8b 100644 --- a/service/history/replication/executable_backfill_history_events_task_test.go +++ b/service/history/replication/executable_backfill_history_events_task_test.go @@ -48,7 +48,7 @@ import ( "go.temporal.io/server/common/persistence/serialization" serviceerrors "go.temporal.io/server/common/serviceerror" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tests" "go.uber.org/mock/gomock" @@ -203,14 +203,14 @@ func (s *executableBackfillHistoryEventsTaskSuite) TestExecute_Process() { ).AnyTimes() shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(s.task.NamespaceID), s.task.WorkflowID, ).Return(shardContext, nil).AnyTimes() shardContext.EXPECT().GetEngine(gomock.Any()).Return(engine, nil).AnyTimes() - engine.EXPECT().BackfillHistoryEvents(gomock.Any(), &history.BackfillHistoryEventsRequest{ + engine.EXPECT().BackfillHistoryEvents(gomock.Any(), &historyi.BackfillHistoryEventsRequest{ WorkflowKey: definition.WorkflowKey{ NamespaceID: s.task.NamespaceID, WorkflowID: s.task.WorkflowID, @@ -262,7 +262,7 @@ func (s *executableBackfillHistoryEventsTaskSuite) TestHandleErr_Resend_Success( uuid.NewString(), true, nil, ).AnyTimes() shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(s.task.NamespaceID), s.task.WorkflowID, diff --git a/service/history/replication/executable_history_task_test.go b/service/history/replication/executable_history_task_test.go index e59a5899c88..5455c35540d 100644 --- a/service/history/replication/executable_history_task_test.go +++ b/service/history/replication/executable_history_task_test.go @@ -53,7 +53,7 @@ import ( serviceerrors "go.temporal.io/server/common/serviceerror" "go.temporal.io/server/common/testing/protorequire" "go.temporal.io/server/common/xdc" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tests" "go.uber.org/mock/gomock" @@ -223,7 +223,7 @@ func (s *executableHistoryTaskSuite) TestExecute_Process() { ).AnyTimes() shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(s.task.NamespaceID), s.task.WorkflowID, @@ -276,7 +276,7 @@ func (s *executableHistoryTaskSuite) TestHandleErr_Resend_Success() { uuid.NewString(), true, nil, ).AnyTimes() shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(s.task.NamespaceID), s.task.WorkflowID, diff --git a/service/history/replication/executable_sync_hsm_task.go b/service/history/replication/executable_sync_hsm_task.go index 40c8b9d8fbf..9c58ba57964 100644 --- a/service/history/replication/executable_sync_hsm_task.go +++ b/service/history/replication/executable_sync_hsm_task.go @@ -37,7 +37,7 @@ import ( "go.temporal.io/server/common/namespace" serviceerrors "go.temporal.io/server/common/serviceerror" ctasks "go.temporal.io/server/common/tasks" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "google.golang.org/protobuf/types/known/timestamppb" ) @@ -133,7 +133,7 @@ func (e *ExecutableSyncHSMTask) Execute() error { if err != nil { return err } - return engine.SyncHSM(ctx, &history.SyncHSMRequest{ + return engine.SyncHSM(ctx, &historyi.SyncHSMRequest{ WorkflowKey: e.WorkflowKey, StateMachineNode: e.taskAttr.StateMachineNode, EventVersionHistory: e.taskAttr.VersionHistory, diff --git a/service/history/replication/executable_sync_hsm_task_test.go b/service/history/replication/executable_sync_hsm_task_test.go index 2912ec26812..1353055ec89 100644 --- a/service/history/replication/executable_sync_hsm_task_test.go +++ b/service/history/replication/executable_sync_hsm_task_test.go @@ -45,7 +45,7 @@ import ( serviceerrors "go.temporal.io/server/common/serviceerror" "go.temporal.io/server/common/xdc" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tests" "go.uber.org/mock/gomock" @@ -178,13 +178,13 @@ func (s *executableSyncHSMTaskSuite) TestExecute_Process() { ).AnyTimes() shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(s.task.NamespaceID), s.task.WorkflowID, ).Return(shardContext, nil).AnyTimes() shardContext.EXPECT().GetEngine(gomock.Any()).Return(engine, nil).AnyTimes() - engine.EXPECT().SyncHSM(gomock.Any(), &history.SyncHSMRequest{ + engine.EXPECT().SyncHSM(gomock.Any(), &historyi.SyncHSMRequest{ WorkflowKey: definition.WorkflowKey{ NamespaceID: s.task.NamespaceID, WorkflowID: s.task.WorkflowID, @@ -231,7 +231,7 @@ func (s *executableSyncHSMTaskSuite) TestHandleErr_Resend_Success() { uuid.NewString(), true, nil, ).AnyTimes() shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(s.task.NamespaceID), s.task.WorkflowID, diff --git a/service/history/replication/executable_task.go b/service/history/replication/executable_task.go index 509dd297246..5d2fca226e1 100644 --- a/service/history/replication/executable_task.go +++ b/service/history/replication/executable_task.go @@ -51,7 +51,7 @@ import ( "go.temporal.io/server/common/persistence/versionhistory" serviceerrors "go.temporal.io/server/common/serviceerror" ctasks "go.temporal.io/server/common/tasks" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/tasks" ) @@ -541,7 +541,7 @@ func (e *ExecutableTaskImpl) BackFillEvents( } applyFn := func() error { - backFillRequest := &history.BackfillHistoryEventsRequest{ + backFillRequest := &historyi.BackfillHistoryEventsRequest{ WorkflowKey: workflowKey, SourceClusterName: e.SourceClusterName(), VersionedHistory: e.ReplicationTask().VersionedTransition, diff --git a/service/history/replication/executable_task_test.go b/service/history/replication/executable_task_test.go index e9520e33ee1..8d64e0dd7bb 100644 --- a/service/history/replication/executable_task_test.go +++ b/service/history/replication/executable_task_test.go @@ -61,7 +61,7 @@ import ( "go.temporal.io/server/common/xdc" "go.temporal.io/server/service/history/configs" "go.temporal.io/server/service/history/consts" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/replication/eventhandler" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tasks" @@ -367,7 +367,7 @@ func (s *executableTaskSuite) TestResend_NotFound() { resendErr.EndEventVersion, ).Return(serviceerror.NewNotFound("")) shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(resendErr.NamespaceId), resendErr.WorkflowId, @@ -742,14 +742,14 @@ func (s *executableTaskSuite) TestBackFillEvents_Success() { endEventVersion, ).Return(fetcher) shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(workflowKey.NamespaceID), workflowKey.WorkflowID, ).Return(shardContext, nil).AnyTimes() shardContext.EXPECT().GetEngine(gomock.Any()).Return(engine, nil).AnyTimes() engine.EXPECT().BackfillHistoryEvents( - gomock.Any(), protomock.Eq(&history.BackfillHistoryEventsRequest{ + gomock.Any(), protomock.Eq(&historyi.BackfillHistoryEventsRequest{ WorkflowKey: workflowKey, SourceClusterName: s.sourceCluster, VersionedHistory: s.task.replicationTask.VersionedTransition, @@ -757,7 +757,7 @@ func (s *executableTaskSuite) TestBackFillEvents_Success() { Events: [][]*historypb.HistoryEvent{eventBatchOriginal1}, })).Return(nil) engine.EXPECT().BackfillHistoryEvents( - gomock.Any(), protomock.Eq(&history.BackfillHistoryEventsRequest{ + gomock.Any(), protomock.Eq(&historyi.BackfillHistoryEventsRequest{ WorkflowKey: workflowKey, SourceClusterName: s.sourceCluster, VersionedHistory: s.task.replicationTask.VersionedTransition, @@ -1166,7 +1166,7 @@ func (s *executableTaskSuite) TestSyncState() { }, nil).Times(1) shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(syncStateErr.NamespaceId), syncStateErr.WorkflowId, diff --git a/service/history/replication/executable_workflow_state_task_test.go b/service/history/replication/executable_workflow_state_task_test.go index 594d5fbd1e4..4ae3239ba4b 100644 --- a/service/history/replication/executable_workflow_state_task_test.go +++ b/service/history/replication/executable_workflow_state_task_test.go @@ -46,7 +46,7 @@ import ( serviceerrors "go.temporal.io/server/common/serviceerror" "go.temporal.io/server/common/xdc" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tests" "go.uber.org/mock/gomock" @@ -160,7 +160,7 @@ func (s *executableWorkflowStateTaskSuite) TestExecute_Process() { ).AnyTimes() shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(s.task.NamespaceID), s.task.WorkflowID, @@ -209,7 +209,7 @@ func (s *executableWorkflowStateTaskSuite) TestHandleErr_Resend_Success() { uuid.NewString(), true, nil, ).AnyTimes() shardContext := shard.NewMockContext(s.controller) - engine := history.NewMockEngine(s.controller) + engine := historyi.NewMockEngine(s.controller) s.shardController.EXPECT().GetShardByNamespaceWorkflow( namespace.ID(s.task.NamespaceID), s.task.WorkflowID, diff --git a/service/history/replication/fx.go b/service/history/replication/fx.go index 629db2a28e2..860a1072a96 100644 --- a/service/history/replication/fx.go +++ b/service/history/replication/fx.go @@ -43,7 +43,7 @@ import ( ctasks "go.temporal.io/server/common/tasks" "go.temporal.io/server/common/xdc" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/queues" "go.temporal.io/server/service/history/replication/eventhandler" "go.temporal.io/server/service/history/shard" @@ -112,7 +112,7 @@ func replicationTaskConverterFactoryProvider( config *configs.Config, ) SourceTaskConverterProvider { return func( - historyEngine history.Engine, + historyEngine historyi.Engine, shardContext shard.Context, clientClusterName string, serializer serialization.Serializer, @@ -342,7 +342,7 @@ func resendHandlerProvider( clientBean, serializer, clusterMetadata, - func(ctx context.Context, namespaceId namespace.ID, workflowId string) (history.Engine, error) { + func(ctx context.Context, namespaceId namespace.ID, workflowId string) (historyi.Engine, error) { shardContext, err := shardController.GetShardByNamespaceWorkflow( namespaceId, workflowId, @@ -367,7 +367,7 @@ func eventImporterProvider( ) eventhandler.EventImporter { return eventhandler.NewEventImporter( historyFetcher, - func(ctx context.Context, namespaceId namespace.ID, workflowId string) (history.Engine, error) { + func(ctx context.Context, namespaceId namespace.ID, workflowId string) (historyi.Engine, error) { shardContext, err := shardController.GetShardByNamespaceWorkflow( namespaceId, workflowId, diff --git a/service/history/replication/raw_task_converter.go b/service/history/replication/raw_task_converter.go index 2fce8a83028..ffe52f11620 100644 --- a/service/history/replication/raw_task_converter.go +++ b/service/history/replication/raw_task_converter.go @@ -46,7 +46,7 @@ import ( "go.temporal.io/server/common/persistence/serialization" "go.temporal.io/server/common/persistence/versionhistory" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tasks" "go.temporal.io/server/service/history/workflow" @@ -56,7 +56,7 @@ import ( type ( SourceTaskConverterImpl struct { - historyEngine history.Engine + historyEngine historyi.Engine namespaceCache namespace.Registry serializer serialization.Serializer config *configs.Config @@ -65,7 +65,7 @@ type ( Convert(task tasks.Task, targetClusterID int32) (*replicationspb.ReplicationTask, error) } SourceTaskConverterProvider func( - historyEngine history.Engine, + historyEngine historyi.Engine, shardContext shard.Context, clientClusterName string, // Some task converter may use the client cluster name. serializer serialization.Serializer, @@ -84,7 +84,7 @@ type ( ) func NewSourceTaskConverter( - historyEngine history.Engine, + historyEngine historyi.Engine, namespaceCache namespace.Registry, serializer serialization.Serializer, config *configs.Config, diff --git a/service/history/replication/raw_task_converter_test.go b/service/history/replication/raw_task_converter_test.go index 4e94977377c..3593f736973 100644 --- a/service/history/replication/raw_task_converter_test.go +++ b/service/history/replication/raw_task_converter_test.go @@ -53,7 +53,7 @@ import ( "go.temporal.io/server/common/testing/protorequire" "go.temporal.io/server/service/history/hsm" "go.temporal.io/server/service/history/hsm/hsmtest" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tasks" "go.temporal.io/server/service/history/tests" @@ -72,7 +72,7 @@ type ( controller *gomock.Controller shardContext *shard.ContextTest workflowCache *wcache.MockCache - mockEngine *history.MockEngine + mockEngine *historyi.MockEngine progressCache *MockProgressCache executionManager *persistence.MockExecutionManager syncStateRetriever *MockSyncStateRetriever @@ -149,7 +149,7 @@ func (s *rawTaskConverterSuite) SetupTest() { s.executionManager = s.shardContext.Resource.ExecutionMgr s.logger = s.shardContext.GetLogger() - s.mockEngine = history.NewMockEngine(s.controller) + s.mockEngine = historyi.NewMockEngine(s.controller) s.mockEngine.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() s.mockEngine.EXPECT().Stop().AnyTimes() s.shardContext.SetEngineForTesting(s.mockEngine) diff --git a/service/history/replication/stream_receiver_monitor_test.go b/service/history/replication/stream_receiver_monitor_test.go index 5f503a7ecfe..065733f764d 100644 --- a/service/history/replication/stream_receiver_monitor_test.go +++ b/service/history/replication/stream_receiver_monitor_test.go @@ -43,7 +43,7 @@ import ( "go.temporal.io/server/common/log" "go.temporal.io/server/common/metrics" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tasks" "go.uber.org/mock/gomock" @@ -499,8 +499,8 @@ func (s *streamReceiverMonitorSuite) TestGenerateStatusMap_Success() { inboundKeys[key3] = struct{}{} ctx1 := shard.NewMockContext(s.controller) ctx2 := shard.NewMockContext(s.controller) - engine1 := history.NewMockEngine(s.controller) - engine2 := history.NewMockEngine(s.controller) + engine1 := historyi.NewMockEngine(s.controller) + engine2 := historyi.NewMockEngine(s.controller) engine1.EXPECT().GetMaxReplicationTaskInfo().Return(int64(1000), time.Now()) engine2.EXPECT().GetMaxReplicationTaskInfo().Return(int64(2000), time.Now()) readerId1 := shard.ReplicationReaderIDFromClusterShardID(int64(key1.Client.ClusterID), key1.Client.ShardID) diff --git a/service/history/replication/stream_sender.go b/service/history/replication/stream_sender.go index 8a72e3ec59e..9caa02b92e1 100644 --- a/service/history/replication/stream_sender.go +++ b/service/history/replication/stream_sender.go @@ -49,7 +49,7 @@ import ( "go.temporal.io/server/common/namespace" "go.temporal.io/server/common/primitives/timestamp" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tasks" "google.golang.org/protobuf/types/known/timestamppb" @@ -66,7 +66,7 @@ type ( StreamSenderImpl struct { server historyservice.HistoryService_StreamWorkflowReplicationMessagesServer shardContext shard.Context - historyEngine history.Engine + historyEngine historyi.Engine taskConverter SourceTaskConverter metrics metrics.Handler logger log.Logger @@ -86,7 +86,7 @@ type ( func NewStreamSender( server historyservice.HistoryService_StreamWorkflowReplicationMessagesServer, shardContext shard.Context, - historyEngine history.Engine, + historyEngine historyi.Engine, taskConverter SourceTaskConverter, clientClusterName string, clientClusterShardCount int32, diff --git a/service/history/replication/stream_sender_test.go b/service/history/replication/stream_sender_test.go index 4a33f41f575..3b811a45b8c 100644 --- a/service/history/replication/stream_sender_test.go +++ b/service/history/replication/stream_sender_test.go @@ -46,7 +46,7 @@ import ( "go.temporal.io/server/common/persistence" serviceerrors "go.temporal.io/server/common/serviceerror" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tasks" "go.temporal.io/server/service/history/tests" @@ -62,7 +62,7 @@ type ( controller *gomock.Controller server *historyservicemock.MockHistoryService_StreamWorkflowReplicationMessagesServer shardContext *shard.MockContext - historyEngine *history.MockEngine + historyEngine *historyi.MockEngine taskConverter *MockSourceTaskConverter clientShardKey ClusterShardKey @@ -91,7 +91,7 @@ func (s *streamSenderSuite) SetupTest() { s.controller = gomock.NewController(s.T()) s.server = historyservicemock.NewMockHistoryService_StreamWorkflowReplicationMessagesServer(s.controller) s.shardContext = shard.NewMockContext(s.controller) - s.historyEngine = history.NewMockEngine(s.controller) + s.historyEngine = historyi.NewMockEngine(s.controller) s.taskConverter = NewMockSourceTaskConverter(s.controller) s.config = tests.NewDynamicConfig() diff --git a/service/history/replication/task_processor.go b/service/history/replication/task_processor.go index f3f83694dfc..d8e2d96d9e4 100644 --- a/service/history/replication/task_processor.go +++ b/service/history/replication/task_processor.go @@ -53,7 +53,7 @@ import ( "go.temporal.io/server/common/quotas" serviceerrors "go.temporal.io/server/common/serviceerror" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "google.golang.org/protobuf/types/known/timestamppb" ) @@ -83,7 +83,7 @@ type ( sourceCluster string sourceShardID int32 shard shard.Context - historyEngine history.Engine + historyEngine historyi.Engine historySerializer serialization.Serializer config *configs.Config metricsHandler metrics.Handler @@ -117,7 +117,7 @@ type ( func NewTaskProcessor( sourceShardID int32, shard shard.Context, - historyEngine history.Engine, + historyEngine historyi.Engine, config *configs.Config, metricsHandler metrics.Handler, replicationTaskFetcher taskFetcher, diff --git a/service/history/replication/task_processor_manager.go b/service/history/replication/task_processor_manager.go index 6a4b2c6b1b7..cbacd688769 100644 --- a/service/history/replication/task_processor_manager.go +++ b/service/history/replication/task_processor_manager.go @@ -48,7 +48,7 @@ import ( "go.temporal.io/server/common/xdc" "go.temporal.io/server/service/history/configs" "go.temporal.io/server/service/history/deletemanager" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tasks" wcache "go.temporal.io/server/service/history/workflow/cache" @@ -63,7 +63,7 @@ type ( taskProcessorManagerImpl struct { config *configs.Config deleteMgr deletemanager.DeleteManager - engine history.Engine + engine historyi.Engine eventSerializer serialization.Serializer shard shard.Context status int32 @@ -87,7 +87,7 @@ type ( func NewTaskProcessorManager( config *configs.Config, shard shard.Context, - engine history.Engine, + engine historyi.Engine, workflowCache wcache.Cache, workflowDeleteManager deletemanager.DeleteManager, clientBean client.Bean, diff --git a/service/history/replication/task_processor_manager_test.go b/service/history/replication/task_processor_manager_test.go index b00399c3f9f..264cb7982b9 100644 --- a/service/history/replication/task_processor_manager_test.go +++ b/service/history/replication/task_processor_manager_test.go @@ -43,7 +43,7 @@ import ( "go.temporal.io/server/common/persistence" "go.temporal.io/server/common/persistence/serialization" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tasks" "go.temporal.io/server/service/history/tests" @@ -57,7 +57,7 @@ type ( controller *gomock.Controller mockShard *shard.MockContext - mockEngine *history.MockEngine + mockEngine *historyi.MockEngine mockClientBean *client.MockBean mockClusterMetadata *cluster.MockMetadata mockHistoryClient *historyservicemock.MockHistoryServiceClient @@ -96,7 +96,7 @@ func (s *taskProcessorManagerSuite) SetupTest() { s.shardID = rand.Int31() s.shardOwner = "test-shard-owner" s.mockShard = shard.NewMockContext(s.controller) - s.mockEngine = history.NewMockEngine(s.controller) + s.mockEngine = historyi.NewMockEngine(s.controller) s.mockClientBean = client.NewMockBean(s.controller) s.mockReplicationTaskExecutor = NewMockTaskExecutor(s.controller) diff --git a/service/history/replication/task_processor_test.go b/service/history/replication/task_processor_test.go index f0b3802a32f..73350663cc9 100644 --- a/service/history/replication/task_processor_test.go +++ b/service/history/replication/task_processor_test.go @@ -55,7 +55,7 @@ import ( "go.temporal.io/server/common/resourcetest" "go.temporal.io/server/common/testing/protorequire" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tests" "go.uber.org/mock/gomock" @@ -71,7 +71,7 @@ type ( controller *gomock.Controller mockResource *resourcetest.Test mockShard *shard.ContextTest - mockEngine *history.MockEngine + mockEngine *historyi.MockEngine mockNamespaceCache *namespace.MockRegistry mockClientBean *client.MockBean mockAdminClient *adminservicemock.MockAdminServiceClient @@ -118,7 +118,7 @@ func (s *taskProcessorSuite) SetupTest() { }, s.config, ) - s.mockEngine = history.NewMockEngine(s.controller) + s.mockEngine = historyi.NewMockEngine(s.controller) s.mockResource = s.mockShard.Resource s.mockNamespaceCache = s.mockResource.NamespaceCache s.mockClientBean = s.mockResource.ClientBean diff --git a/service/history/shard/context.go b/service/history/shard/context.go index d40c9094974..e100548d9c9 100644 --- a/service/history/shard/context.go +++ b/service/history/shard/context.go @@ -48,7 +48,7 @@ import ( "go.temporal.io/server/service/history/configs" "go.temporal.io/server/service/history/events" "go.temporal.io/server/service/history/hsm" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/tasks" ) @@ -78,7 +78,7 @@ type ( GetSearchAttributesMapperProvider() searchattribute.MapperProvider GetArchivalMetadata() archiver.ArchivalMetadata - GetEngine(ctx context.Context) (history.Engine, error) + GetEngine(ctx context.Context) (historyi.Engine, error) AssertOwnership(ctx context.Context) error NewVectorClock() (*clockspb.VectorClock, error) diff --git a/service/history/shard/context_impl.go b/service/history/shard/context_impl.go index c909695dc56..31f430de30b 100644 --- a/service/history/shard/context_impl.go +++ b/service/history/shard/context_impl.go @@ -74,7 +74,7 @@ import ( "go.temporal.io/server/service/history/consts" "go.temporal.io/server/service/history/events" "go.temporal.io/server/service/history/hsm" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/tasks" "go.temporal.io/server/service/history/vclock" "google.golang.org/protobuf/types/known/timestamppb" @@ -117,7 +117,7 @@ type ( contextTaggedLogger log.Logger throttledLogger log.Logger engineFactory EngineFactory - engineFuture *future.FutureImpl[history.Engine] + engineFuture *future.FutureImpl[historyi.Engine] queueMetricEmitter sync.Once finalizer *finalizer.Finalizer @@ -187,7 +187,7 @@ type ( contextRequest interface{} contextRequestAcquire struct{} - contextRequestAcquired struct{ engine history.Engine } + contextRequestAcquired struct{ engine historyi.Engine } contextRequestLost struct{} contextRequestStop struct{ reason stopReason } contextRequestFinishStop struct{} @@ -278,7 +278,7 @@ func (s *ContextImpl) GetPingChecks() []pingable.Check { func (s *ContextImpl) GetEngine( ctx context.Context, -) (history.Engine, error) { +) (historyi.Engine, error) { return s.engineFuture.Get(ctx) } @@ -1461,7 +1461,7 @@ func (s *ContextImpl) maybeRecordShardAcquisitionLatency(ownershipChanged bool) } } -func (s *ContextImpl) createEngine() history.Engine { +func (s *ContextImpl) createEngine() historyi.Engine { s.contextTaggedLogger.Info("", tag.LifeCycleStarting, tag.ComponentShardEngine) engine := s.engineFactory.CreateEngine(s) engine.Start() @@ -1987,7 +1987,7 @@ func (s *ContextImpl) acquireShard() { s.contextTaggedLogger.Info("Acquired shard") // The first time we get the shard, we have to create the engine - var engine history.Engine + var engine historyi.Engine if !s.engineFuture.Ready() { s.maybeRecordShardAcquisitionLatency(ownershipChanged) engine = s.createEngine() @@ -2121,7 +2121,7 @@ func newContext( handoverNamespaces: make(map[namespace.Name]*namespaceHandOverInfo), lifecycleCtx: lifecycleCtx, lifecycleCancel: lifecycleCancel, - engineFuture: future.NewFuture[history.Engine](), + engineFuture: future.NewFuture[historyi.Engine](), queueMetricEmitter: sync.Once{}, ioSemaphore: locks.NewPrioritySemaphore(ioConcurrency), stateMachineRegistry: stateMachineRegistry, diff --git a/service/history/shard/context_test.go b/service/history/shard/context_test.go index a39b6f7a22d..202706cc9a2 100644 --- a/service/history/shard/context_test.go +++ b/service/history/shard/context_test.go @@ -44,7 +44,7 @@ import ( "go.temporal.io/server/common/namespace" "go.temporal.io/server/common/persistence" "go.temporal.io/server/common/primitives/timestamp" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/tasks" "go.temporal.io/server/service/history/tests" "go.uber.org/mock/gomock" @@ -63,7 +63,7 @@ type ( mockShardManager *persistence.MockShardManager mockExecutionManager *persistence.MockExecutionManager mockNamespaceCache *namespace.MockRegistry - mockHistoryEngine *history.MockEngine + mockHistoryEngine *historyi.MockEngine timeSource *clock.EventTimeSource } @@ -104,7 +104,7 @@ func (s *contextSuite) SetupTest() { s.mockExecutionManager = shardContext.Resource.ExecutionMgr s.mockShardManager = shardContext.Resource.ShardMgr - s.mockHistoryEngine = history.NewMockEngine(s.controller) + s.mockHistoryEngine = historyi.NewMockEngine(s.controller) shardContext.engineFuture.Set(s.mockHistoryEngine, nil) } diff --git a/service/history/shard/context_testutil.go b/service/history/shard/context_testutil.go index 01c6116d632..7d27a564984 100644 --- a/service/history/shard/context_testutil.go +++ b/service/history/shard/context_testutil.go @@ -44,7 +44,7 @@ import ( "go.temporal.io/server/service/history/configs" "go.temporal.io/server/service/history/events" "go.temporal.io/server/service/history/hsm" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/tasks" "go.uber.org/mock/gomock" ) @@ -104,13 +104,13 @@ type ContextConfigOverrides struct { type StubContext struct { ContextTest - engine history.Engine + engine historyi.Engine } func NewStubContext( ctrl *gomock.Controller, overrides ContextConfigOverrides, - engine history.Engine, + engine historyi.Engine, ) *StubContext { resourceTest := resourcetest.NewTest(ctrl, primitives.HistoryService) eventsCache := events.NewMockCache(ctrl) @@ -163,7 +163,7 @@ func newTestContext(t *resourcetest.Test, eventsCache events.Cache, config Conte queueMetricEmitter: sync.Once{}, state: contextStateAcquired, - engineFuture: future.NewFuture[history.Engine](), + engineFuture: future.NewFuture[historyi.Engine](), shardInfo: config.ShardInfo, remoteClusterInfos: make(map[string]*remoteClusterInfo), handoverNamespaces: make(map[namespace.Name]*namespaceHandOverInfo), @@ -197,7 +197,7 @@ func newTestContext(t *resourcetest.Test, eventsCache events.Cache, config Conte } // SetEngineForTest sets s.engine. Only used by tests. -func (s *ContextTest) SetEngineForTesting(engine history.Engine) { +func (s *ContextTest) SetEngineForTesting(engine historyi.Engine) { s.engineFuture.Set(engine, nil) } @@ -235,6 +235,6 @@ func (s *ContextTest) StopForTest() { s.FinishStop() } -func (s *StubContext) GetEngine(_ context.Context) (history.Engine, error) { +func (s *StubContext) GetEngine(_ context.Context) (historyi.Engine, error) { return s.engine, nil } diff --git a/service/history/shard/controller_test.go b/service/history/shard/controller_test.go index f98802b24d9..b5d77fb0432 100644 --- a/service/history/shard/controller_test.go +++ b/service/history/shard/controller_test.go @@ -55,7 +55,7 @@ import ( "go.temporal.io/server/common/resourcetest" "go.temporal.io/server/internal/goro" "go.temporal.io/server/service/history/configs" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/tasks" "go.temporal.io/server/service/history/tests" "go.uber.org/mock/gomock" @@ -69,7 +69,7 @@ type ( controller *gomock.Controller mockResource *resourcetest.Test - mockHistoryEngine *history.MockEngine + mockHistoryEngine *historyi.MockEngine mockClusterMetadata *cluster.MockMetadata mockServiceResolver *membership.MockServiceResolver @@ -134,7 +134,7 @@ func (s *controllerSuite) SetupTest() { s.controller = gomock.NewController(s.T()) s.mockResource = resourcetest.NewTest(s.controller, primitives.HistoryService) - s.mockHistoryEngine = history.NewMockEngine(s.controller) + s.mockHistoryEngine = historyi.NewMockEngine(s.controller) s.mockEngineFactory = NewMockEngineFactory(s.controller) s.mockShardManager = s.mockResource.ShardMgr @@ -172,12 +172,12 @@ func (s *controllerSuite) TestAcquireShardSuccess() { s.config.NumberOfShards = numShards var myShards []int32 - historyEngines := make(map[int32]*history.MockEngine) + historyEngines := make(map[int32]*historyi.MockEngine) for shardID := int32(1); shardID <= numShards; shardID++ { hostID := shardID % 4 if hostID == 0 { myShards = append(myShards, shardID) - mockEngine := history.NewMockEngine(s.controller) + mockEngine := historyi.NewMockEngine(s.controller) historyEngines[shardID] = mockEngine s.setupMocksForAcquireShard(shardID, mockEngine, 5, 6, true) } else { @@ -208,12 +208,12 @@ func (s *controllerSuite) TestAcquireShardsConcurrently() { } var myShards []int32 - historyEngines := make(map[int32]*history.MockEngine) + historyEngines := make(map[int32]*historyi.MockEngine) for shardID := int32(1); shardID <= numShards; shardID++ { hostID := shardID % 4 if hostID == 0 { myShards = append(myShards, shardID) - mockEngine := history.NewMockEngine(s.controller) + mockEngine := historyi.NewMockEngine(s.controller) historyEngines[shardID] = mockEngine s.setupMocksForAcquireShard(shardID, mockEngine, 5, 6, true) } else { @@ -258,9 +258,9 @@ func (s *controllerSuite) TestAcquireShardRenewSuccess() { numShards := int32(2) s.config.NumberOfShards = numShards - historyEngines := make(map[int32]*history.MockEngine) + historyEngines := make(map[int32]*historyi.MockEngine) for shardID := int32(1); shardID <= numShards; shardID++ { - mockEngine := history.NewMockEngine(s.controller) + mockEngine := historyi.NewMockEngine(s.controller) historyEngines[shardID] = mockEngine s.setupMocksForAcquireShard(shardID, mockEngine, 5, 6, true) } @@ -288,9 +288,9 @@ func (s *controllerSuite) TestAcquireShardRenewLookupFailed() { numShards := int32(2) s.config.NumberOfShards = numShards - historyEngines := make(map[int32]*history.MockEngine) + historyEngines := make(map[int32]*historyi.MockEngine) for shardID := int32(1); shardID <= numShards; shardID++ { - mockEngine := history.NewMockEngine(s.controller) + mockEngine := historyi.NewMockEngine(s.controller) historyEngines[shardID] = mockEngine s.setupMocksForAcquireShard(shardID, mockEngine, 5, 6, true) } @@ -324,9 +324,9 @@ func (s *controllerSuite) TestHistoryEngineClosed() { s.mockHostInfoProvider, s.metricsTestHandler, ) - historyEngines := make(map[int32]*history.MockEngine) + historyEngines := make(map[int32]*historyi.MockEngine) for shardID := int32(1); shardID <= numShards; shardID++ { - mockEngine := history.NewMockEngine(s.controller) + mockEngine := historyi.NewMockEngine(s.controller) historyEngines[shardID] = mockEngine s.setupMocksForAcquireShard(shardID, mockEngine, 5, 6, true) } @@ -427,9 +427,9 @@ func (s *controllerSuite) TestShardControllerClosed() { s.metricsTestHandler, ) - historyEngines := make(map[int32]*history.MockEngine) + historyEngines := make(map[int32]*historyi.MockEngine) for shardID := int32(1); shardID <= numShards; shardID++ { - mockEngine := history.NewMockEngine(s.controller) + mockEngine := historyi.NewMockEngine(s.controller) historyEngines[shardID] = mockEngine s.setupMocksForAcquireShard(shardID, mockEngine, 5, 6, true) } @@ -472,7 +472,7 @@ func (s *controllerSuite) TestShardControllerClosed() { func (s *controllerSuite) TestShardExplicitUnload() { s.config.NumberOfShards = 1 - mockEngine := history.NewMockEngine(s.controller) + mockEngine := historyi.NewMockEngine(s.controller) mockEngine.EXPECT().Stop().AnyTimes() s.setupMocksForAcquireShard(1, mockEngine, 5, 6, false) @@ -493,7 +493,7 @@ func (s *controllerSuite) TestShardExplicitUnload() { func (s *controllerSuite) TestShardExplicitUnloadCancelGetOrCreate() { s.config.NumberOfShards = 1 - mockEngine := history.NewMockEngine(s.controller) + mockEngine := historyi.NewMockEngine(s.controller) mockEngine.EXPECT().Stop().AnyTimes() shardID := int32(1) @@ -534,7 +534,7 @@ func (s *controllerSuite) TestShardExplicitUnloadCancelGetOrCreate() { func (s *controllerSuite) TestShardExplicitUnloadCancelAcquire() { s.config.NumberOfShards = 1 - mockEngine := history.NewMockEngine(s.controller) + mockEngine := historyi.NewMockEngine(s.controller) mockEngine.EXPECT().Stop().AnyTimes() shardID := int32(1) @@ -602,8 +602,8 @@ func (s *controllerSuite) TestShardControllerFuzz() { queueStates := s.queueStates() s.mockServiceResolver.EXPECT().Lookup(convert.Int32ToString(shardID)).Return(s.hostInfo, nil).AnyTimes() - s.mockEngineFactory.EXPECT().CreateEngine(contextMatcher(shardID)).DoAndReturn(func(shard Context) history.Engine { - mockEngine := history.NewMockEngine(disconnectedMockController) + s.mockEngineFactory.EXPECT().CreateEngine(contextMatcher(shardID)).DoAndReturn(func(shard Context) historyi.Engine { + mockEngine := historyi.NewMockEngine(disconnectedMockController) status := new(int32) // notification step is done after engine is created, so may not be called when test finishes mockEngine.EXPECT().NotifyNewTasks(gomock.Any()).MaxTimes(2) @@ -733,8 +733,8 @@ func (s *controllerSuite) TestShardLingerTimeout() { timeLimit := 1 * time.Second s.config.ShardLingerTimeLimit = dynamicconfig.GetDurationPropertyFn(timeLimit) - historyEngines := make(map[int32]*history.MockEngine) - mockEngine := history.NewMockEngine(s.controller) + historyEngines := make(map[int32]*historyi.MockEngine) + mockEngine := historyi.NewMockEngine(s.controller) historyEngines[shardID] = mockEngine s.setupMocksForAcquireShard(shardID, mockEngine, 5, 6, true) s.mockShardManager.EXPECT().AssertShardOwnership(gomock.Any(), &persistence.AssertShardOwnershipRequest{ @@ -780,8 +780,8 @@ func (s *controllerSuite) TestShardLingerSuccess() { checkQPS := 5 s.config.ShardLingerOwnershipCheckQPS = dynamicconfig.GetIntPropertyFn(checkQPS) - historyEngines := make(map[int32]*history.MockEngine) - mockEngine := history.NewMockEngine(s.controller) + historyEngines := make(map[int32]*historyi.MockEngine) + mockEngine := historyi.NewMockEngine(s.controller) historyEngines[shardID] = mockEngine mockEngine.EXPECT().Start().MinTimes(1) @@ -880,7 +880,7 @@ func (s *controllerSuite) TestShardCounter() { // safe to call this multiple times throughout a test. func (s *controllerSuite) setupAndAcquireShards(numShards int) { s.config.NumberOfShards = int32(numShards) - mockEngine := history.NewMockEngine(s.controller) + mockEngine := historyi.NewMockEngine(s.controller) for shardID := 1; shardID <= numShards; shardID++ { s.setupMocksForAcquireShard(int32(shardID), mockEngine, 5, 6, false) } @@ -889,7 +889,7 @@ func (s *controllerSuite) setupAndAcquireShards(numShards int) { func (s *controllerSuite) setupMocksForAcquireShard( shardID int32, - mockEngine *history.MockEngine, + mockEngine *historyi.MockEngine, currentRangeID, newRangeID int64, required bool, ) { diff --git a/service/history/shard/engine_factory.go b/service/history/shard/engine_factory.go index 6fdabb82910..ab9e6e79627 100644 --- a/service/history/shard/engine_factory.go +++ b/service/history/shard/engine_factory.go @@ -26,11 +26,11 @@ package shard -import history "go.temporal.io/server/service/history/interfaces" +import historyi "go.temporal.io/server/service/history/interfaces" type ( // EngineFactory is used to create an instance of sharded history engine EngineFactory interface { - CreateEngine(context Context) history.Engine + CreateEngine(context Context) historyi.Engine } ) diff --git a/service/history/workflow/context_test.go b/service/history/workflow/context_test.go index 3d5b8d87699..1a04c17d97e 100644 --- a/service/history/workflow/context_test.go +++ b/service/history/workflow/context_test.go @@ -44,7 +44,7 @@ import ( "go.temporal.io/server/common/metrics" "go.temporal.io/server/common/persistence" "go.temporal.io/server/common/primitives/timestamp" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tasks" "go.temporal.io/server/service/history/tests" @@ -78,7 +78,7 @@ func (s *contextSuite) SetupTest() { &persistencespb.ShardInfo{ShardId: 1}, configs, ) - mockEngine := history.NewMockEngine(controller) + mockEngine := historyi.NewMockEngine(controller) mockEngine.EXPECT().NotifyNewTasks(gomock.Any()).AnyTimes() mockEngine.EXPECT().NotifyNewHistoryEvent(gomock.Any()).AnyTimes() s.mockShard.SetEngineForTesting(mockEngine) diff --git a/service/history/workflow/transaction_impl.go b/service/history/workflow/transaction_impl.go index a0e196c5444..90b01a2ab9f 100644 --- a/service/history/workflow/transaction_impl.go +++ b/service/history/workflow/transaction_impl.go @@ -37,7 +37,7 @@ import ( "go.temporal.io/server/common/namespace" "go.temporal.io/server/common/persistence" "go.temporal.io/server/service/history/events" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" ) @@ -567,7 +567,7 @@ func setWorkflowExecution( } func NotifyWorkflowSnapshotTasks( - engine history.Engine, + engine historyi.Engine, workflowSnapshot *persistence.WorkflowSnapshot, ) { if workflowSnapshot == nil { @@ -577,7 +577,7 @@ func NotifyWorkflowSnapshotTasks( } func NotifyWorkflowMutationTasks( - engine history.Engine, + engine historyi.Engine, workflowMutation *persistence.WorkflowMutation, ) { if workflowMutation == nil { @@ -587,7 +587,7 @@ func NotifyWorkflowMutationTasks( } func NotifyNewHistorySnapshotEvent( - engine history.Engine, + engine historyi.Engine, workflowSnapshot *persistence.WorkflowSnapshot, ) error { @@ -626,7 +626,7 @@ func NotifyNewHistorySnapshotEvent( } func NotifyNewHistoryMutationEvent( - engine history.Engine, + engine historyi.Engine, workflowMutation *persistence.WorkflowMutation, ) error { diff --git a/service/history/workflow/transaction_test.go b/service/history/workflow/transaction_test.go index c3a9d0474ec..a54ef09617a 100644 --- a/service/history/workflow/transaction_test.go +++ b/service/history/workflow/transaction_test.go @@ -37,7 +37,7 @@ import ( "go.temporal.io/server/common/namespace" "go.temporal.io/server/common/persistence" "go.temporal.io/server/common/util" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tests" "go.uber.org/mock/gomock" @@ -50,7 +50,7 @@ type ( controller *gomock.Controller mockShard *shard.MockContext - mockEngine *history.MockEngine + mockEngine *historyi.MockEngine mockNamespaceCache *namespace.MockRegistry logger log.Logger @@ -69,7 +69,7 @@ func (s *transactionSuite) SetupTest() { s.controller = gomock.NewController(s.T()) s.mockShard = shard.NewMockContext(s.controller) - s.mockEngine = history.NewMockEngine(s.controller) + s.mockEngine = historyi.NewMockEngine(s.controller) s.mockNamespaceCache = namespace.NewMockRegistry(s.controller) s.logger = log.NewTestLogger() diff --git a/tests/add_tasks_test.go b/tests/add_tasks_test.go index 8600311a173..7e677c62cee 100644 --- a/tests/add_tasks_test.go +++ b/tests/add_tasks_test.go @@ -44,7 +44,7 @@ import ( "go.temporal.io/server/common/debug" "go.temporal.io/server/common/persistence/serialization" "go.temporal.io/server/common/primitives" - history "go.temporal.io/server/service/history/interfaces" + historyi "go.temporal.io/server/service/history/interfaces" "go.temporal.io/server/service/history/queues" "go.temporal.io/server/service/history/shard" "go.temporal.io/server/service/history/tasks" @@ -104,7 +104,7 @@ func (c *faultyShardController) GetShardByID(shardID int32) (shard.Context, erro return &faultyShardContext{Context: ctx, suite: c.s}, nil } -func (c *faultyShardContext) GetEngine(ctx context.Context) (history.Engine, error) { +func (c *faultyShardContext) GetEngine(ctx context.Context) (historyi.Engine, error) { err := c.suite.getEngineErr.Load() if err != nil && *err != nil { return nil, *err