history_events_handler.go ×12

Frontier kind: Code frontier

unlabeled · c_e6541d5a1229

2 tests · 2590 LOC · 132 files · introduces 0 tests · 44 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges44 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
392 ranges2590 lines · 132 files · Browse complete extent
All tests (intent)
2 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.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

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

1 file ranked by introduced lines: 44 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/replication/eventhandler/history_events_handler.go 44 introduced LOC · 12 ranges

Open complete file

77 newEvents []*historypb.HistoryEvent,
78 newRunID string,
79 > ) error { history_events_handler.go
80 > if len(historyEvents) == 0 {
81 return serviceerror.NewInvalidArgument("Empty batches")
82 }
83 > localEvents, remoteEvents, err := h.splitBatchesToLocalAndRemote(historyEvents, versionHistoryItems) history_events_handler.go
84 > if err != nil {
85 return err
86 }
87
88 > if len(localEvents) != 0 { history_events_handler.go
89 if err := h.handleLocalGeneratedEvent(
90 ctx,
96 }
97 }
98 > if len(remoteEvents) != 0 { history_events_handler.go
99 > if err := h.handleRemoteGeneratedHistoryEvents(
100 > ctx,
101 > workflowKey,
102 > baseExecutionInfo,
103 > versionHistoryItems,
104 > remoteEvents,
105 > newEvents,
106 > newRunID,
107 > ); err != nil {
108 return err
109 }
110 }
111 > return nil history_events_handler.go
112 }
113
115 eventsBatches [][]*historypb.HistoryEvent,
116 versionHistoryItems []*historyspb.VersionHistoryItem,
117 > ) (local [][]*historypb.HistoryEvent, remote [][]*historypb.HistoryEvent, err error) { history_events_handler.go
118 > for _, batch := range eventsBatches {
119 > if len(batch) == 0 {
120 return nil, nil, serviceerror.NewInvalidArgument("Empty batch")
121 }
122 }
123 > localVersionHistory, _ := versionhistory.SplitVersionHistoryByLastLocalGeneratedItem(versionHistoryItems, h.clusterMetadata.GetClusterID(), h.clusterMetadata.GetFailoverVersionIncrement()) history_events_handler.go
124 > if len(localVersionHistory) == 0 {
125 return nil, eventsBatches, nil
126 }
127 > lastLocalEventId := localVersionHistory[len(localVersionHistory)-1].EventId history_events_handler.go
128 > firstBatch := eventsBatches[0]
129 > lastBatch := eventsBatches[len(eventsBatches)-1]
130 >
131 > if lastBatch[len(lastBatch)-1].EventId <= lastLocalEventId {
132 return eventsBatches, nil, nil
133 }
134 > if firstBatch[0].EventId > lastLocalEventId { history_events_handler.go
135 return nil, eventsBatches, nil
136 }
205 newEvents []*historypb.HistoryEvent,
206 newRunID string,
207 > ) error { history_events_handler.go
208 > shardContext, err := h.shardController.GetShardByNamespaceWorkflow(
209 > namespace.ID(workflowKey.NamespaceID),
210 > workflowKey.WorkflowID,
211 > )
212 > if err != nil {
213 return err
214 }
215 > engine, err := shardContext.GetEngine(ctx) history_events_handler.go
216 > if err != nil {
217 return err
218 }
219 > return engine.ReplicateHistoryEvents( history_events_handler.go
220 > ctx,
221 > workflowKey,
222 > baseExecutionInfo,
223 > versionHistoryItems,
224 > historyEvents,
225 > newEvents,
226 > newRunID,
227 > )
228 }