Skip to content

Commit

Permalink
rename history interface alias
Browse files Browse the repository at this point in the history
  • Loading branch information
ychebotarev committed Jan 11, 2025
1 parent 15562f9 commit 52c5d1a
Show file tree
Hide file tree
Showing 42 changed files with 175 additions and 175 deletions.
4 changes: 2 additions & 2 deletions service/history/api/respondworkflowtaskcompleted/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions service/history/history_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions service/history/history_engine_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions service/history/ndc/history_replicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions service/history/ndc/hsm_state_replicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -51,7 +51,7 @@ type (
HSMStateReplicator interface {
SyncHSMState(
ctx context.Context,
request *history.SyncHSMRequest,
request *historyi.SyncHSMRequest,
) error
}

Expand All @@ -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{
Expand Down Expand Up @@ -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)
Expand Down
30 changes: 15 additions & 15 deletions service/history/ndc/hsm_state_replicator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand All @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down
6 changes: 3 additions & 3 deletions service/history/ndc/workflow_state_replicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions service/history/ndc/workflow_state_replicator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions service/history/replication/eventhandler/event_importer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -57,7 +57,7 @@ type (
remoteHistoryFetcher *MockHistoryPaginatedFetcher
engineProvider historyEngineProvider
eventImporter EventImporter
engine *history.MockEngine
engine *historyi.MockEngine
}
)

Expand Down Expand Up @@ -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(
Expand Down
Loading

0 comments on commit 52c5d1a

Please sign in to comment.