nexus_commands.go ×5

Frontier kind: Code frontier

unlabeled · c_49d59dee73ac

19 tests · 2797 LOC · 141 files · introduces 0 tests · 58 LOC · 7 files

Introduces — evidence that enters the hierarchy at this concept

Code
15 ranges58 lines · 7 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
462 ranges2797 lines · 141 files · Browse complete extent
All tests (intent)
19 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.

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

go.temporal.io/server/chasm/lib/workflow/nexus_commands.go 30 introduced LOC · 5 ranges

Open complete file

171 }
172
173 > maxPendingOperations := ch.config.MaxConcurrentOperationsPerWorkflow(nsName) nexus_commands.go
174 > if wf.pendingNexusOperationCount() >= maxPendingOperations {
175 return FailWorkflowTaskError{
176 Cause: enumspb.WORKFLOW_TASK_FAILED_CAUSE_PENDING_NEXUS_OPERATIONS_LIMIT_EXCEEDED,
180
181 // Trim timeout to workflow run timeout.
182 > runTimeout := wf.WorkflowRunTimeout() nexus_commands.go
183 > opTimeout := attrs.ScheduleToCloseTimeout.AsDuration()
184 > if runTimeout > 0 && (opTimeout == 0 || opTimeout > runTimeout) {
185 attrs.ScheduleToCloseTimeout = durationpb.New(runTimeout)
186 opTimeout = runTimeout
188
189 // Trim timeout to max allowed timeout.
190 > if maxTimeout := ch.config.MaxOperationScheduleToCloseTimeout(nsName); maxTimeout > 0 && opTimeout > maxTimeout { nexus_commands.go
191 attrs.ScheduleToCloseTimeout = durationpb.New(maxTimeout)
192 }
193
194 // Trim secondary timeouts to the primary timeout.
195 > scheduleToCloseTimeout := attrs.ScheduleToCloseTimeout.AsDuration() nexus_commands.go
196 > scheduleToStartTimeout := attrs.ScheduleToStartTimeout.AsDuration()
197 > startToCloseTimeout := attrs.StartToCloseTimeout.AsDuration()
198 >
199 > if scheduleToCloseTimeout > 0 {
200 if scheduleToStartTimeout > scheduleToCloseTimeout {
201 attrs.ScheduleToStartTimeout = attrs.ScheduleToCloseTimeout
206 }
207
208 > _, err := addAndApplyHistoryEvent[ScheduledEventDefinition](wf, ctx, func(he *historypb.HistoryEvent) { nexus_commands.go
209 > he.Attributes = &historypb.HistoryEvent_NexusOperationScheduledEventAttributes{
210 > NexusOperationScheduledEventAttributes: &historypb.NexusOperationScheduledEventAttributes{
211 > Endpoint: attrs.Endpoint,
212 > EndpointId: endpointID,
213 > Service: attrs.Service,
214 > Operation: attrs.Operation,
215 > Input: attrs.Input,
216 > ScheduleToCloseTimeout: attrs.ScheduleToCloseTimeout,
217 > ScheduleToStartTimeout: attrs.ScheduleToStartTimeout,
218 > StartToCloseTimeout: attrs.StartToCloseTimeout,
219 > NexusHeader: lowerCaseHeader,
220 > RequestId: requestID,
221 > WorkflowTaskCompletedEventId: opts.WorkflowTaskCompletedEventID,
222 > },
223 > }
224 > he.UserMetadata = cmd.UserMetadata
225 > })
226 > return err
227 }
228
go.temporal.io/server/chasm/ms_pointer.go 6 introduced LOC · 2 ranges

Open complete file

25
26 // WorkflowRunTimeout returns the workflow run timeout duration. Returns 0 if no timeout is set.
27 > func (m MSPointer) WorkflowRunTimeout() time.Duration { ms_pointer.go
28 > return m.backend.GetExecutionInfo().GetWorkflowRunTimeout().AsDuration()
29 > }
30
31 // AddHistoryEvent adds a history event via the underlying mutable state.
32 > func (m MSPointer) AddHistoryEvent(t enumspb.EventType, setAttributes func(*historypb.HistoryEvent)) *historypb.HistoryEvent { ms_pointer.go
33 > return m.backend.AddHistoryEvent(t, setAttributes)
34 > }
35
36 // HasAnyBufferedEvent returns true if there is at least one buffered event that matches the provided filter.
go.temporal.io/server/chasm/node_backend_mock.go 6 introduced LOC · 2 ranges

Open complete file

60 func (m *MockNodeBackend) GetExecutionInfo() *persistencespb.WorkflowExecutionInfo {
61 if m.HandleGetExecutionInfo != nil {
62 > return m.HandleGetExecutionInfo() node_backend_mock.go
63 > }
64 return &persistencespb.WorkflowExecutionInfo{}
65 }
191 }
192
193 > func (m *MockNodeBackend) AddHistoryEvent(t enumspb.EventType, setAttributes func(*historypb.HistoryEvent)) *historypb.HistoryEvent { node_backend_mock.go
194 > if m.HandleAddHistoryEvent != nil {
195 > return m.HandleAddHistoryEvent(t, setAttributes)
196 > }
197 return nil
198 }
go.temporal.io/server/chasm/lib/workflow/workflow.go 5 introduced LOC · 2 ranges

Open complete file

254 ctx chasm.MutableContext,
255 setAttributes func(*historypb.HistoryEvent),
256 > ) (*historypb.HistoryEvent, error) { workflow.go
257 > def, ok := eventDefinitionByGoType[D](workflowContextFromChasm(ctx).registry)
258 > if !ok {
259 return nil, serviceerror.NewInternalf("no event definition registered for Go type %T", (*D)(nil))
260 }
261 > event := w.AddHistoryEvent(def.Type(), setAttributes) workflow.go
262 > return event, def.Apply(ctx, w, event)
263 }
264
go.temporal.io/server/api/persistence/v1/executions.pb.go 4 introduced LOC · 1 range

Open complete file

480 }
481
482 > func (x *WorkflowExecutionInfo) GetWorkflowRunTimeout() *durationpb.Duration { executions.pb.go
483 > if x != nil {
484 > return x.WorkflowRunTimeout
485 > }
486 return nil
487 }
go.temporal.io/server/chasm/lib/workflow/library.go 4 introduced LOC · 2 ranges

Open complete file

55 var ctxKeyWorkflowContext = ctxKeyWorkflowContextType{}
56
57 > func workflowContextFromChasm(ctx chasm.Context) *workflowContext { library.go
58 > wc, ok := ctx.Value(ctxKeyWorkflowContext).(*workflowContext)
59 > if !ok {
60 return nil
61 }
62 > return wc library.go
63 }
64
go.temporal.io/server/chasm/lib/workflow/nexus_methods.go 3 introduced LOC · 1 range

Open complete file

40
41 // pendingNexusOperationCount returns the number of pending Nexus operations in the workflow.
42 > func (w *Workflow) pendingNexusOperationCount() int { nexus_methods.go
43 > return len(w.Operations)
44 > }
45
46 // OnNexusOperationStarted adds a NexusOperationStarted history event to the workflow and applies