workflow.go ×10

Frontier kind: Code frontier

unlabeled · c_5b8f7103600e

22 tests · 2940 LOC · 133 files · introduces 0 tests · 50 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
13 ranges50 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
457 ranges2940 lines · 133 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: 50 introduced LOC across 13 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/workerdeployment/workflow.go 34 introduced LOC · 10 ranges

Open complete file

1130
1131 // Ignore the manager identity check if the delete operation is initiated by the server internally
1132 > if !args.GetServerDelete() && d.State.ManagerIdentity != "" && d.State.ManagerIdentity != args.Identity { workflow.go
1133 return serviceerror.NewFailedPreconditionf(ErrManagerIdentityMismatch, d.State.ManagerIdentity, args.Identity)
1134 }
1135 > return nil workflow.go
1136 }
1137
1138 > func (d *WorkflowRunner) deleteVersion(ctx workflow.Context, args *deploymentspb.DeleteVersionArgs) error { workflow.go
1139 > // ask version to delete itself
1140 > activityCtx := workflow.WithActivityOptions(ctx, defaultActivityOptions)
1141 > var res deploymentspb.SyncVersionStateActivityResult
1142 > err := workflow.ExecuteActivity(activityCtx, d.a.DeleteWorkerDeploymentVersion, &deploymentspb.DeleteVersionActivityArgs{
1143 > Identity: args.Identity,
1144 > DeploymentName: d.DeploymentName,
1145 > Version: args.Version,
1146 > RequestId: uuid.NewString(),
1147 > SkipDrainage: args.SkipDrainage,
1148 > AsyncPropagation: d.hasMinVersion(AsyncSetCurrentAndRamping),
1149 > }).Get(ctx, &res)
1150 > if err != nil {
1151 var activityError *temporal.ActivityError
1152 var applicationError *temporal.ApplicationError
1158 }
1159 // update local state
1160 > delete(d.State.Versions, args.Version) workflow.go
1161 > // remove from propagating versions if it's there
1162 > delete(d.State.PropagatingRevisions, worker_versioning.ExternalWorkerDeploymentVersionFromStringV31(args.GetVersion()).GetBuildId())
1163 > if !args.GetServerDelete() {
1164 > d.State.LastModifierIdentity = args.Identity
1165 > }
1166 // update memo
1167 > return d.updateMemo(ctx) workflow.go
1168 }
1169
1170 > func (d *WorkflowRunner) handleDeleteVersion(ctx workflow.Context, args *deploymentspb.DeleteVersionArgs) error { workflow.go
1171 > if err := d.preUpdateChecks(ctx); err != nil {
1172 return err
1173 }
1174
1175 // use lock to enforce only one update at a time
1176 > err := d.lock.Lock(ctx) workflow.go
1177 > if err != nil {
1178 d.logger.Error("Could not acquire workflow lock")
1179 return serviceerror.NewDeadlineExceeded("Could not acquire workflow lock")
1180 }
1181 > defer func() { workflow.go
1182 > // Even if the update doesn't change the state we mark it as dirty because of created history events.
1183 > d.setStateChanged()
1184 > d.lock.Unlock()
1185 > }()
1186
1187 // Validating the state before starting the DeleteVersion operation. This is required due to the following reason:
1190 // enforces sequential updates, after the first update completes, the version will be removed from the local state of the deployment workflow. The second update,
1191 // now already accepted by the validator, should now not be allowed to run since the initial workflow state is different.
1192 > err = d.validateDeleteVersion(args) workflow.go
1193 > if err != nil {
1194 return err
1195 }
1196
1197 > return d.deleteVersion(ctx, args) workflow.go
1198 }
1199
go.temporal.io/server/api/deployment/v1/message.pb.go 16 introduced LOC · 3 ranges

Open complete file

2652 }
2653
2654 > func (x *DeleteVersionArgs) GetVersion() string { message.pb.go
2655 > if x != nil {
2656 > return x.Version
2657 > }
2658 return ""
2659 }
2666 }
2667
2668 > func (x *DeleteVersionArgs) GetServerDelete() bool { message.pb.go
2669 > if x != nil {
2670 > return x.ServerDelete
2671 > }
2672 return false
2673 }
2706 func (*DeleteVersionActivityArgs) ProtoMessage() {}
2707
2708 > func (x *DeleteVersionActivityArgs) ProtoReflect() protoreflect.Message { message.pb.go
2709 > mi := &file_temporal_server_api_deployment_v1_message_proto_msgTypes[39]
2710 > if x != nil {
2711 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
2712 > if ms.LoadMessageInfo() == nil {
2713 > ms.StoreMessageInfo(mi)
2714 > }
2715 > return ms
2716 }
2717 return mi.MessageOf(x)