branch_manager_mock.go ×4

Frontier kind: Joint frontier

unlabeled · c_af180a36307e

3 tests · 2741 LOC · 138 files · introduces 1 test · 58 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges58 lines · 3 files
Tests
1 test

Contains — complete concept membership

All code (extent)
403 ranges2741 lines · 138 files · Browse complete extent
All tests (intent)
3 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

1 test introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

3 files ranked by introduced lines: 58 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/ndc/mutable_state_mapper.go 32 introduced LOC · 3 ranges

Open complete file

50 newConflictResolver conflictResolverProvider,
51 newMutableStateRebuilder mutableStateRebuilderProvider,
52 > ) *MutableStateMapperImpl { mutable_state_mapper.go
53 > return &MutableStateMapperImpl{
54 > shardContext: shardContext,
55 > newBufferEventFlusher: newBufferEventFlusher,
56 > newBranchMgr: newBranchMgr,
57 > newConflictResolver: newConflictResolver,
58 > newMutableStateRebuilder: newMutableStateRebuilder,
59 > }
60 > }
61
62 func (m *MutableStateMapperImpl) FlushBufferEvents(
83 mutableState historyi.MutableState,
84 task replicationTask,
85 > ) (historyi.MutableState, PrepareHistoryBranchOut, error) { mutable_state_mapper.go
86 > branchMgr := m.newBranchMgr(wfContext, mutableState, task.getLogger())
87 > incomingVersionHistory := task.getVersionHistory()
88 > eventBatches := task.getEvents()
89 > eventBatchApplyIndex := 0
90 > doContinue := false
91 > var versionHistoryIndex int32
92 > var err error
93 > for index, eventBatch := range eventBatches {
94 > doContinueCurrentBatch, versionHistoryIndexCurrentBatch, errCurrentBatch := branchMgr.GetOrCreate(
95 > ctx,
96 > incomingVersionHistory,
97 > eventBatch[0].GetEventId(),
98 > eventBatch[0].GetVersion(),
99 > )
100 > if doContinueCurrentBatch || errCurrentBatch != nil {
101 eventBatchApplyIndex = index
102 doContinue = doContinueCurrentBatch
107 }
108
109 > switch err.(type) { mutable_state_mapper.go
110 > case nil:
111 > return mutableState, PrepareHistoryBranchOut{
112 > DoContinue: doContinue,
113 > BranchIndex: versionHistoryIndex,
114 > EventsApplyIndex: eventBatchApplyIndex,
115 > }, nil
116 case *serviceerrors.RetryReplication:
117 // replication message can arrive out of order
go.temporal.io/server/service/history/ndc/branch_manager_mock.go 20 introduced LOC · 4 ranges

Open complete file

31
32 // NewMockBranchMgr creates a new mock instance.
33 > func NewMockBranchMgr(ctrl *gomock.Controller) *MockBranchMgr { branch_manager_mock.go
34 > mock := &MockBranchMgr{ctrl: ctrl}
35 > mock.recorder = &MockBranchMgrMockRecorder{mock}
36 > return mock
37 > }
38
39 // EXPECT returns an object that allows the caller to indicate expected use.
40 > func (m *MockBranchMgr) EXPECT() *MockBranchMgrMockRecorder { branch_manager_mock.go
41 > return m.recorder
42 > }
43
44 // Create mocks base method.
59
60 // GetOrCreate mocks base method.
61 > func (m *MockBranchMgr) GetOrCreate(ctx context.Context, incomingVersionHistory *history.VersionHistory, incomingFirstEventID, incomingFirstEventVersion int64) (bool, int32, error) { branch_manager_mock.go
62 > m.ctrl.T.Helper()
63 > ret := m.ctrl.Call(m, "GetOrCreate", ctx, incomingVersionHistory, incomingFirstEventID, incomingFirstEventVersion)
64 > ret0, _ := ret[0].(bool)
65 > ret1, _ := ret[1].(int32)
66 > ret2, _ := ret[2].(error)
67 > return ret0, ret1, ret2
68 > }
69
70 // GetOrCreate indicates an expected call of GetOrCreate.
71 > func (mr *MockBranchMgrMockRecorder) GetOrCreate(ctx, incomingVersionHistory, incomingFirstEventID, incomingFirstEventVersion any) *gomock.Call { branch_manager_mock.go
72 > mr.mock.ctrl.T.Helper()
73 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrCreate", reflect.TypeOf((*MockBranchMgr)(nil).GetOrCreate), ctx, incomingVersionHistory, incomingFirstEventID, incomingFirstEventVersion)
74 > }
go.temporal.io/server/service/history/ndc/replication_task.go 6 introduced LOC · 2 ranges

Open complete file

293 }
294
295 > func (t *replicationTaskImpl) getLogger() log.Logger { replication_task.go
296 > return t.logger
297 > }
298
299 func (t *replicationTaskImpl) getVersionedTransition() *persistencespb.VersionedTransition {
305 }
306
307 > func (t *replicationTaskImpl) getVersionHistory() *historyspb.VersionHistory { replication_task.go
308 > return t.versionHistory
309 > }
310
311 func (t *replicationTaskImpl) isWorkflowReset() bool {