state_rebuilder.go ×9

Frontier kind: Code frontier

unlabeled · c_7d0b4d0d1bc4

2 tests · 5985 LOC · 213 files · introduces 0 tests · 43 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges43 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1100 ranges5985 lines · 213 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.

2 files ranked by introduced lines: 43 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/ndc/state_rebuilder.go 41 introduced LOC · 9 ranges

Open complete file

232 targetBranchToken []byte,
233 requestID string,
234 > ) (historyi.MutableState, int64, error) { state_rebuilder.go
235 > namespaceEntry, err := r.namespaceRegistry.GetNamespaceByID(namespace.ID(targetWorkflowIdentifier.NamespaceID))
236 > if err != nil {
237 return nil, 0, err
238 }
239
240 > iter := collection.NewPagingIterator(r.getPaginationFn( state_rebuilder.go
241 > ctx,
242 > common.FirstEventID,
243 > baseLastEventID+1,
244 > baseBranchToken,
245 > namespaceEntry.Name().String(),
246 > ))
247 >
248 > rebuiltMutableState, stateBuilder := r.initializeBuilders(
249 > namespaceEntry,
250 > targetWorkflowIdentifier,
251 > now,
252 > )
253 >
254 > var lastTxnId int64
255 > for iter.HasNext() {
256 > history, err := iter.Next()
257 > switch err.(type) {
258 > case nil:
259 // noop
260 case *serviceerror.DataLoss:
265 }
266
267 > if err := r.applyEvents( state_rebuilder.go
268 > ctx,
269 > targetWorkflowIdentifier,
270 > stateBuilder,
271 > history.History.Events,
272 > requestID,
273 > ); err != nil {
274 return nil, 0, err
275 }
276
277 > lastTxnId = history.TransactionID state_rebuilder.go
278 }
279
280 > if err := rebuiltMutableState.SetCurrentBranchToken(targetBranchToken); err != nil { state_rebuilder.go
281 return nil, 0, err
282 }
283 > currentVersionHistory, err := versionhistory.GetCurrentVersionHistory(rebuiltMutableState.GetExecutionInfo().GetVersionHistories()) state_rebuilder.go
284 > if err != nil {
285 return nil, 0, err
286 }
287 > lastItem, err := versionhistory.GetLastVersionHistoryItem(currentVersionHistory) state_rebuilder.go
288 > if err != nil {
289 return nil, 0, err
290 }
291
292 > if baseLastEventVersion != nil { state_rebuilder.go
293 > if !lastItem.Equal(versionhistory.NewVersionHistoryItem(
294 > baseLastEventID,
295 > *baseLastEventVersion,
296 > )) {
297 return nil, 0, serviceerror.NewInvalidArgumentf(
298 "StateRebuilder unable to Rebuild mutable state to event ID: %v, version: %v, this event must be at the boundary",
302 }
303 }
304 > return rebuiltMutableState, lastTxnId, nil state_rebuilder.go
305 }
306
go.temporal.io/server/service/history/historybuilder/event_store.go 2 introduced LOC · 1 range

Open complete file

259
260 if b.state == HistoryBuilderStateImmutable {
261 > return nil event_store.go
262 > }
263
264 taskIDCount := 0