workflow.go ×8

Frontier kind: Code frontier

unlabeled · c_4345440694ce

8 tests · 3007 LOC · 135 files · introduces 0 tests · 53 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
12 ranges53 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
476 ranges3007 lines · 135 files · Browse complete extent
All tests (intent)
8 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: 53 introduced LOC across 12 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/service/worker/workerdeployment/workflow.go 27 introduced LOC · 8 ranges

Open complete file

1198 }
1199
1200 > func (d *WorkflowRunner) validateStateBeforeAcceptingSetManager(args *deploymentspb.SetManagerIdentityArgs) error { workflow.go
1201 > if d.State.GetManagerIdentity() == args.ManagerIdentity && d.State.GetLastModifierIdentity() == args.Identity {
1202 return temporal.NewApplicationError("no change", errNoChangeType, d.State.ConflictToken)
1203 }
1204 > if args.ConflictToken != nil && !bytes.Equal(args.ConflictToken, d.State.ConflictToken) { workflow.go
1205 return temporal.NewApplicationError("conflict token mismatch", errFailedPrecondition)
1206 }
1207 > return nil workflow.go
1208 }
1209
1215 }
1216
1217 > func (d *WorkflowRunner) handleSetManager(ctx workflow.Context, args *deploymentspb.SetManagerIdentityArgs) (*deploymentspb.SetManagerIdentityResponse, error) { workflow.go
1218 > if err := d.preUpdateChecks(ctx); err != nil {
1219 return nil, err
1220 }
1221
1222 // use lock to enforce only one update at a time
1223 > err := d.lock.Lock(ctx) workflow.go
1224 > if err != nil {
1225 d.logger.Error("Could not acquire workflow lock")
1226 return nil, serviceerror.NewDeadlineExceeded("Could not acquire workflow lock")
1227 }
1228 > defer func() { workflow.go
1229 > // Even if the update doesn't change the state we mark it as dirty because of created history events.
1230 > d.setStateChanged()
1231 > d.lock.Unlock()
1232 > }()
1233
1234 > err = d.validateStateBeforeAcceptingSetManager(args) workflow.go
1235 > if err != nil {
1236 return nil, err
1237 }
1238
1239 > prevManager := d.State.ManagerIdentity workflow.go
1240 >
1241 > // update local state
1242 > d.State.ManagerIdentity = args.ManagerIdentity
1243 > d.State.LastModifierIdentity = args.Identity
1244 > d.State.ConflictToken, _ = workflow.Now(ctx).MarshalBinary()
1245 >
1246 > // no need to update memo because identity and manager identity are not in it
1247 > return &deploymentspb.SetManagerIdentityResponse{
1248 > PreviousManagerIdentity: prevManager,
1249 > ConflictToken: d.State.ConflictToken,
1250 > }, nil
1251 }
1252
go.temporal.io/server/api/deployment/v1/message.pb.go 26 introduced LOC · 4 ranges

Open complete file

764 }
765
766 > func (x *WorkerDeploymentLocalState) GetManagerIdentity() string { message.pb.go
767 > if x != nil {
768 > return x.ManagerIdentity
769 > }
770 return ""
771 }
3022 }
3023
3024 > func (x *SetManagerIdentityArgs) Reset() { message.pb.go
3025 > *x = SetManagerIdentityArgs{}
3026 > mi := &file_temporal_server_api_deployment_v1_message_proto_msgTypes[44]
3027 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
3028 > ms.StoreMessageInfo(mi)
3029 > }
3030
3031 func (x *SetManagerIdentityArgs) String() string {
3035 func (*SetManagerIdentityArgs) ProtoMessage() {}
3036
3037 > func (x *SetManagerIdentityArgs) ProtoReflect() protoreflect.Message { message.pb.go
3038 > mi := &file_temporal_server_api_deployment_v1_message_proto_msgTypes[44]
3039 > if x != nil {
3040 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
3041 > if ms.LoadMessageInfo() == nil {
3042 > ms.StoreMessageInfo(mi)
3043 > }
3044 > return ms
3045 }
3046 return mi.MessageOf(x)
3095 func (*SetManagerIdentityResponse) ProtoMessage() {}
3096
3097 > func (x *SetManagerIdentityResponse) ProtoReflect() protoreflect.Message { message.pb.go
3098 > mi := &file_temporal_server_api_deployment_v1_message_proto_msgTypes[45]
3099 > if x != nil {
3100 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
3101 > if ms.LoadMessageInfo() == nil {
3102 > ms.StoreMessageInfo(mi)
3103 > }
3104 > return ms
3105 }
3106 return mi.MessageOf(x)