sync_state_retriever.go ×9

Frontier kind: Code frontier

unlabeled · c_63c937bde905

3 tests · 4579 LOC · 192 files · introduces 0 tests · 70 LOC · 5 files

Introduces — evidence that enters the hierarchy at this concept

Code
16 ranges70 lines · 5 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
749 ranges4579 lines · 192 files · Browse complete extent
All tests (intent)
3 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.

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

go.temporal.io/server/service/history/replication/sync_state_retriever.go 45 introduced LOC · 9 ranges

Open complete file

225 versionedTransitionArtifact := &replicationspb.VersionedTransitionArtifact{}
226 if shouldReturnMutation() {
227 > mutation, err := s.getMutation(mutableState, targetCurrentVersionedTransition) sync_state_retriever.go
228 > if err != nil {
229 return nil, err
230 }
231 > versionedTransitionArtifact.StateAttributes = &replicationspb.VersionedTransitionArtifact_SyncWorkflowStateMutationAttributes{ sync_state_retriever.go
232 > SyncWorkflowStateMutationAttributes: &replicationspb.SyncWorkflowStateMutationAttributes{
233 > StateMutation: mutation,
234 > ExclusiveStartVersionedTransition: targetCurrentVersionedTransition,
235 > },
236 > }
237 } else {
238 snapshot, err := s.getSnapshot(mutableState)
384 mutableState historyi.MutableState,
385 exclusiveMinVT *persistencespb.VersionedTransition,
386 > ) (*persistencespb.WorkflowMutableStateMutation, error) { sync_state_retriever.go
387 > rootNode := mutableState.HSM()
388 > updatedStateMachine, err := s.getUpdatedSubStateMachine(rootNode, exclusiveMinVT)
389 > if err != nil {
390 return nil, err
391 }
392
393 > executionInfo := mutableState.GetExecutionInfo() sync_state_retriever.go
394 > tombstoneBatch := executionInfo.SubStateMachineTombstoneBatches
395 > var tombstones []*persistencespb.StateMachineTombstoneBatch
396 > for i, tombstone := range tombstoneBatch {
397 > if transitionhistory.Compare(tombstone.VersionedTransition, exclusiveMinVT) > 0 {
398 tombstones = tombstoneBatch[i:]
399 break
401 }
402
403 > var signalRequestedIds []string sync_state_retriever.go
404 > if transitionhistory.Compare(executionInfo.SignalRequestIdsLastUpdateVersionedTransition, exclusiveMinVT) > 0 {
405 signalRequestedIds = mutableState.GetPendingSignalRequestedIds()
406 }
407
408 > mutation := &persistencespb.WorkflowMutableStateMutation{ sync_state_retriever.go
409 > UpdatedActivityInfos: getUpdatedInfo(mutableState.GetPendingActivityInfos(), exclusiveMinVT),
410 > UpdatedTimerInfos: getUpdatedInfo(mutableState.GetPendingTimerInfos(), exclusiveMinVT),
411 > UpdatedChildExecutionInfos: getUpdatedInfo(mutableState.GetPendingChildExecutionInfos(), exclusiveMinVT),
412 > UpdatedRequestCancelInfos: getUpdatedInfo(mutableState.GetPendingRequestCancelExternalInfos(), exclusiveMinVT),
413 > UpdatedSignalInfos: getUpdatedInfo(mutableState.GetPendingSignalExternalInfos(), exclusiveMinVT),
414 > UpdatedUpdateInfos: getUpdatedInfo(executionInfo.UpdateInfos, exclusiveMinVT),
415 > UpdatedChasmNodes: mutableState.ChasmTree().Snapshot(exclusiveMinVT).Nodes,
416 > UpdatedSubStateMachines: updatedStateMachine,
417 > SubStateMachineTombstoneBatches: tombstones,
418 > SignalRequestedIds: signalRequestedIds,
419 > ExecutionInfo: executionInfo,
420 > ExecutionState: mutableState.GetExecutionState(),
421 > }
422 >
423 > mutation = common.CloneProto(mutation)
424 > workflow.SanitizeMutableStateMutation(mutation)
425 > if err := common.DiscardUnknownProto(mutation); err != nil {
426 return nil, err
427 }
428
429 > mutation.ExecutionInfo.UpdateInfos = nil sync_state_retriever.go
430 > mutation.ExecutionInfo.SubStateMachinesByType = nil
431 > mutation.ExecutionInfo.SubStateMachineTombstoneBatches = nil
432 > return mutation, nil
433 }
434
558 }
559
560 > func getUpdatedInfo[K comparable, V lastUpdatedStateTransitionGetter](subStateMachine map[K]V, versionedTransition *persistencespb.VersionedTransition) map[K]V { sync_state_retriever.go
561 > result := make(map[K]V)
562 > for k, v := range subStateMachine {
563 if isInfoUpdated(v, versionedTransition) {
564 result[k] = v
565 }
566 }
567 > return result sync_state_retriever.go
568 }
569
go.temporal.io/server/service/history/interfaces/chasm_tree_mock.go 10 introduced LOC · 2 ranges

Open complete file

275
276 // Snapshot mocks base method.
277 > func (m *MockChasmTree) Snapshot(arg0 *persistence.VersionedTransition) chasm.NodesSnapshot { chasm_tree_mock.go
278 > m.ctrl.T.Helper()
279 > ret := m.ctrl.Call(m, "Snapshot", arg0)
280 > ret0, _ := ret[0].(chasm.NodesSnapshot)
281 > return ret0
282 > }
283
284 // Snapshot indicates an expected call of Snapshot.
285 > func (mr *MockChasmTreeMockRecorder) Snapshot(arg0 any) *gomock.Call { chasm_tree_mock.go
286 > mr.mock.ctrl.T.Helper()
287 > return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Snapshot", reflect.TypeOf((*MockChasmTree)(nil).Snapshot), arg0)
288 > }
289
290 // Terminate mocks base method.
go.temporal.io/server/api/persistence/v1/workflow_mutable_state.pb.go 9 introduced LOC · 3 ranges

Open complete file

195 mi := &file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_msgTypes[1]
196 if x != nil {
197 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) workflow_mutable_state.pb.go
198 > if ms.LoadMessageInfo() == nil {
199 > ms.StoreMessageInfo(mi)
200 > }
201 > return ms
202 }
203 return mi.MessageOf(x)
316 func (*WorkflowMutableStateMutation_StateMachineNodeMutation) ProtoMessage() {}
317
318 > func (x *WorkflowMutableStateMutation_StateMachineNodeMutation) ProtoReflect() protoreflect.Message { workflow_mutable_state.pb.go
319 > mi := &file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_msgTypes[8]
320 > if x != nil {
321 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
322 if ms.LoadMessageInfo() == nil {
go.temporal.io/server/service/history/workflow/mutable_state_util.go 4 introduced LOC · 1 range

Open complete file

51 func SanitizeMutableStateMutation(
52 mutableStateMutation *persistencespb.WorkflowMutableStateMutation,
54 > sanitizeExecutionInfo(mutableStateMutation.ExecutionInfo)
55 > sanitizeChildExecutionInfo(mutableStateMutation.UpdatedChildExecutionInfos)
56 > }
57
58 func sanitizeExecutionInfo(
go.temporal.io/server/service/history/hsm/tree.go 2 introduced LOC · 1 range

Open complete file

287 func (n *Node) Walk(fn func(*Node) error) error {
288 if n == nil {
289 > return nil tree.go
290 > }
291
292 if err := fn(n); err != nil {