get_workflow_util.go ×14

Frontier kind: Code frontier

unlabeled · c_3bd9fd7ad301

22 tests · 5136 LOC · 197 files · introduces 0 tests · 36 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
17 ranges36 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
898 ranges5136 lines · 197 files · Browse complete extent
All tests (intent)
22 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: 36 introduced LOC across 17 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/history/api/get_workflow_util.go 24 introduced LOC · 14 ranges

Open complete file

69 return nil, err
70 }
71 > currentVersionHistory, err := versionhistory.GetCurrentVersionHistory(response.GetVersionHistories()) get_workflow_util.go
72 > if err != nil {
73 return nil, err
74 }
75 > if request.GetVersionHistoryItem() == nil { get_workflow_util.go
76 > lastVersionHistoryItem, err := versionhistory.GetLastVersionHistoryItem(currentVersionHistory)
77 > if err != nil {
78 return nil, err
79 }
80 > request.VersionHistoryItem = lastVersionHistoryItem get_workflow_util.go
81 }
82
83 > transitionHistory := response.GetTransitionHistory() get_workflow_util.go
84 > currentVersionedTransition := transitionhistory.LastVersionedTransition(transitionHistory)
85 > if len(transitionHistory) != 0 && request.VersionedTransition != nil {
86 if transitionhistory.StalenessCheck(transitionHistory, request.VersionedTransition) != nil {
87 logger.Warn(fmt.Sprintf("Request versioned transition and transition history don't match. Request: %v, current: %v",
101 // We return the full version histories. Callers need to fetch the last version history item from current branch
102 // and use the last version history item in following calls.
103 > if !versionhistory.ContainsVersionHistoryItem(currentVersionHistory, request.VersionHistoryItem) { get_workflow_util.go
104 logItem, err := versionhistory.GetLastVersionHistoryItem(currentVersionHistory)
105 if err != nil {
120
121 // expectedNextEventID is 0 when caller want to get the current next event ID without blocking.
122 > expectedNextEventID := common.FirstEventID get_workflow_util.go
123 > if request.ExpectedNextEventId != common.EmptyEventID {
124 expectedNextEventID = request.GetExpectedNextEventId()
125 }
127 // if caller decide to long poll on workflow execution
128 // and the event ID we are looking for is smaller than current next event ID
129 > if expectedNextEventID >= response.GetNextEventId() && response.GetWorkflowStatus() == enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING { get_workflow_util.go
130 subscriberID, channel, err := eventNotifier.WatchHistoryEvent(workflowKey)
131 if err != nil {
315 nil,
316 func(mutableState historyi.MutableState) bool {
317 > transitionHistory := mutableState.GetExecutionInfo().GetTransitionHistory() get_workflow_util.go
318 > if len(transitionHistory) != 0 && versionedTransition != nil {
319 return transitionhistory.StalenessCheck(transitionHistory, versionedTransition) == nil
320 }
321
322 > currentVersionHistory, err := versionhistory.GetCurrentVersionHistory(mutableState.GetExecutionInfo().GetVersionHistories()) get_workflow_util.go
323 > if err != nil {
324 return false
325 }
326 > lastVersionHistoryItem, err := versionhistory.GetLastVersionHistoryItem(currentVersionHistory) get_workflow_util.go
327 > if err != nil {
328 return false
329 }
330
331 > if currentVersion == lastVersionHistoryItem.GetVersion() { get_workflow_util.go
332 return currentEventID <= lastVersionHistoryItem.GetEventId()
333 }
340 return nil, err
341 }
342 > defer func() { workflowLease.GetReleaseFn()(retError) }() get_workflow_util.go
343
344 > mutableState, err := workflowLease.GetContext().LoadMutableState(ctx, shardContext) get_workflow_util.go
345 > if err != nil {
346 return nil, err
347 }
348 > return MutableStateToGetResponse(mutableState) get_workflow_util.go
349 }
350
go.temporal.io/server/api/historyservice/v1/request_response.pb.go 12 introduced LOC · 3 ranges

Open complete file

529 }
530
531 > func (x *GetMutableStateRequest) GetVersionHistoryItem() *v19.VersionHistoryItem { request_response.pb.go
532 > if x != nil {
533 > return x.VersionHistoryItem
534 > }
535 return nil
536 }
623 }
624
625 > func (x *GetMutableStateResponse) GetNextEventId() int64 { request_response.pb.go
626 > if x != nil {
627 > return x.NextEventId
628 > }
629 return 0
630 }
735 }
736
737 > func (x *GetMutableStateResponse) GetTransitionHistory() []*v110.VersionedTransition { request_response.pb.go
738 > if x != nil {
739 > return x.TransitionHistory
740 > }
741 return nil
742 }