signal_with_start_workflow.go ×14

Frontier kind: Code frontier

unlabeled · c_aebb21b0dce9

5 tests · 8169 LOC · 250 files · introduces 0 tests · 91 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
16 ranges91 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1650 ranges8169 lines · 250 files · Browse complete extent
All tests (intent)
5 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.

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

go.temporal.io/server/service/history/api/signalwithstartworkflow/signal_with_start_workflow.go 78 introduced LOC · 14 ranges

Open complete file

66 }
67 // else, either workflow is not running or restart requested
68 > return startAndSignalWorkflow( signal_with_start_workflow.go
69 > ctx,
70 > shard,
71 > namespaceEntry,
72 > currentWorkflowLease,
73 > startRequest,
74 > signalWithStartRequest,
75 > )
76 }
77
83 startRequest *historyservice.StartWorkflowExecutionRequest,
84 signalWithStartRequest *workflowservice.SignalWithStartWorkflowExecutionRequest,
85 > ) (startOutcome, error) { signal_with_start_workflow.go
86 > workflowID := signalWithStartRequest.GetWorkflowId()
87 > runID := uuid.New().String()
88 > // TODO(bergundy): Support eager workflow task
89 > newMutableState, err := api.NewWorkflowWithSignal(
90 > shard,
91 > namespaceEntry,
92 > workflowID,
93 > runID,
94 > startRequest,
95 > signalWithStartRequest,
96 > )
97 > if err != nil {
98 return startOutcome{}, err
99 }
100
101 > newWorkflowLease, err := api.NewWorkflowLeaseAndContext(nil, shard, newMutableState) signal_with_start_workflow.go
102 > if err != nil {
103 return startOutcome{}, err
104 }
105
106 > if err = api.ValidateSignal( signal_with_start_workflow.go
107 > ctx,
108 > shard,
109 > newMutableState,
110 > signalWithStartRequest.GetSignalInput().Size(),
111 > signalWithStartRequest.GetHeader().Size(),
112 > "SignalWithStartWorkflowExecution",
113 > ); err != nil {
114 return startOutcome{}, err
115 }
116
117 > workflowMutationFn, err := createWorkflowMutationFunction( signal_with_start_workflow.go
118 > shard,
119 > currentWorkflowLease,
120 > namespaceEntry,
121 > runID,
122 > signalWithStartRequest.GetWorkflowIdReusePolicy(),
123 > signalWithStartRequest.GetWorkflowIdConflictPolicy(),
124 > )
125 > if err != nil {
126 return startOutcome{}, err
127 }
128 > if workflowMutationFn != nil { signal_with_start_workflow.go
129 if err = startAndSignalWithCurrentWorkflow(
130 ctx,
139 return startOutcome{runID: runID, firstExecutionRunID: runID, started: true}, nil
140 }
141 > vrid, err := createVersionedRunID(currentWorkflowLease) signal_with_start_workflow.go
142 > if err != nil {
143 return startOutcome{}, err
144 }
145 > return startAndSignalWithoutCurrentWorkflow( signal_with_start_workflow.go
146 > ctx,
147 > shard,
148 > vrid,
149 > newWorkflowLease,
150 > currentWorkflowLease,
151 > signalWithStartRequest.RequestId,
152 > )
153 }
154
160 workflowIDReusePolicy enumspb.WorkflowIdReusePolicy,
161 workflowIDConflictPolicy enumspb.WorkflowIdConflictPolicy,
162 > ) (api.UpdateWorkflowActionFunc, error) { signal_with_start_workflow.go
163 > if currentWorkflowLease == nil {
164 return nil, nil
165 }
197 }
198
199 > func createVersionedRunID(currentWorkflowLease api.WorkflowLease) (*api.VersionedRunID, error) { signal_with_start_workflow.go
200 > if currentWorkflowLease == nil {
201 return nil, nil
202 }
245 currentWorkflowLease api.WorkflowLease,
246 requestID string,
247 > ) (startOutcome, error) { signal_with_start_workflow.go
248 > newWorkflow, newWorkflowEventsSeq, err := newWorkflowLease.GetMutableState().CloseTransactionAsSnapshot(
249 > ctx,
250 > historyi.TransactionPolicyActive,
251 > )
252 > if err != nil {
253 return startOutcome{}, err
254 }
255 > if len(newWorkflowEventsSeq) != 1 { signal_with_start_workflow.go
256 return startOutcome{}, serviceerror.NewInternal("unable to create 1st event batch")
257 }
258
259 > createMode := persistence.CreateWorkflowModeBrandNew signal_with_start_workflow.go
260 > prevRunID := ""
261 > prevLastWriteVersion := int64(0)
262 > if vrid != nil {
263 createMode = persistence.CreateWorkflowModeUpdateCurrent
264 prevRunID = vrid.RunID
273 }
274 }
275 > err = newWorkflowLease.GetContext().CreateWorkflowExecution( signal_with_start_workflow.go
276 > ctx,
277 > shardContext,
278 > createMode,
279 > prevRunID,
280 > prevLastWriteVersion,
281 > newWorkflowLease.GetMutableState(),
282 > newWorkflow,
283 > newWorkflowEventsSeq,
284 > historyi.TransactionPolicyActive,
285 > )
286 > switch failedErr := err.(type) {
287 case nil:
288 // Brand-new run: head of the chain == this run id.
go.temporal.io/server/service/history/api/create_workflow_util.go 11 introduced LOC · 1 range

Open complete file

74
75 if signalWithStartRequest != nil {
76 > if signalWithStartRequest.GetRequestId() != "" { create_workflow_util.go
77 > newMutableState.AddSignalRequested(signalWithStartRequest.GetRequestId())
78 > }
79 > if _, err := newMutableState.AddWorkflowExecutionSignaled(
80 > signalWithStartRequest.GetSignalName(),
81 > signalWithStartRequest.GetSignalInput(),
82 > signalWithStartRequest.GetIdentity(),
83 > signalWithStartRequest.GetHeader(),
84 > signalWithStartRequest.GetRequestId(),
85 > signalWithStartRequest.GetLinks(),
86 > ); err != nil {
87 return nil, err
88 }
go.temporal.io/server/service/history/workflow/mutable_state_impl.go 2 introduced LOC · 1 range

Open complete file

8605 for requestID, eventID := range requestIDToEventID {
8606 if requestIDInfo, ok := ms.executionState.RequestIds[requestID]; ok {
8607 > requestIDInfo.EventId = eventID mutable_state_impl.go
8608 > }
8609 if wf != nil {
8610 // UpdateIncomingSignalEvent is a no-op for non-signal request IDs as they won't exist in the map.