api.go ×11

Frontier kind: Joint frontier

unlabeled · c_e70b2f25e703

1 test · 3657 LOC · 153 files · introduces 1 test · 68 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
15 ranges68 lines · 3 files
Tests
1 test

Contains — complete concept membership

All code (extent)
576 ranges3657 lines · 153 files · Browse complete extent
All tests (intent)
1 testBrowse 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.

1 test introduced at this concept.

Introduced code

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

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

go.temporal.io/server/service/history/api/updateworkflowoptions/api.go 50 introduced LOC · 11 ranges

Open complete file

32 versionCache worker_versioning.VersionMembershipAndReactivationStatusCache,
33 reactivationSignaler api.VersionReactivationSignalerFn,
34 > ) (*historyservice.UpdateWorkflowExecutionOptionsResponse, error) { api.go
35 > req := request.GetUpdateRequest()
36 > ns, err := api.GetActiveNamespace(shardCtx, namespace.ID(request.GetNamespaceId()), req.GetWorkflowExecution().GetWorkflowId())
37 > if err != nil {
38 return nil, err
39 }
40 > ret := &historyservice.UpdateWorkflowExecutionOptionsResponse{} api.go
41 >
42 > // Store versioning override to send reactivation signal after successful persistence
43 > var versioningOverrideForReactivation *workflowpb.VersioningOverride
44 > var shouldSkipReactivation bool
45 > var revisionNumber int64
46 >
47 > err = api.GetAndUpdateWorkflowWithNew(
48 > ctx,
49 > nil,
50 > definition.NewWorkflowKey(
51 > ns.ID().String(),
52 > req.GetWorkflowExecution().GetWorkflowId(),
53 > req.GetWorkflowExecution().GetRunId(),
54 > ),
55 > func(workflowLease api.WorkflowLease) (*api.UpdateWorkflowAction, error) {
56 > mutableState := workflowLease.GetMutableState()
57 > if !mutableState.IsWorkflowExecutionRunning() {
58 // in-memory mutable state is still clean, let updateError=nil in the defer func()
59 // to prevent clearing and reloading mutable state while releasing the lock
64 // or error if no pinned version exists.
65 // Clone the requested options to avoid mutating the original request but only do the cloning work if needed.
66 > requestedOptions := req.GetWorkflowExecutionOptions() api.go
67 > if requestedOptions.GetVersioningOverride().GetPinned().GetBehavior() != workflowpb.VersioningOverride_PINNED_OVERRIDE_BEHAVIOR_UNSPECIFIED &&
68 > requestedOptions.GetVersioningOverride().GetPinned().GetVersion() == nil {
69 currentVersion := worker_versioning.ExternalWorkerDeploymentVersionFromDeployment(workflow.GetEffectiveDeployment(mutableState.GetExecutionInfo().GetVersioningInfo()))
70 if effectiveBevior := workflow.GetEffectiveVersioningBehavior(mutableState.GetExecutionInfo().GetVersioningInfo()); effectiveBevior != enumspb.VERSIONING_BEHAVIOR_PINNED {
83
84 // Validate versioning override, if any.
85 > shouldSkipReactivation, revisionNumber, err = worker_versioning.ValidateVersioningOverrideAndGetReactivationEligibility(ctx, requestedOptions.GetVersioningOverride(), matchingClient, versionCache, mutableState.GetExecutionInfo().GetTaskQueue(), enumspb.TASK_QUEUE_TYPE_WORKFLOW, ns.ID().String()) api.go
86 > if err != nil {
87 return nil, err
88 }
89 > mergedOpts, hasChanges, err := MergeAndApply(mutableState, requestedOptions, req.GetUpdateMask(), req.GetIdentity()) api.go
90 > if err != nil {
91 return nil, err
92 }
93 // Set options for gRPC response
94 > ret.WorkflowExecutionOptions = mergedOpts api.go
95 >
96 > // If there is no mutable state change at all, return with no new history event and Noop=true
97 > if !hasChanges {
98 return &api.UpdateWorkflowAction{
99 Noop: true,
102 }
103
104 > ret.UpdateTime = timestamppb.New(mutableState.Now()) api.go
105 >
106 > // Store versioning override to send reactivation signal after successful persistence
107 > versioningOverrideForReactivation = mergedOpts.GetVersioningOverride()
108 >
109 > // TODO (carly) part 2: handle safe deployment change --> CreateWorkflowTask=true
110 > return &api.UpdateWorkflowAction{
111 > Noop: false,
112 > CreateWorkflowTask: false,
113 > }, nil
114 },
115 nil,
117 workflowConsistencyChecker,
118 )
119 > if err != nil { api.go
120 return nil, err
121 }
123 // Notify version workflow if we're pinning to a potentially drained version.
124 // This is done after successful persistence to avoid signaling if the update fails.
125 > api.ReactivateVersionWorkflowIfPinned(ctx, ns, versioningOverrideForReactivation, reactivationSignaler, shardCtx.GetConfig().EnableVersionReactivationSignals(), shouldSkipReactivation, revisionNumber) api.go
126 >
127 > return ret, nil
128 }
129
175 opts := &workflowpb.WorkflowExecutionOptions{}
176 if versioningInfo := ms.GetExecutionInfo().GetVersioningInfo(); versioningInfo != nil {
177 > override, ok := proto.Clone(versioningInfo.GetVersioningOverride()).(*workflowpb.VersioningOverride) api.go
178 > if !ok {
179 return nil
180 }
181 > opts.VersioningOverride = override api.go
182 }
183 if priority := ms.GetExecutionInfo().GetPriority(); priority != nil {
go.temporal.io/server/api/historyservice/v1/request_response.pb.go 12 introduced LOC · 3 ranges

Open complete file

9846 }
9847
9848 > func (x *UpdateWorkflowExecutionOptionsRequest) GetNamespaceId() string { request_response.pb.go
9849 > if x != nil {
9850 > return x.NamespaceId
9851 > }
9852 return ""
9853 }
9854
9855 > func (x *UpdateWorkflowExecutionOptionsRequest) GetUpdateRequest() *v1.UpdateWorkflowExecutionOptionsRequest { request_response.pb.go
9856 > if x != nil {
9857 > return x.UpdateRequest
9858 > }
9859 return nil
9860 }
9901 }
9902
9903 > func (x *UpdateWorkflowExecutionOptionsResponse) GetWorkflowExecutionOptions() *v15.WorkflowExecutionOptions { request_response.pb.go
9904 > if x != nil {
9905 > return x.WorkflowExecutionOptions
9906 > }
9907 return nil
9908 }
go.temporal.io/server/service/history/interfaces/mutable_state_mock.go 6 introduced LOC · 1 range

Open complete file

3378
3379 // Now mocks base method.
3380 > func (m *MockMutableState) Now() time.Time { mutable_state_mock.go
3381 > m.ctrl.T.Helper()
3382 > ret := m.ctrl.Call(m, "Now")
3383 > ret0, _ := ret[0].(time.Time)
3384 > return ret0
3385 > }
3386
3387 // Now indicates an expected call of Now.