Atlas › Test

TestConflictResolve_Zombie_WithNew

Exact test identity: go.temporal.io/server/common/persistence/tests/TestCassandraExecutionMutableStateStoreSuite/TestConflictResolve_Zombie_WithNew

Package
go.temporal.io/server/common/persistence/tests
Suite / test hierarchy
TestCassandraExecutionMutableStateStoreSuite/TestConflictResolve_Zombie_WithNew
Test
TestConflictResolve_Zombie_WithNew
Introduced at
TestConflictResolve_Zombie_WithNew Frontier kind: Test frontier
Covered ranges
1282
Covered lines
6525
Covered files
193

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/persistence/cassandra/util.go 493 covered LOC · 73 ranges

Open complete file

145 shardID int32,
146 workflowSnapshot *p.InternalWorkflowSnapshot,
147 > ) error { util.go
148 >
149 > // TODO: update call site
150 > // cqlNowTimestampMillis := p.UnixMilliseconds(time.Now().UTC())
151 >
152 > namespaceID := workflowSnapshot.NamespaceID
153 > workflowID := workflowSnapshot.WorkflowID
154 > runID := workflowSnapshot.RunID
155 >
156 > if err := updateExecution(
157 > batch,
158 > shardID,
159 > namespaceID,
160 > workflowID,
161 > runID,
162 > workflowSnapshot.ExecutionInfoBlob,
163 > workflowSnapshot.ExecutionState,
164 > workflowSnapshot.ExecutionStateBlob,
165 > workflowSnapshot.NextEventID,
166 > workflowSnapshot.Condition,
167 > workflowSnapshot.DBRecordVersion,
168 > workflowSnapshot.Checksum,
169 > ); err != nil {
170 return err
171 }
172
173 > if err := resetActivityInfos( util.go
174 > batch,
175 > workflowSnapshot.ActivityInfos,
176 > shardID,
177 > namespaceID,
178 > workflowID,
179 > runID,
180 > ); err != nil {
181 return err
182 }
183
184 > if err := resetTimerInfos( util.go
185 > batch,
186 > workflowSnapshot.TimerInfos,
187 > shardID,
188 > namespaceID,
189 > workflowID,
190 > runID,
191 > ); err != nil {
192 return err
193 }
194
195 > if err := resetChildExecutionInfos( util.go
196 > batch,
197 > workflowSnapshot.ChildExecutionInfos,
198 > shardID,
199 > namespaceID,
200 > workflowID,
201 > runID,
202 > ); err != nil {
203 return err
204 }
205
206 > if err := resetRequestCancelInfos( util.go
207 > batch,
208 > workflowSnapshot.RequestCancelInfos,
209 > shardID,
210 > namespaceID,
211 > workflowID,
212 > runID,
213 > ); err != nil {
214 return err
215 }
216
217 > if err := resetSignalInfos( util.go
218 > batch,
219 > workflowSnapshot.SignalInfos,
220 > shardID,
221 > namespaceID,
222 > workflowID,
223 > runID,
224 > ); err != nil {
225 return err
226 }
227
228 > if err := resetChasmNodes( util.go
229 > batch,
230 > workflowSnapshot.ChasmNodes,
231 > shardID,
232 > namespaceID,
233 > workflowID,
234 > runID,
235 > ); err != nil {
236 return err
237 }
238
239 > resetSignalRequested( util.go
240 > batch,
241 > workflowSnapshot.SignalRequestedIDs,
242 > shardID,
243 > namespaceID,
244 > workflowID,
245 > runID,
246 > )
247 >
248 > deleteBufferedEvents(
249 > batch,
250 > shardID,
251 > namespaceID,
252 > workflowID,
253 > runID,
254 > )
255 >
256 > // transfer / replication / timer tasks
257 > return applyTasks(
258 > batch,
259 > shardID,
260 > workflowSnapshot.Tasks,
261 > )
262 }
263
266 shardID int32,
267 workflowSnapshot *p.InternalWorkflowSnapshot,
268 > ) error { util.go
269 > namespaceID := workflowSnapshot.NamespaceID
270 > workflowID := workflowSnapshot.WorkflowID
271 > runID := workflowSnapshot.RunID
272 >
273 > if err := createExecution(
274 > batch,
275 > shardID,
276 > workflowSnapshot,
277 > ); err != nil {
278 return err
279 }
280
281 > if err := updateActivityInfos( util.go
282 > batch,
283 > workflowSnapshot.ActivityInfos,
284 > nil,
285 > shardID,
286 > namespaceID,
287 > workflowID,
288 > runID,
289 > ); err != nil {
290 return err
291 }
292
293 > if err := updateTimerInfos( util.go
294 > batch,
295 > workflowSnapshot.TimerInfos,
296 > nil,
297 > shardID,
298 > namespaceID,
299 > workflowID,
300 > runID,
301 > ); err != nil {
302 return err
303 }
304
305 > if err := updateChildExecutionInfos( util.go
306 > batch,
307 > workflowSnapshot.ChildExecutionInfos,
308 > nil,
309 > shardID,
310 > namespaceID,
311 > workflowID,
312 > runID,
313 > ); err != nil {
314 return err
315 }
316
317 > if err := updateRequestCancelInfos( util.go
318 > batch,
319 > workflowSnapshot.RequestCancelInfos,
320 > nil,
321 > shardID,
322 > namespaceID,
323 > workflowID,
324 > runID,
325 > ); err != nil {
326 return err
327 }
328
329 > if err := updateSignalInfos( util.go
330 > batch,
331 > workflowSnapshot.SignalInfos,
332 > nil,
333 > shardID,
334 > namespaceID,
335 > workflowID,
336 > runID,
337 > ); err != nil {
338 return err
339 }
340
341 > if err := updateChasmNodes( util.go
342 > batch,
343 > workflowSnapshot.ChasmNodes,
344 > nil,
345 > shardID,
346 > namespaceID,
347 > workflowID,
348 > runID,
349 > ); err != nil {
350 return err
351 }
352
353 > updateSignalsRequested( util.go
354 > batch,
355 > workflowSnapshot.SignalRequestedIDs,
356 > nil,
357 > shardID,
358 > namespaceID,
359 > workflowID,
360 > runID,
361 > )
362 >
363 > // transfer / replication / timer tasks
364 > return applyTasks(
365 > batch,
366 > shardID,
367 > workflowSnapshot.Tasks,
368 > )
369 }
370
373 shardID int32,
374 snapshot *p.InternalWorkflowSnapshot,
375 > ) error { util.go
376 > // validate workflow state & close status
377 > if err := p.ValidateCreateWorkflowStateStatus(
378 > snapshot.ExecutionState.State,
379 > snapshot.ExecutionState.Status); err != nil {
380 return err
381 }
382
383 // TODO also need to set the start / current / last write version
384 > batch.Query(templateCreateWorkflowExecutionQuery, util.go
385 > shardID,
386 > snapshot.NamespaceID,
387 > snapshot.WorkflowID,
388 > snapshot.RunID,
389 > rowTypeExecution,
390 > snapshot.ExecutionInfoBlob.Data,
391 > snapshot.ExecutionInfoBlob.EncodingType.String(),
392 > snapshot.ExecutionStateBlob.Data,
393 > snapshot.ExecutionStateBlob.EncodingType.String(),
394 > snapshot.NextEventID,
395 > snapshot.DBRecordVersion,
396 > defaultVisibilityTimestamp,
397 > rowTypeExecutionTaskID,
398 > snapshot.Checksum.Data,
399 > snapshot.Checksum.EncodingType.String(),
400 > )
401 >
402 > return nil
403 }
404
416 dbRecordVersion int64,
417 checksumBlob *commonpb.DataBlob,
418 > ) error { util.go
419 >
420 > // validate workflow state & close status
421 > if err := p.ValidateUpdateWorkflowStateStatus(
422 > executionState.State,
423 > executionState.Status); err != nil {
424 return err
425 }
426
427 > if dbRecordVersion == 0 { util.go
428 batch.Query(templateUpdateWorkflowExecutionQueryDeprecated,
429 executionInfoBlob.Data,
444 condition,
445 )
446 > } else { util.go
447 > batch.Query(templateUpdateWorkflowExecutionQuery,
448 > executionInfoBlob.Data,
449 > executionInfoBlob.EncodingType.String(),
450 > executionStateBlob.Data,
451 > executionStateBlob.EncodingType.String(),
452 > nextEventID,
453 > dbRecordVersion,
454 > checksumBlob.Data,
455 > checksumBlob.EncodingType.String(),
456 > shardID,
457 > rowTypeExecution,
458 > namespaceID,
459 > workflowID,
460 > runID,
461 > defaultVisibilityTimestamp,
462 > rowTypeExecutionTaskID,
463 > dbRecordVersion-1,
464 > )
465 > }
466
467 > return nil util.go
468 }
469
472 shardID int32,
473 insertTasks map[tasks.Category][]p.InternalHistoryTask,
474 > ) error { util.go
475 >
476 > var err error
477 > for category, tasksByCategory := range insertTasks {
478 > switch category.ID() {
479 > case tasks.CategoryIDTransfer: util.go
480 > err = createTransferTasks(batch, tasksByCategory, shardID)
481 > case tasks.CategoryIDTimer: util.go
482 > err = createTimerTasks(batch, tasksByCategory, shardID)
483 > case tasks.CategoryIDVisibility: util.go
484 > err = createVisibilityTasks(batch, tasksByCategory, shardID)
485 > case tasks.CategoryIDReplication: util.go
486 > err = createReplicationTasks(batch, tasksByCategory, shardID)
487 default:
488 err = createHistoryTasks(batch, category, tasksByCategory, shardID)
489 }
490
491 > if err != nil { util.go
492 return err
493 }
494 }
495
496 > return nil util.go
497 }
498
501 transferTasks []p.InternalHistoryTask,
502 shardID int32,
503 > ) error { util.go
504 > for _, task := range transferTasks {
505 batch.Query(templateCreateTransferTaskQuery,
506 shardID,
515 )
516 }
517 > return nil util.go
518 }
519
522 timerTasks []p.InternalHistoryTask,
523 shardID int32,
524 > ) error { util.go
525 > for _, task := range timerTasks {
526 batch.Query(templateCreateTimerTaskQuery,
527 shardID,
536 )
537 }
538 > return nil util.go
539 }
540
543 replicationTasks []p.InternalHistoryTask,
544 shardID int32,
545 > ) error { util.go
546 > for _, task := range replicationTasks {
547 batch.Query(templateCreateReplicationTaskQuery,
548 shardID,
557 )
558 }
559 > return nil util.go
560 }
561
564 visibilityTasks []p.InternalHistoryTask,
565 shardID int32,
566 > ) error { util.go
567 > for _, task := range visibilityTasks {
568 batch.Query(templateCreateVisibilityTaskQuery,
569 shardID,
578 )
579 }
580 > return nil util.go
581 }
582
616 workflowID string,
617 runID string,
618 > ) error { util.go
619 >
620 > for scheduledEventID, blob := range activityInfos {
621 > batch.Query(templateUpdateActivityInfoQuery,
622 > scheduledEventID,
623 > blob.Data,
624 > blob.EncodingType.String(),
625 > shardID,
626 > rowTypeExecution,
627 > namespaceID,
628 > workflowID,
629 > runID,
630 > defaultVisibilityTimestamp,
631 > rowTypeExecutionTaskID)
632 > }
633
634 > for deleteID := range deleteIDs { util.go
635 batch.Query(templateDeleteActivityInfoQuery,
636 deleteID,
643 rowTypeExecutionTaskID)
644 }
645 > return nil util.go
646 }
647
652 workflowID string,
653 runID string,
654 > ) { util.go
655 > batch.Query(templateDeleteBufferedEventsQuery,
656 > shardID,
657 > rowTypeExecution,
658 > namespaceID,
659 > workflowID,
660 > runID,
661 > defaultVisibilityTimestamp,
662 > rowTypeExecutionTaskID,
663 > )
664 > }
665
666 func resetActivityInfos(
671 workflowID string,
672 runID string,
673 > ) error { util.go
674 > infoMap, encoding, err := convertBlobMapToByteMap(activityInfos)
675 > if err != nil {
676 return err
677 }
678
679 > batch.Query(templateResetActivityInfoQuery, util.go
680 > infoMap,
681 > encoding.String(),
682 > shardID,
683 > rowTypeExecution,
684 > namespaceID,
685 > workflowID,
686 > runID,
687 > defaultVisibilityTimestamp,
688 > rowTypeExecutionTaskID)
689 >
690 > return nil
691 }
692
699 workflowID string,
700 runID string,
701 > ) error { util.go
702 > for timerID, blob := range timerInfos {
703 > batch.Query(templateUpdateTimerInfoQuery,
704 > timerID,
705 > blob.Data,
706 > blob.EncodingType.String(),
707 > shardID,
708 > rowTypeExecution,
709 > namespaceID,
710 > workflowID,
711 > runID,
712 > defaultVisibilityTimestamp,
713 > rowTypeExecutionTaskID)
714 > }
715
716 > for deleteInfoID := range deleteInfos { util.go
717 batch.Query(templateDeleteTimerInfoQuery,
718 deleteInfoID,
726 }
727
728 > return nil util.go
729 }
730
736 workflowID string,
737 runID string,
738 > ) error { util.go
739 > timerMap, timerMapEncoding, err := convertBlobMapToByteMap(timerInfos)
740 > if err != nil {
741 return err
742 }
743
744 > batch.Query(templateResetTimerInfoQuery, util.go
745 > timerMap,
746 > timerMapEncoding.String(),
747 > shardID,
748 > rowTypeExecution,
749 > namespaceID,
750 > workflowID,
751 > runID,
752 > defaultVisibilityTimestamp,
753 > rowTypeExecutionTaskID)
754 >
755 > return nil
756 }
757
764 workflowID string,
765 runID string,
766 > ) error { util.go
767 >
768 > for initiatedId, blob := range childExecutionInfos {
769 > batch.Query(templateUpdateChildExecutionInfoQuery,
770 > initiatedId,
771 > blob.Data,
772 > blob.EncodingType.String(),
773 > shardID,
774 > rowTypeExecution,
775 > namespaceID,
776 > workflowID,
777 > runID,
778 > defaultVisibilityTimestamp,
779 > rowTypeExecutionTaskID)
780 > }
781
782 > for deleteID := range deleteIDs { util.go
783 batch.Query(templateDeleteChildExecutionInfoQuery,
784 deleteID,
791 rowTypeExecutionTaskID)
792 }
793 > return nil util.go
794 }
795
801 workflowID string,
802 runID string,
803 > ) error { util.go
804 > infoMap, encoding, err := convertBlobMapToByteMap(childExecutionInfos)
805 > if err != nil {
806 return err
807 }
808
809 > batch.Query(templateResetChildExecutionInfoQuery, util.go
810 > infoMap,
811 > encoding.String(),
812 > shardID,
813 > rowTypeExecution,
814 > namespaceID,
815 > workflowID,
816 > runID,
817 > defaultVisibilityTimestamp,
818 > rowTypeExecutionTaskID)
819 >
820 > return nil
821 }
822
829 workflowID string,
830 runID string,
831 > ) error { util.go
832 >
833 > for initiatedId, blob := range requestCancelInfos {
834 > batch.Query(templateUpdateRequestCancelInfoQuery,
835 > initiatedId,
836 > blob.Data,
837 > blob.EncodingType.String(),
838 > shardID,
839 > rowTypeExecution,
840 > namespaceID,
841 > workflowID,
842 > runID,
843 > defaultVisibilityTimestamp,
844 > rowTypeExecutionTaskID)
845 > }
846
847 > for deleteID := range deleteIDs { util.go
848 batch.Query(templateDeleteRequestCancelInfoQuery,
849 deleteID,
856 rowTypeExecutionTaskID)
857 }
858 > return nil util.go
859 }
860
866 workflowID string,
867 runID string,
868 > ) error { util.go
869 > rciMap, rciMapEncoding, err := convertBlobMapToByteMap(requestCancelInfos)
870 > if err != nil {
871 return err
872 }
873
874 > batch.Query(templateResetRequestCancelInfoQuery, util.go
875 > rciMap,
876 > rciMapEncoding.String(),
877 > shardID,
878 > rowTypeExecution,
879 > namespaceID,
880 > workflowID,
881 > runID,
882 > defaultVisibilityTimestamp,
883 > rowTypeExecutionTaskID)
884 >
885 > return nil
886 }
887
894 workflowID string,
895 runID string,
896 > ) error { util.go
897 >
898 > for initiatedId, blob := range signalInfos {
899 > batch.Query(templateUpdateSignalInfoQuery,
900 > initiatedId,
901 > blob.Data,
902 > blob.EncodingType.String(),
903 > shardID,
904 > rowTypeExecution,
905 > namespaceID,
906 > workflowID,
907 > runID,
908 > defaultVisibilityTimestamp,
909 > rowTypeExecutionTaskID)
910 > }
911
912 > for deleteID := range deleteIDs { util.go
913 batch.Query(templateDeleteSignalInfoQuery,
914 deleteID,
921 rowTypeExecutionTaskID)
922 }
923 > return nil util.go
924 }
925
931 workflowID string,
932 runID string,
933 > ) error { util.go
934 > sMap, sMapEncoding, err := convertBlobMapToByteMap(signalInfos)
935 > if err != nil {
936 return err
937 }
938
939 > batch.Query(templateResetSignalInfoQuery, util.go
940 > sMap,
941 > sMapEncoding.String(),
942 > shardID,
943 > rowTypeExecution,
944 > namespaceID,
945 > workflowID,
946 > runID,
947 > defaultVisibilityTimestamp,
948 > rowTypeExecutionTaskID)
949 >
950 > return nil
951 }
952
958 workflowID string,
959 runID string,
960 > ) error { util.go
961 > blobMap := make(map[string][]byte, len(nodes))
962 > var encoding enumspb.EncodingType
963 > for path, node := range nodes {
964 > blobMap[path] = node.CassandraBlob.Data
965 > encoding = node.CassandraBlob.EncodingType // TODO - we only support a single encoding
966 > }
967
968 > batch.Query(templateResetChasmNodeQuery, util.go
969 > blobMap,
970 > encoding.String(),
971 > shardID,
972 > rowTypeExecution,
973 > namespaceID,
974 > workflowID,
975 > runID,
976 > defaultVisibilityTimestamp,
977 > rowTypeExecutionTaskID)
978 >
979 > return nil
980 }
981
988 workflowID string,
989 runID string,
990 > ) error { util.go
991 > for deletePath := range deleteNodes {
992 batch.Query(templateDeleteChasmNodeQuery,
993 deletePath,
1001 }
1002
1003 > for upsertPath, node := range upsertNodes { util.go
1004 > batch.Query(templateUpdateChasmNodeQuery,
1005 > upsertPath,
1006 > node.CassandraBlob.Data,
1007 > node.CassandraBlob.EncodingType.String(),
1008 > shardID,
1009 > rowTypeExecution,
1010 > namespaceID,
1011 > workflowID,
1012 > runID,
1013 > defaultVisibilityTimestamp,
1014 > rowTypeExecutionTaskID)
1015 > }
1016
1017 > return nil util.go
1018 }
1019
1026 workflowID string,
1027 runID string,
1028 > ) { util.go
1029 >
1030 > if len(signalReqIDs) > 0 {
1031 > batch.Query(templateUpdateSignalRequestedQuery,
1032 > convert.StringSetToSlice(signalReqIDs),
1033 > shardID,
1034 > rowTypeExecution,
1035 > namespaceID,
1036 > workflowID,
1037 > runID,
1038 > defaultVisibilityTimestamp,
1039 > rowTypeExecutionTaskID)
1040 > }
1041
1042 > if len(deleteSignalReqIDs) > 0 { util.go
1043 batch.Query(templateDeleteWorkflowExecutionSignalRequestedQuery,
1044 convert.StringSetToSlice(deleteSignalReqIDs),
1060 workflowID string,
1061 runID string,
1062 > ) { util.go
1063 >
1064 > batch.Query(templateResetSignalRequestedQuery,
1065 > convert.StringSetToSlice(signalRequested),
1066 > shardID,
1067 > rowTypeExecution,
1068 > namespaceID,
1069 > workflowID,
1070 > runID,
1071 > defaultVisibilityTimestamp,
1072 > rowTypeExecutionTaskID)
1073 > }
1074
1075 func updateBufferedEvents(
1112 func convertBlobMapToByteMap[T comparable](
1113 input map[T]*commonpb.DataBlob,
1114 > ) (map[T][]byte, enumspb.EncodingType, error) { util.go
1115 > sMap := make(map[T][]byte)
1116 >
1117 > var encoding enumspb.EncodingType
1118 > for key, blob := range input {
1119 > encoding = blob.EncodingType
1120 > sMap[key] = blob.Data
1121 > }
1122
1123 > return sMap, encoding, nil util.go
1124 }
1125
go.temporal.io/server/common/persistence/execution_manager.go 383 covered LOC · 113 ranges

Open complete file

48 transactionSizeLimit dynamicconfig.IntPropertyFn,
49 enableBestEffortDeleteTasksOnWorkflowUpdate dynamicconfig.BoolPropertyFn,
50 > ) ExecutionManager { execution_manager.go
51 > return &executionManagerImpl{
52 > serializer: serializer,
53 > eventBlobCache: eventBlobCache,
54 > persistence: persistence,
55 > logger: logger,
56 > pagingTokenSerializer: newJSONHistoryTokenSerializer(),
57 > transactionSizeLimit: transactionSizeLimit,
58 > enableBestEffortDeleteTasksOnWorkflowUpdate: enableBestEffortDeleteTasksOnWorkflowUpdate,
59 > }
60 > }
61
62 > func (m *executionManagerImpl) GetName() string { execution_manager.go
63 > return m.persistence.GetName()
64 > }
65
66 > func (m *executionManagerImpl) GetHistoryBranchUtil() HistoryBranchUtil { execution_manager.go
67 > return m.persistence.GetHistoryBranchUtil()
68 > }
69
70 // historySizeRollback records HistorySize increments applied to caller-owned ExecutionStats
85
86 // add applies sizeDiff to stats.HistorySize and remembers it so it can be reverted.
87 > func (r *historySizeRollback) add(stats *persistencespb.ExecutionStats, sizeDiff int) { execution_manager.go
88 > delta := int64(sizeDiff)
89 > stats.HistorySize += delta
90 > r.applied = append(r.applied, appliedHistorySize{stats: stats, delta: delta})
91 > }
92
93 // revertOnError undoes every applied increment if *err is non-nil. Intended to be deferred
94 // against a function's named return error.
95 > func (r *historySizeRollback) revertOnError(err *error) { execution_manager.go
96 > if *err == nil {
97 > return execution_manager.go
98 > }
99 for _, a := range r.applied {
100 a.stats.HistorySize -= a.delta
106 ctx context.Context,
107 request *CreateWorkflowExecutionRequest,
108 > ) (_ *CreateWorkflowExecutionResponse, retErr error) { execution_manager.go
109 >
110 > var rollback historySizeRollback
111 > defer rollback.revertOnError(&retErr)
112 >
113 > newSnapshot := request.NewWorkflowSnapshot
114 > newWorkflowXDCKVs, newWorkflowNewEvents, newHistoryDiff, err := m.serializeWorkflowEventBatches(
115 > ctx,
116 > request.ShardID,
117 > request.NewWorkflowSnapshot.ExecutionInfo,
118 > request.NewWorkflowEvents,
119 > )
120 > if err != nil {
121 return nil, err
122 }
123
124 > rollback.add(newSnapshot.ExecutionInfo.ExecutionStats, newHistoryDiff.SizeDiff) execution_manager.go
125 >
126 > if err := ValidateCreateWorkflowModeState(
127 > request.Mode,
128 > newSnapshot,
129 > ); err != nil {
130 return nil, err
131 }
132 > if err := ValidateCreateWorkflowStateStatus( execution_manager.go
133 > newSnapshot.ExecutionState.State,
134 > newSnapshot.ExecutionState.Status,
135 > ); err != nil {
136 return nil, err
137 }
138
139 > serializedNewWorkflowSnapshot, err := m.SerializeWorkflowSnapshot(&newSnapshot) execution_manager.go
140 > if err != nil {
141 return nil, err
142 }
143
144 > archetypeID, _ := m.assertAndConvertArchetypeID(request.ArchetypeID, "CreateWorkflowExecution") execution_manager.go
145 > newRequest := &InternalCreateWorkflowExecutionRequest{
146 > ShardID: request.ShardID,
147 > RangeID: request.RangeID,
148 > Mode: request.Mode,
149 > PreviousRunID: request.PreviousRunID,
150 > PreviousLastWriteVersion: request.PreviousLastWriteVersion,
151 > ArchetypeID: archetypeID,
152 > NewWorkflowSnapshot: *serializedNewWorkflowSnapshot,
153 > NewWorkflowNewEvents: newWorkflowNewEvents,
154 > }
155 >
156 > if _, err := m.persistence.CreateWorkflowExecution(ctx, newRequest); err != nil {
157 return nil, err
158 }
159 > m.addXDCCacheKV(newWorkflowXDCKVs) execution_manager.go
160 > return &CreateWorkflowExecutionResponse{
161 > NewMutableStateStats: *statusOfInternalWorkflowSnapshot(
162 > serializedNewWorkflowSnapshot,
163 > newHistoryDiff,
164 > ),
165 > }, nil
166 }
167
313 ctx context.Context,
314 request *ConflictResolveWorkflowExecutionRequest,
315 > ) (_ *ConflictResolveWorkflowExecutionResponse, retErr error) { execution_manager.go
316 >
317 > var rollback historySizeRollback
318 > defer rollback.revertOnError(&retErr)
319 >
320 > resetSnapshot := request.ResetWorkflowSnapshot
321 > newSnapshot := request.NewWorkflowSnapshot
322 > currentMutation := request.CurrentWorkflowMutation
323 >
324 > resetWorkflowXDCKVs, resetWorkflowEvents, resetWorkflowHistoryDiff, err := m.serializeWorkflowEventBatches(
325 > ctx,
326 > request.ShardID,
327 > request.ResetWorkflowSnapshot.ExecutionInfo,
328 > request.ResetWorkflowEvents,
329 > )
330 > if err != nil {
331 return nil, err
332 }
333 > rollback.add(resetSnapshot.ExecutionInfo.ExecutionStats, resetWorkflowHistoryDiff.SizeDiff) execution_manager.go
334 >
335 > var newWorkflowXDCKVs map[XDCCacheKey]XDCCacheValue
336 > var newWorkflowEvents []*InternalAppendHistoryNodesRequest
337 > var newWorkflowHistoryDiff *HistoryStatistics
338 > if newSnapshot != nil {
339 > newWorkflowXDCKVs, newWorkflowEvents, newWorkflowHistoryDiff, err = m.serializeWorkflowEventBatches( execution_manager.go
340 > ctx,
341 > request.ShardID,
342 > request.NewWorkflowSnapshot.ExecutionInfo,
343 > request.NewWorkflowEvents,
344 > )
345 > if err != nil {
346 return nil, err
347 }
348 > rollback.add(newSnapshot.ExecutionInfo.ExecutionStats, newWorkflowHistoryDiff.SizeDiff) execution_manager.go
349 }
350
351 > var currentWorkflowXDCKVs map[XDCCacheKey]XDCCacheValue execution_manager.go
352 > var currentWorkflowEvents []*InternalAppendHistoryNodesRequest
353 > var currentWorkflowHistoryDiff *HistoryStatistics
354 > if currentMutation != nil {
355 currentWorkflowXDCKVs, currentWorkflowEvents, currentWorkflowHistoryDiff, err = m.serializeWorkflowEventBatches(
356 ctx,
365 }
366
367 > if err := ValidateConflictResolveWorkflowModeState( execution_manager.go
368 > request.Mode,
369 > resetSnapshot,
370 > newSnapshot,
371 > currentMutation,
372 > ); err != nil {
373 return nil, err
374 }
375
376 > serializedResetWorkflowSnapshot, err := m.SerializeWorkflowSnapshot(&resetSnapshot) execution_manager.go
377 > if err != nil {
378 return nil, err
379 }
380 > var serializedCurrentWorkflowMutation *InternalWorkflowMutation execution_manager.go
381 > if currentMutation != nil {
382 serializedCurrentWorkflowMutation, err = m.SerializeWorkflowMutation(currentMutation)
383 if err != nil {
385 }
386 }
387 > var serializedNewWorkflowMutation *InternalWorkflowSnapshot execution_manager.go
388 > if newSnapshot != nil {
389 > serializedNewWorkflowMutation, err = m.SerializeWorkflowSnapshot(newSnapshot) execution_manager.go
390 > if err != nil {
391 return nil, err
392 }
393 }
394
395 > archetypeID, _ := m.assertAndConvertArchetypeID(request.ArchetypeID, "ConflictResolveWorkflowExecution") execution_manager.go
396 > newRequest := &InternalConflictResolveWorkflowExecutionRequest{
397 > ShardID: request.ShardID,
398 > RangeID: request.RangeID,
399 >
400 > Mode: request.Mode,
401 >
402 > ArchetypeID: archetypeID,
403 >
404 > ResetWorkflowSnapshot: *serializedResetWorkflowSnapshot,
405 > ResetWorkflowEventsNewEvents: resetWorkflowEvents,
406 >
407 > NewWorkflowSnapshot: serializedNewWorkflowMutation,
408 > NewWorkflowEventsNewEvents: newWorkflowEvents,
409 >
410 > CurrentWorkflowMutation: serializedCurrentWorkflowMutation,
411 > CurrentWorkflowEventsNewEvents: currentWorkflowEvents,
412 > }
413 >
414 > err = m.persistence.ConflictResolveWorkflowExecution(ctx, newRequest)
415 > switch err.(type) {
416 > case nil: execution_manager.go
417 > m.addXDCCacheKV(resetWorkflowXDCKVs)
418 > m.addXDCCacheKV(newWorkflowXDCKVs)
419 > m.addXDCCacheKV(currentWorkflowXDCKVs)
420 > return &ConflictResolveWorkflowExecutionResponse{
421 > ResetMutableStateStats: *statusOfInternalWorkflowSnapshot(
422 > &newRequest.ResetWorkflowSnapshot,
423 > resetWorkflowHistoryDiff,
424 > ),
425 > NewMutableStateStats: statusOfInternalWorkflowSnapshot(
426 > newRequest.NewWorkflowSnapshot,
427 > newWorkflowHistoryDiff,
428 > ),
429 > CurrentMutableStateStats: statusOfInternalWorkflowMutation(
430 > newRequest.CurrentWorkflowMutation,
431 > currentWorkflowHistoryDiff,
432 > ),
433 > }, nil
434 case *CurrentWorkflowConditionFailedError,
435 *WorkflowConditionFailedError,
462 ctx context.Context,
463 request *GetWorkflowExecutionRequest,
464 > ) (*GetWorkflowExecutionResponse, error) { execution_manager.go
465 > if archetypeID, converted := m.assertAndConvertArchetypeID(request.ArchetypeID, "GetWorkflowExecution"); converted {
466 request = &GetWorkflowExecutionRequest{
467 ShardID: request.ShardID,
472 }
473 }
474 > response, respErr := m.persistence.GetWorkflowExecution(ctx, request) execution_manager.go
475 >
476 > var notFound *serviceerror.NotFound
477 > if errors.As(respErr, &notFound) {
478 // strip persistence-specific error message
479 respErr = serviceerror.NewNotFoundf(
480 "workflow execution not found for workflow ID %q and run ID %q", request.WorkflowID, request.RunID)
481 }
482 > if respErr != nil && response == nil { execution_manager.go
483 // try to utilize resp as much as possible, for RebuildMutableState API
484 return nil, respErr
485 }
486 > state, err := m.toWorkflowMutableState(response.State) execution_manager.go
487 > if err != nil {
488 return nil, err
489 }
490 > if state.ExecutionInfo.ExecutionStats == nil { execution_manager.go
491 state.ExecutionInfo.ExecutionStats = &persistencespb.ExecutionStats{
492 HistorySize: 0,
494 }
495
496 > newResponse := &GetWorkflowExecutionResponse{ execution_manager.go
497 > State: state,
498 > DBRecordVersion: response.DBRecordVersion,
499 > MutableStateStats: *statusOfInternalWorkflow(response.State, state, nil),
500 > }
501 > return newResponse, respErr
502 }
503
533 executionInfo *persistencespb.WorkflowExecutionInfo,
534 eventBatches []*WorkflowEvents,
535 > ) (map[XDCCacheKey]XDCCacheValue, []*InternalAppendHistoryNodesRequest, *HistoryStatistics, error) { execution_manager.go
536 > var historyStatistics HistoryStatistics
537 > if len(eventBatches) == 0 {
538 return nil, nil, &historyStatistics, nil
539 }
540
541 > xdcKVs := make(map[XDCCacheKey]XDCCacheValue, len(eventBatches)) execution_manager.go
542 > workflowNewEvents := make([]*InternalAppendHistoryNodesRequest, 0, len(eventBatches))
543 > for _, workflowEvents := range eventBatches {
544 > newEvents, err := m.serializeWorkflowEvents(shardID, workflowEvents)
545 > if err != nil {
546 return nil, nil, nil, err
547 }
548 > versionHistoryItems, _, baseWorkflowInfo, err := GetXDCCacheValue( execution_manager.go
549 > executionInfo,
550 > workflowEvents.Events[0].EventId,
551 > workflowEvents.Events[0].Version,
552 > )
553 > if err != nil {
554 return nil, nil, nil, err
555 }
556 > xdcKVs[NewXDCCacheKey( execution_manager.go
557 > definition.NewWorkflowKey(workflowEvents.NamespaceID, workflowEvents.WorkflowID, workflowEvents.RunID),
558 > workflowEvents.Events[0].EventId,
559 > workflowEvents.Events[0].Version,
560 > )] = NewXDCCacheValue(
561 > baseWorkflowInfo,
562 > versionHistoryItems,
563 > []*commonpb.DataBlob{newEvents.Node.Events},
564 > workflowEvents.Events[len(workflowEvents.Events)-1].EventId+1,
565 > )
566 > newEvents.ShardID = shardID
567 > workflowNewEvents = append(workflowNewEvents, newEvents)
568 > historyStatistics.SizeDiff += len(newEvents.Node.Events.Data)
569 > historyStatistics.CountDiff += len(workflowEvents.Events)
570 }
571 > return xdcKVs, workflowNewEvents, &historyStatistics, nil execution_manager.go
572 }
573
574 func (m *executionManagerImpl) addXDCCacheKV(
575 xdcKVs map[XDCCacheKey]XDCCacheValue,
577 > if m.eventBlobCache == nil {
578 > return execution_manager.go
579 > }
580 for k, v := range xdcKVs {
581 m.eventBlobCache.Put(k, v)
585 func (m *executionManagerImpl) DeserializeBufferedEvents( // unexport
586 blobs []*commonpb.DataBlob,
587 > ) ([]*historypb.HistoryEvent, error) { execution_manager.go
588 >
589 > events := make([]*historypb.HistoryEvent, 0)
590 > for _, b := range blobs {
591 if b == nil {
592 // Should not happen, log and discard to prevent callers from consuming
601 events = append(events, history...)
602 }
603 > return events, nil execution_manager.go
604 }
605
607 shardID int32,
608 workflowEvents *WorkflowEvents,
609 > ) (*InternalAppendHistoryNodesRequest, error) { execution_manager.go
610 > if len(workflowEvents.Events) == 0 {
611 return nil, nil // allow update workflow without events
612 }
613
614 > request := &AppendHistoryNodesRequest{ execution_manager.go
615 > ShardID: shardID,
616 > BranchToken: workflowEvents.BranchToken,
617 > Events: workflowEvents.Events,
618 > PrevTransactionID: workflowEvents.PrevTxnID,
619 > TransactionID: workflowEvents.TxnID,
620 > }
621 >
622 > if workflowEvents.Events[0].EventId == common.FirstEventID {
623 > request.IsNewBranch = true execution_manager.go
624 > request.Info = BuildHistoryGarbageCleanupInfo(workflowEvents.NamespaceID, workflowEvents.WorkflowID, workflowEvents.RunID)
625 > }
626
627 > return m.serializeAppendHistoryNodesRequest(request) execution_manager.go
628 }
629
752 func (m *executionManagerImpl) SerializeWorkflowSnapshot( // unexport
753 input *WorkflowSnapshot,
754 > ) (*InternalWorkflowSnapshot, error) { execution_manager.go
755 > serializedTasks, err := serializeTasks(m.serializer, input.Tasks)
756 > if err != nil {
757 return nil, err
758 }
759
760 > result := &InternalWorkflowSnapshot{ execution_manager.go
761 > NamespaceID: input.ExecutionInfo.GetNamespaceId(),
762 > WorkflowID: input.ExecutionInfo.GetWorkflowId(),
763 > RunID: input.ExecutionState.GetRunId(),
764 >
765 > ActivityInfos: make(map[int64]*commonpb.DataBlob, len(input.ActivityInfos)),
766 > TimerInfos: make(map[string]*commonpb.DataBlob, len(input.TimerInfos)),
767 > ChildExecutionInfos: make(map[int64]*commonpb.DataBlob, len(input.ChildExecutionInfos)),
768 > RequestCancelInfos: make(map[int64]*commonpb.DataBlob, len(input.RequestCancelInfos)),
769 > SignalInfos: make(map[int64]*commonpb.DataBlob, len(input.SignalInfos)),
770 > ChasmNodes: make(map[string]InternalChasmNode, len(input.ChasmNodes)),
771 >
772 > ExecutionInfo: input.ExecutionInfo,
773 > ExecutionState: input.ExecutionState,
774 > SignalRequestedIDs: make(map[string]struct{}),
775 >
776 > Tasks: serializedTasks,
777 >
778 > Condition: input.Condition,
779 > DBRecordVersion: input.DBRecordVersion,
780 > NextEventID: input.NextEventID,
781 > }
782 >
783 > result.ExecutionInfoBlob, err = m.serializer.WorkflowExecutionInfoToBlob(input.ExecutionInfo)
784 > if err != nil {
785 return nil, err
786 }
787 > result.ExecutionStateBlob, err = m.serializer.WorkflowExecutionStateToBlob(input.ExecutionState) execution_manager.go
788 > if err != nil {
789 return nil, err
790 }
791 > result.LastWriteVersion, err = getCurrentBranchLastWriteVersion(input.ExecutionInfo.VersionHistories, input.ExecutionInfo.TransitionHistory) execution_manager.go
792 > if err != nil {
793 return nil, err
794 }
795
796 > for key, info := range input.ActivityInfos { execution_manager.go
797 > blob, err := m.serializer.ActivityInfoToBlob(info) execution_manager.go
798 > if err != nil {
799 return nil, err
800 }
801 > result.ActivityInfos[key] = blob execution_manager.go
802 }
803 > for key, info := range input.TimerInfos { execution_manager.go
804 > blob, err := m.serializer.TimerInfoToBlob(info) execution_manager.go
805 > if err != nil {
806 return nil, err
807 }
808 > result.TimerInfos[key] = blob execution_manager.go
809 }
810 > for key, info := range input.ChildExecutionInfos { execution_manager.go
811 > blob, err := m.serializer.ChildExecutionInfoToBlob(info) execution_manager.go
812 > if err != nil {
813 return nil, err
814 }
815 > result.ChildExecutionInfos[key] = blob execution_manager.go
816 }
817 > for key, info := range input.RequestCancelInfos { execution_manager.go
818 > blob, err := m.serializer.RequestCancelInfoToBlob(info) execution_manager.go
819 > if err != nil {
820 return nil, err
821 }
822 > result.RequestCancelInfos[key] = blob execution_manager.go
823 }
824 > for key, info := range input.SignalInfos { execution_manager.go
825 > blob, err := m.serializer.SignalInfoToBlob(info) execution_manager.go
826 > if err != nil {
827 return nil, err
828 }
829 > result.SignalInfos[key] = blob execution_manager.go
830 }
831 > for key := range input.SignalRequestedIDs { execution_manager.go
832 > result.SignalRequestedIDs[key] = struct{}{} execution_manager.go
833 > }
834 > nodeMap, err := m.makeInternalChasmNodeMap(input.ChasmNodes) execution_manager.go
835 > if err != nil {
836 return nil, err
837 }
838 > result.ChasmNodes = nodeMap execution_manager.go
839 >
840 > result.Checksum, err = m.serializer.ChecksumToBlob(input.Checksum)
841 > if err != nil {
842 return nil, err
843 }
844
845 > return result, nil execution_manager.go
846 }
847
1142 }
1143
1144 > func (m *executionManagerImpl) toWorkflowMutableState(internState *InternalWorkflowMutableState) (*persistencespb.WorkflowMutableState, error) { execution_manager.go
1145 > state := &persistencespb.WorkflowMutableState{
1146 > ActivityInfos: make(map[int64]*persistencespb.ActivityInfo),
1147 > TimerInfos: make(map[string]*persistencespb.TimerInfo),
1148 > ChildExecutionInfos: make(map[int64]*persistencespb.ChildExecutionInfo),
1149 > RequestCancelInfos: make(map[int64]*persistencespb.RequestCancelInfo),
1150 > SignalInfos: make(map[int64]*persistencespb.SignalInfo),
1151 > ChasmNodes: make(map[string]*persistencespb.ChasmNode),
1152 > SignalRequestedIds: internState.SignalRequestedIDs,
1153 > NextEventId: internState.NextEventID,
1154 > BufferedEvents: make([]*historypb.HistoryEvent, len(internState.BufferedEvents)),
1155 > }
1156 > for key, blob := range internState.ActivityInfos {
1157 > info, err := m.serializer.ActivityInfoFromBlob(blob) execution_manager.go
1158 > if err != nil {
1159 return nil, err
1160 }
1161 > state.ActivityInfos[key] = info execution_manager.go
1162 }
1163 > for key, blob := range internState.TimerInfos { execution_manager.go
1164 > info, err := m.serializer.TimerInfoFromBlob(blob) execution_manager.go
1165 > if err != nil {
1166 return nil, err
1167 }
1168 > state.TimerInfos[key] = info execution_manager.go
1169 }
1170 > for key, blob := range internState.ChildExecutionInfos { execution_manager.go
1171 > info, err := m.serializer.ChildExecutionInfoFromBlob(blob) execution_manager.go
1172 > if err != nil {
1173 return nil, err
1174 }
1175 > state.ChildExecutionInfos[key] = info execution_manager.go
1176 }
1177 > for key, blob := range internState.RequestCancelInfos { execution_manager.go
1178 > info, err := m.serializer.RequestCancelInfoFromBlob(blob) execution_manager.go
1179 > if err != nil {
1180 return nil, err
1181 }
1182 > state.RequestCancelInfos[key] = info execution_manager.go
1183 }
1184 > for key, blob := range internState.SignalInfos { execution_manager.go
1185 > info, err := m.serializer.SignalInfoFromBlob(blob) execution_manager.go
1186 > if err != nil {
1187 return nil, err
1188 }
1189 > state.SignalInfos[key] = info execution_manager.go
1190 }
1191 > for key, internal := range internState.ChasmNodes { execution_manager.go
1192 > var node *persistencespb.ChasmNode execution_manager.go
1193 > var err error
1194 >
1195 > if internal.CassandraBlob != nil {
1196 > node, err = m.serializer.ChasmNodeFromBlob(internal.CassandraBlob) execution_manager.go
1197 > } else { execution_manager.go
1198 node, err = m.serializer.ChasmNodeFromBlobs(internal.Metadata, internal.Data)
1199 }
1200 > if err != nil { execution_manager.go
1201 return nil, err
1202 }
1203
1204 > state.ChasmNodes[key] = node execution_manager.go
1205 }
1206 > var err error execution_manager.go
1207 > state.ExecutionInfo, err = m.serializer.WorkflowExecutionInfoFromBlob(internState.ExecutionInfo)
1208 > if err != nil {
1209 return nil, err
1210 }
1211 > if state.ExecutionInfo.AutoResetPoints == nil { execution_manager.go
1212 // TODO: check if we need this?
1213 state.ExecutionInfo.AutoResetPoints = &workflowpb.ResetPoints{}
1214 }
1215 > state.ExecutionState, err = m.serializer.WorkflowExecutionStateFromBlob(internState.ExecutionState) execution_manager.go
1216 > if err != nil {
1217 return nil, err
1218 }
1219 > state.BufferedEvents, err = m.DeserializeBufferedEvents(internState.BufferedEvents) execution_manager.go
1220 > if err != nil {
1221 return nil, err
1222 }
1223 > if internState.Checksum != nil { execution_manager.go
1224 > state.Checksum, err = m.serializer.ChecksumFromBlob(internState.Checksum) execution_manager.go
1225 > }
1226 > if err != nil { execution_manager.go
1227 return nil, err
1228 }
1229
1230 > return state, nil execution_manager.go
1231 }
1232
1234 archetypeID chasm.ArchetypeID,
1235 methodName string,
1236 > ) (chasm.ArchetypeID, bool) { execution_manager.go
1237 > if !softassert.That(
1238 > m.logger,
1239 > archetypeID != chasm.UnspecifiedArchetypeID,
1240 > "ArchetypeID not specified, defaulting to Workflow.",
1241 > tag.Operation(methodName),
1242 > ) {
1243 return chasm.WorkflowArchetypeID, true
1244 }
1245
1246 > return archetypeID, false execution_manager.go
1247 }
1248
1264 versionHistories *historyspb.VersionHistories,
1265 transitions []*persistencespb.VersionedTransition,
1266 > ) (int64, error) { execution_manager.go
1267 > // TODO remove this if check once legacy execution tests are removed
1268 > if versionHistories == nil {
1269 return common.EmptyVersion, nil
1270 }
1271 > versionHistory, err := versionhistory.GetCurrentVersionHistory(versionHistories) execution_manager.go
1272 > if err != nil {
1273 return 0, err
1274 }
1275
1276 > if !versionhistory.IsEmptyVersionHistory(versionHistory) { execution_manager.go
1277 > versionHistoryItem, err := versionhistory.GetLastVersionHistoryItem(versionHistory) execution_manager.go
1278 > if err != nil {
1279 return 0, err
1280 }
1281 > return versionHistoryItem.GetVersion(), nil execution_manager.go
1282 }
1283
1305 serializer serialization.Serializer,
1306 inputTasks map[tasks.Category][]tasks.Task,
1307 > ) (map[tasks.Category][]InternalHistoryTask, error) { execution_manager.go
1308 > outputTasks := make(map[tasks.Category][]InternalHistoryTask)
1309 > for category, tasks := range inputTasks {
1310 > serializedTasks := make([]InternalHistoryTask, 0, len(tasks)) execution_manager.go
1311 > for _, task := range tasks {
1312 blob, err := serializer.SerializeTask(task)
1313 if err != nil {
1358 func (m *executionManagerImpl) makeInternalChasmNodeMap(
1359 nodes map[string]*persistencespb.ChasmNode,
1360 > ) (map[string]InternalChasmNode, error) { execution_manager.go
1361 > res := make(map[string]InternalChasmNode, len(nodes))
1362 > isCassandra := strings.Contains(m.GetName(), "cassandra")
1363 >
1364 > for path, node := range nodes {
1365 > var internal InternalChasmNode execution_manager.go
1366 >
1367 > // If we're running on Cassandra, set a single blob since that's how we store it.
1368 > if isCassandra {
1369 > blob, err := m.serializer.ChasmNodeToBlob(node) execution_manager.go
1370 > if err != nil {
1371 return nil, err
1372 }
1373 > internal = InternalChasmNode{ execution_manager.go
1374 > CassandraBlob: blob,
1375 > }
1376 } else {
1377 // Otherwise, split the node into separate blobs.
go.temporal.io/server/api/persistence/v1/executions.pb.go 310 covered LOC · 74 ranges

Open complete file

53 }
54
55 > func (x *ShardInfo) Reset() { executions.pb.go
56 > *x = ShardInfo{}
57 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[0]
58 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
59 > ms.StoreMessageInfo(mi)
60 > }
61
62 func (x *ShardInfo) String() string {
66 func (*ShardInfo) ProtoMessage() {}
67
68 > func (x *ShardInfo) ProtoReflect() protoreflect.Message { executions.pb.go
69 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[0]
70 > if x != nil {
71 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
72 > if ms.LoadMessageInfo() == nil {
73 > ms.StoreMessageInfo(mi)
74 > }
75 > return ms
76 }
77 return mi.MessageOf(x)
83 }
84
85 > func (x *ShardInfo) GetShardId() int32 { executions.pb.go
86 > if x != nil {
87 > return x.ShardId
88 > }
89 return 0
90 }
91
92 > func (x *ShardInfo) GetRangeId() int64 { executions.pb.go
93 > if x != nil {
94 > return x.RangeId
95 > }
96 return 0
97 }
98
99 > func (x *ShardInfo) GetOwner() string { executions.pb.go
100 > if x != nil {
101 > return x.Owner
102 > }
103 return ""
104 }
118 }
119
120 > func (x *ShardInfo) GetReplicationDlqAckLevel() map[string]int64 { executions.pb.go
121 > if x != nil {
122 > return x.ReplicationDlqAckLevel
123 > }
124 return nil
125 }
126
127 > func (x *ShardInfo) GetQueueStates() map[int32]*QueueState { executions.pb.go
128 > if x != nil {
129 > return x.QueueStates
130 > }
131 return nil
132 }
380 }
381
382 > func (x *WorkflowExecutionInfo) Reset() { executions.pb.go
383 > *x = WorkflowExecutionInfo{}
384 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[1]
385 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
386 > ms.StoreMessageInfo(mi)
387 > }
388
389 func (x *WorkflowExecutionInfo) String() string {
393 func (*WorkflowExecutionInfo) ProtoMessage() {}
394
395 > func (x *WorkflowExecutionInfo) ProtoReflect() protoreflect.Message { executions.pb.go
396 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[1]
397 > if x != nil {
398 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
399 > if ms.LoadMessageInfo() == nil {
400 > ms.StoreMessageInfo(mi)
401 > }
402 > return ms
403 }
404 > return mi.MessageOf(x) executions.pb.go
405 }
406
410 }
411
412 > func (x *WorkflowExecutionInfo) GetNamespaceId() string { executions.pb.go
413 > if x != nil {
414 > return x.NamespaceId
415 > }
416 return ""
417 }
418
419 > func (x *WorkflowExecutionInfo) GetWorkflowId() string { executions.pb.go
420 > if x != nil {
421 > return x.WorkflowId
422 > }
423 return ""
424 }
1199 func (*TimeSkippingInfo) ProtoMessage() {}
1200
1201 > func (x *TimeSkippingInfo) ProtoReflect() protoreflect.Message { executions.pb.go
1202 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[2]
1203 > if x != nil {
1204 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
1205 > if ms.LoadMessageInfo() == nil {
1206 > ms.StoreMessageInfo(mi)
1207 > }
1208 > return ms
1209 }
1210 > return mi.MessageOf(x) executions.pb.go
1211 }
1212
1268 func (*FastForwardInfo) ProtoMessage() {}
1269
1270 > func (x *FastForwardInfo) ProtoReflect() protoreflect.Message { executions.pb.go
1271 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[3]
1272 > if x != nil {
1273 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
1274 > if ms.LoadMessageInfo() == nil {
1275 > ms.StoreMessageInfo(mi)
1276 > }
1277 > return ms
1278 }
1279 > return mi.MessageOf(x) executions.pb.go
1280 }
1281
1333 func (*LastNotifiedTargetVersion) ProtoMessage() {}
1334
1335 > func (x *LastNotifiedTargetVersion) ProtoReflect() protoreflect.Message { executions.pb.go
1336 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[4]
1337 > if x != nil {
1338 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
1339 > if ms.LoadMessageInfo() == nil {
1340 > ms.StoreMessageInfo(mi)
1341 > }
1342 > return ms
1343 }
1344 > return mi.MessageOf(x) executions.pb.go
1345 }
1346
1390 func (*ExecutionStats) ProtoMessage() {}
1391
1392 > func (x *ExecutionStats) ProtoReflect() protoreflect.Message { executions.pb.go
1393 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[5]
1394 > if x != nil {
1395 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
1396 > if ms.LoadMessageInfo() == nil {
1397 > ms.StoreMessageInfo(mi)
1398 > }
1399 > return ms
1400 }
1401 > return mi.MessageOf(x) executions.pb.go
1402 }
1403
1450 }
1451
1452 > func (x *WorkflowExecutionState) Reset() { executions.pb.go
1453 > *x = WorkflowExecutionState{}
1454 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[6]
1455 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
1456 > ms.StoreMessageInfo(mi)
1457 > }
1458
1459 func (x *WorkflowExecutionState) String() string {
1463 func (*WorkflowExecutionState) ProtoMessage() {}
1464
1465 > func (x *WorkflowExecutionState) ProtoReflect() protoreflect.Message { executions.pb.go
1466 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[6]
1467 > if x != nil {
1468 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
1469 > if ms.LoadMessageInfo() == nil {
1470 > ms.StoreMessageInfo(mi)
1471 > }
1472 > return ms
1473 }
1474 > return mi.MessageOf(x) executions.pb.go
1475 }
1476
1487 }
1488
1489 > func (x *WorkflowExecutionState) GetRunId() string { executions.pb.go
1490 > if x != nil {
1491 > return x.RunId executions.pb.go
1492 > }
1493 return ""
1494 }
1557 func (*RequestIDInfo) ProtoMessage() {}
1558
1559 > func (x *RequestIDInfo) ProtoReflect() protoreflect.Message { executions.pb.go
1560 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[7]
1561 > if x != nil {
1562 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
1563 > if ms.LoadMessageInfo() == nil {
1564 > ms.StoreMessageInfo(mi)
1565 > }
1566 > return ms
1567 }
1568 > return mi.MessageOf(x) executions.pb.go
1569 }
1570
2876 }
2877
2878 > func (x *ActivityInfo) Reset() { executions.pb.go
2879 > *x = ActivityInfo{}
2880 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[17]
2881 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
2882 > ms.StoreMessageInfo(mi)
2883 > }
2884
2885 func (x *ActivityInfo) String() string {
2889 func (*ActivityInfo) ProtoMessage() {}
2890
2891 > func (x *ActivityInfo) ProtoReflect() protoreflect.Message { executions.pb.go
2892 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[17]
2893 > if x != nil {
2894 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
2895 > if ms.LoadMessageInfo() == nil {
2896 > ms.StoreMessageInfo(mi)
2897 > }
2898 > return ms
2899 }
2900 > return mi.MessageOf(x) executions.pb.go
2901 }
2902
3297 }
3298
3299 > func (x *TimerInfo) Reset() { executions.pb.go
3300 > *x = TimerInfo{}
3301 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[18]
3302 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
3303 > ms.StoreMessageInfo(mi)
3304 > }
3305
3306 func (x *TimerInfo) String() string {
3310 func (*TimerInfo) ProtoMessage() {}
3311
3312 > func (x *TimerInfo) ProtoReflect() protoreflect.Message { executions.pb.go
3313 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[18]
3314 > if x != nil {
3315 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
3316 > if ms.LoadMessageInfo() == nil {
3317 > ms.StoreMessageInfo(mi)
3318 > }
3319 > return ms
3320 }
3321 > return mi.MessageOf(x) executions.pb.go
3322 }
3323
3390 }
3391
3392 > func (x *ChildExecutionInfo) Reset() { executions.pb.go
3393 > *x = ChildExecutionInfo{}
3394 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[19]
3395 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
3396 > ms.StoreMessageInfo(mi)
3397 > }
3398
3399 func (x *ChildExecutionInfo) String() string {
3403 func (*ChildExecutionInfo) ProtoMessage() {}
3404
3405 > func (x *ChildExecutionInfo) ProtoReflect() protoreflect.Message { executions.pb.go
3406 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[19]
3407 > if x != nil {
3408 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
3409 > if ms.LoadMessageInfo() == nil {
3410 > ms.StoreMessageInfo(mi)
3411 > }
3412 > return ms
3413 }
3414 > return mi.MessageOf(x) executions.pb.go
3415 }
3416
3530 }
3531
3532 > func (x *RequestCancelInfo) Reset() { executions.pb.go
3533 > *x = RequestCancelInfo{}
3534 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[20]
3535 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
3536 > ms.StoreMessageInfo(mi)
3537 > }
3538
3539 func (x *RequestCancelInfo) String() string {
3543 func (*RequestCancelInfo) ProtoMessage() {}
3544
3545 > func (x *RequestCancelInfo) ProtoReflect() protoreflect.Message { executions.pb.go
3546 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[20]
3547 > if x != nil {
3548 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
3549 > if ms.LoadMessageInfo() == nil {
3550 > ms.StoreMessageInfo(mi)
3551 > }
3552 > return ms
3553 }
3554 > return mi.MessageOf(x) executions.pb.go
3555 }
3556
3607 }
3608
3609 > func (x *SignalInfo) Reset() { executions.pb.go
3610 > *x = SignalInfo{}
3611 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[21]
3612 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
3613 > ms.StoreMessageInfo(mi)
3614 > }
3615
3616 func (x *SignalInfo) String() string {
3620 func (*SignalInfo) ProtoMessage() {}
3621
3622 > func (x *SignalInfo) ProtoReflect() protoreflect.Message { executions.pb.go
3623 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[21]
3624 > if x != nil {
3625 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
3626 > if ms.LoadMessageInfo() == nil {
3627 > ms.StoreMessageInfo(mi)
3628 > }
3629 > return ms
3630 }
3631 > return mi.MessageOf(x) executions.pb.go
3632 }
3633
3682 }
3683
3684 > func (x *Checksum) Reset() { executions.pb.go
3685 > *x = Checksum{}
3686 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[22]
3687 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
3688 > ms.StoreMessageInfo(mi)
3689 > }
3690
3691 func (x *Checksum) String() string {
3695 func (*Checksum) ProtoMessage() {}
3696
3697 > func (x *Checksum) ProtoReflect() protoreflect.Message { executions.pb.go
3698 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[22]
3699 > if x != nil {
3700 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
3701 > if ms.LoadMessageInfo() == nil {
3702 > ms.StoreMessageInfo(mi)
3703 > }
3704 > return ms
3705 }
3706 > return mi.MessageOf(x) executions.pb.go
3707 }
3708
3719 }
3720
3721 > func (x *Checksum) GetFlavor() v1.ChecksumFlavor { executions.pb.go
3722 > if x != nil {
3723 > return x.Flavor
3724 > }
3725 return v1.ChecksumFlavor(0)
3726 }
4336 func (*ResetChildInfo) ProtoMessage() {}
4337
4338 > func (x *ResetChildInfo) ProtoReflect() protoreflect.Message { executions.pb.go
4339 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[28]
4340 > if x != nil {
4341 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
4342 > if ms.LoadMessageInfo() == nil {
4343 > ms.StoreMessageInfo(mi)
4344 > }
4345 > return ms
4346 }
4347 > return mi.MessageOf(x) executions.pb.go
4348 }
4349
4387 func (*WorkflowPauseInfo) ProtoMessage() {}
4388
4389 > func (x *WorkflowPauseInfo) ProtoReflect() protoreflect.Message { executions.pb.go
4390 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[29]
4391 > if x != nil {
4392 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
4393 > if ms.LoadMessageInfo() == nil {
4394 > ms.StoreMessageInfo(mi)
4395 > }
4396 > return ms
4397 }
4398 > return mi.MessageOf(x) executions.pb.go
4399 }
4400
4503 func (*ActivityInfo_UseWorkflowBuildIdInfo) ProtoMessage() {}
4504
4505 > func (x *ActivityInfo_UseWorkflowBuildIdInfo) ProtoReflect() protoreflect.Message { executions.pb.go
4506 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[39]
4507 > if x != nil {
4508 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
4509 if ms.LoadMessageInfo() == nil {
4512 return ms
4513 }
4514 > return mi.MessageOf(x) executions.pb.go
4515 }
4516
4561 func (*ActivityInfo_PauseInfo) ProtoMessage() {}
4562
4563 > func (x *ActivityInfo_PauseInfo) ProtoReflect() protoreflect.Message { executions.pb.go
4564 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[40]
4565 > if x != nil {
4566 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) executions.pb.go
4567 > if ms.LoadMessageInfo() == nil {
4568 > ms.StoreMessageInfo(mi)
4569 > }
4570 > return ms
4571 }
4572 > return mi.MessageOf(x) executions.pb.go
4573 }
4574
4658 func (*ActivityInfo_PauseInfo_Manual) ProtoMessage() {}
4659
4660 > func (x *ActivityInfo_PauseInfo_Manual) ProtoReflect() protoreflect.Message { executions.pb.go
4661 > mi := &file_temporal_server_api_persistence_v1_executions_proto_msgTypes[41]
4662 > if x != nil {
4663 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
4664 if ms.LoadMessageInfo() == nil {
4667 return ms
4668 }
4669 > return mi.MessageOf(x) executions.pb.go
4670 }
4671
5706 }
5707
5708 > func init() { file_temporal_server_api_persistence_v1_executions_proto_init() } executions.pb.go
5709 > func file_temporal_server_api_persistence_v1_executions_proto_init() {
5710 > if File_temporal_server_api_persistence_v1_executions_proto != nil {
5711 > return
5712 > }
5713 > file_temporal_server_api_persistence_v1_chasm_proto_init()
5714 > file_temporal_server_api_persistence_v1_hsm_proto_init()
5715 > file_temporal_server_api_persistence_v1_queues_proto_init()
5716 > file_temporal_server_api_persistence_v1_update_proto_init()
5717 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[1].OneofWrappers = []any{
5718 > (*WorkflowExecutionInfo_LastWorkflowTaskFailureCause)(nil),
5719 > (*WorkflowExecutionInfo_LastWorkflowTaskTimedOutType)(nil),
5720 > }
5721 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[8].OneofWrappers = []any{
5722 > (*TransferTaskInfo_CloseExecutionTaskDetails_)(nil),
5723 > (*TransferTaskInfo_ChasmTaskInfo)(nil),
5724 > }
5725 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[10].OneofWrappers = []any{
5726 > (*VisibilityTaskInfo_ChasmTaskInfo)(nil),
5727 > }
5728 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[11].OneofWrappers = []any{
5729 > (*TimerTaskInfo_ChasmTaskInfo)(nil),
5730 > }
5731 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[13].OneofWrappers = []any{
5732 > (*OutboundTaskInfo_StateMachineInfo)(nil),
5733 > (*OutboundTaskInfo_ChasmTaskInfo)(nil),
5734 > (*OutboundTaskInfo_WorkerCommandsTask)(nil),
5735 > }
5736 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[17].OneofWrappers = []any{
5737 > (*ActivityInfo_UseWorkflowBuildIdInfo_)(nil),
5738 > (*ActivityInfo_LastIndependentlyAssignedBuildId)(nil),
5739 > }
5740 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[23].OneofWrappers = []any{
5741 > (*Callback_Nexus_)(nil),
5742 > (*Callback_Hsm)(nil),
5743 > }
5744 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[40].OneofWrappers = []any{
5745 > (*ActivityInfo_PauseInfo_Manual_)(nil),
5746 > (*ActivityInfo_PauseInfo_RuleId)(nil),
5747 > }
5748 > file_temporal_server_api_persistence_v1_executions_proto_msgTypes[46].OneofWrappers = []any{
5749 > (*CallbackInfo_Trigger_WorkflowClosed)(nil),
5750 > }
5751 > type x struct{}
5752 > out := protoimpl.TypeBuilder{
5753 > File: protoimpl.DescBuilder{
5754 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
5755 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_executions_proto_rawDesc), len(file_temporal_server_api_persistence_v1_executions_proto_rawDesc)),
5756 > NumEnums: 0,
5757 > NumMessages: 47,
5758 > NumExtensions: 0,
5759 > NumServices: 0,
5760 > },
5761 > GoTypes: file_temporal_server_api_persistence_v1_executions_proto_goTypes,
5762 > DependencyIndexes: file_temporal_server_api_persistence_v1_executions_proto_depIdxs,
5763 > MessageInfos: file_temporal_server_api_persistence_v1_executions_proto_msgTypes,
5764 > }.Build()
5765 > File_temporal_server_api_persistence_v1_executions_proto = out.File
5766 > file_temporal_server_api_persistence_v1_executions_proto_goTypes = nil
5767 > file_temporal_server_api_persistence_v1_executions_proto_depIdxs = nil
5768 }
go.temporal.io/server/common/persistence/cassandra/mutable_state_store.go 261 covered LOC · 45 ranges

Open complete file

373 )
374
375 > func NewMutableStateStore(session gocql.Session, serializer serialization.Serializer, logger log.Logger) *MutableStateStore { mutable_state_store.go
376 > return &MutableStateStore{
377 > Session: session,
378 > serializer: serializer,
379 > logger: logger,
380 > }
381 > }
382
383 func (d *MutableStateStore) CreateWorkflowExecution(
384 ctx context.Context,
385 request *p.InternalCreateWorkflowExecutionRequest,
386 > ) (*p.InternalCreateWorkflowExecutionResponse, error) { mutable_state_store.go
387 > batch := d.Session.NewBatch(gocql.LoggedBatch).WithContext(ctx)
388 >
389 > shardID := request.ShardID
390 > newWorkflow := request.NewWorkflowSnapshot
391 > lastWriteVersion := newWorkflow.LastWriteVersion
392 > namespaceID := newWorkflow.NamespaceID
393 > workflowID := newWorkflow.WorkflowID
394 > runID := newWorkflow.RunID
395 >
396 > var requestCurrentRunID string
397 > currentRecordRunID := d.getCurrentRecordRunID(request.ArchetypeID)
398 >
399 > switch request.Mode {
400 > case p.CreateWorkflowModeBypassCurrent: mutable_state_store.go
401 // noop
402
422 requestCurrentRunID = request.PreviousRunID
423
424 > case p.CreateWorkflowModeBrandNew: mutable_state_store.go
425 > batch.Query(templateCreateCurrentWorkflowExecutionQuery,
426 > shardID,
427 > rowTypeExecution,
428 > namespaceID,
429 > workflowID,
430 > currentRecordRunID,
431 > defaultVisibilityTimestamp,
432 > rowTypeExecutionTaskID,
433 > runID,
434 > newWorkflow.ExecutionStateBlob.Data,
435 > newWorkflow.ExecutionStateBlob.EncodingType.String(),
436 > lastWriteVersion,
437 > newWorkflow.ExecutionState.State,
438 > )
439 >
440 > requestCurrentRunID = ""
441
442 default:
444 }
445
446 > if err := applyWorkflowSnapshotBatchAsNew(batch, mutable_state_store.go
447 > request.ShardID,
448 > &newWorkflow,
449 > ); err != nil {
450 return nil, err
451 }
452
453 > batch.Query(templateUpdateLeaseQuery, mutable_state_store.go
454 > request.RangeID,
455 > request.ShardID,
456 > rowTypeShard,
457 > rowTypeShardNamespaceID,
458 > rowTypeShardWorkflowID,
459 > rowTypeShardRunID,
460 > defaultVisibilityTimestamp,
461 > rowTypeShardTaskID,
462 > request.RangeID,
463 > )
464 >
465 > conflictRecord := newConflictRecord()
466 > applied, conflictIter, err := d.Session.MapExecuteBatchCAS(batch, conflictRecord)
467 > if err != nil {
468 return nil, gocql.ConvertError("CreateWorkflowExecution", err)
469 }
470 > defer func() { mutable_state_store.go
471 > _ = conflictIter.Close()
472 > }()
473
474 > if !applied { mutable_state_store.go
475 return nil, convertErrors(
476 conflictRecord,
496 ctx context.Context,
497 request *p.GetWorkflowExecutionRequest,
498 > ) (*p.InternalGetWorkflowExecutionResponse, error) { mutable_state_store.go
499 > query := d.Session.Query(templateGetWorkflowExecutionQuery,
500 > request.ShardID,
501 > rowTypeExecution,
502 > request.NamespaceID,
503 > request.WorkflowID,
504 > request.RunID,
505 > defaultVisibilityTimestamp,
506 > rowTypeExecutionTaskID,
507 > ).WithContext(ctx)
508 >
509 > result := make(map[string]any)
510 > if err := query.MapScan(result); err != nil {
511 return nil, gocql.ConvertError("GetWorkflowExecution", err)
512 }
513
514 > state, err := mutableStateFromRow(result) mutable_state_store.go
515 > if err != nil {
516 return nil, serviceerror.NewUnavailablef("GetWorkflowExecution operation failed. Error: %v", err)
517 }
518
519 > activityInfos := make(map[int64]*commonpb.DataBlob) mutable_state_store.go
520 > aMap := result["activity_map"].(map[int64][]byte)
521 > aMapEncoding := result["activity_map_encoding"].(string)
522 > for key, value := range aMap {
523 > activityInfos[key] = p.NewDataBlob(value, aMapEncoding)
524 > }
525 > state.ActivityInfos = activityInfos
526 >
527 > timerInfos := make(map[string]*commonpb.DataBlob)
528 > tMapEncoding := result["timer_map_encoding"].(string)
529 > tMap := result["timer_map"].(map[string][]byte)
530 > for key, value := range tMap {
531 > timerInfos[key] = p.NewDataBlob(value, tMapEncoding)
532 > }
533 > state.TimerInfos = timerInfos
534 >
535 > childExecutionInfos := make(map[int64]*commonpb.DataBlob)
536 > cMap := result["child_executions_map"].(map[int64][]byte)
537 > cMapEncoding := result["child_executions_map_encoding"].(string)
538 > for key, value := range cMap {
539 > childExecutionInfos[key] = p.NewDataBlob(value, cMapEncoding)
540 > }
541 > state.ChildExecutionInfos = childExecutionInfos
542 >
543 > requestCancelInfos := make(map[int64]*commonpb.DataBlob)
544 > rMapEncoding := result["request_cancel_map_encoding"].(string)
545 > rMap := result["request_cancel_map"].(map[int64][]byte)
546 > for key, value := range rMap {
547 > requestCancelInfos[key] = p.NewDataBlob(value, rMapEncoding)
548 > }
549 > state.RequestCancelInfos = requestCancelInfos
550 >
551 > signalInfos := make(map[int64]*commonpb.DataBlob)
552 > sMapEncoding := result["signal_map_encoding"].(string)
553 > sMap := result["signal_map"].(map[int64][]byte)
554 > for key, value := range sMap {
555 > signalInfos[key] = p.NewDataBlob(value, sMapEncoding)
556 > }
557 > state.SignalInfos = signalInfos
558 > state.SignalRequestedIDs = gocql.UUIDsToStringSlice(result["signal_requested"])
559 >
560 > chasmNodeBlobs := make(map[string]p.InternalChasmNode)
561 > chasmNodeEncoding, ok := result["chasm_node_map_encoding"].(string)
562 > if !ok {
563 return nil, serviceerror.NewInternal("GetWorkflowExecution failed: unknown chasm_node_map_encoding type")
564 }
565 > chasmNodeBytes, ok := result["chasm_node_map"].(map[string][]byte) mutable_state_store.go
566 > if !ok {
567 return nil, serviceerror.NewInternal("GetWorkflowExecution failed: unknown chasm_node_map type")
568 }
569 > for key, value := range chasmNodeBytes { mutable_state_store.go
570 > chasmNodeBlobs[key] = p.InternalChasmNode{
571 > CassandraBlob: p.NewDataBlob(value, chasmNodeEncoding),
572 > }
573 > }
574 > state.ChasmNodes = chasmNodeBlobs
575 >
576 > eList := result["buffered_events_list"].([]map[string]any) //nolint:revive // unchecked-type-assertion: consistent with surrounding Cassandra result parsing
577 > bufferedEventsBlobs := make([]*commonpb.DataBlob, 0, len(eList))
578 > for _, v := range eList {
579 blob := createHistoryEventBatchBlob(v)
580 bufferedEventsBlobs = append(bufferedEventsBlobs, blob)
581 }
582 > state.BufferedEvents = bufferedEventsBlobs mutable_state_store.go
583 >
584 > state.Checksum = p.NewDataBlob(result["checksum"].([]byte), result["checksum_encoding"].(string))
585 >
586 > dbVersion := int64(0)
587 > if dbRecordVersion, ok := result["db_record_version"]; ok {
588 > dbVersion = dbRecordVersion.(int64)
589 > } else {
590 dbVersion = 0
591 }
592
593 > return &p.InternalGetWorkflowExecutionResponse{ mutable_state_store.go
594 > State: state,
595 > DBRecordVersion: dbVersion,
596 > }, nil
597 }
598
744 ctx context.Context,
745 request *p.InternalConflictResolveWorkflowExecutionRequest,
746 > ) error { mutable_state_store.go
747 > batch := d.Session.NewBatch(gocql.LoggedBatch).WithContext(ctx)
748 >
749 > currentWorkflow := request.CurrentWorkflowMutation
750 > resetWorkflow := request.ResetWorkflowSnapshot
751 > newWorkflow := request.NewWorkflowSnapshot
752 >
753 > shardID := request.ShardID
754 >
755 > namespaceID := resetWorkflow.NamespaceID
756 > workflowID := resetWorkflow.WorkflowID
757 >
758 > var currentRunID string
759 >
760 > var startTime *time.Time
761 > if currentWorkflow != nil && currentWorkflow.ExecutionState != nil {
762 startTime = timestamp.TimeValuePtr(currentWorkflow.ExecutionState.StartTime)
763 }
764
765 > currentRecordRunID := d.getCurrentRecordRunID(request.ArchetypeID) mutable_state_store.go
766 >
767 > switch request.Mode {
768 > case p.ConflictResolveWorkflowModeBypassCurrent: mutable_state_store.go
769 > if err := d.assertNotCurrentExecution(
770 > ctx,
771 > shardID,
772 > namespaceID,
773 > workflowID,
774 > request.ArchetypeID,
775 > resetWorkflow.ExecutionState.RunId,
776 > startTime,
777 > ); err != nil {
778 return err
779 }
816 }
817
818 > if err := applyWorkflowSnapshotBatchAsReset(batch, shardID, &resetWorkflow); err != nil { mutable_state_store.go
819 return err
820 }
821
822 > if currentWorkflow != nil { mutable_state_store.go
823 if err := applyWorkflowMutationBatch(batch, shardID, currentWorkflow); err != nil {
824 return err
825 }
826 }
827 > if newWorkflow != nil { mutable_state_store.go
828 > if err := applyWorkflowSnapshotBatchAsNew(batch, shardID, newWorkflow); err != nil { mutable_state_store.go
829 return err
830 }
832
833 // Verifies that the RangeID has not changed
834 > batch.Query(templateUpdateLeaseQuery, mutable_state_store.go
835 > request.RangeID,
836 > request.ShardID,
837 > rowTypeShard,
838 > rowTypeShardNamespaceID,
839 > rowTypeShardWorkflowID,
840 > rowTypeShardRunID,
841 > defaultVisibilityTimestamp,
842 > rowTypeShardTaskID,
843 > request.RangeID,
844 > )
845 >
846 > conflictRecord := newConflictRecord()
847 > applied, conflictIter, err := d.Session.MapExecuteBatchCAS(batch, conflictRecord)
848 > if err != nil {
849 return gocql.ConvertError("ConflictResolveWorkflowExecution", err)
850 }
851 > defer func() { mutable_state_store.go
852 > _ = conflictIter.Close()
853 > }()
854
855 > if !applied { mutable_state_store.go
856 executionCASConditions := []executionCASCondition{{
857 runID: resetWorkflow.RunID,
891 runID string,
892 startTime *time.Time,
893 > ) error { mutable_state_store.go
894 >
895 > if resp, err := d.GetCurrentExecution(ctx, &p.GetCurrentExecutionRequest{
896 > ShardID: shardID,
897 > NamespaceID: namespaceID,
898 > WorkflowID: workflowID,
899 > ArchetypeID: archetypeID,
900 > }); err != nil {
901 if _, isNotFound := err.(*serviceerror.NotFound); isNotFound {
902 // allow bypassing no current record
904 }
905 return err
906 > } else if resp.RunID == runID { mutable_state_store.go
907 return &p.CurrentWorkflowConditionFailedError{
908 Msg: fmt.Sprintf("Assertion on current record failed. Current run ID is not expected: %v", resp.RunID),
959 ctx context.Context,
960 request *p.GetCurrentExecutionRequest,
961 > ) (*p.InternalGetCurrentExecutionResponse, error) { mutable_state_store.go
962 > query := d.Session.Query(templateGetCurrentExecutionQuery,
963 > request.ShardID,
964 > rowTypeExecution,
965 > request.NamespaceID,
966 > request.WorkflowID,
967 > d.getCurrentRecordRunID(request.ArchetypeID),
968 > defaultVisibilityTimestamp,
969 > rowTypeExecutionTaskID,
970 > ).WithContext(ctx)
971 >
972 > result := make(map[string]any)
973 > if err := query.MapScan(result); err != nil {
974 return nil, gocql.ConvertError("GetCurrentExecution", err)
975 }
976
977 > currentRunID := gocql.UUIDToString(result["current_run_id"]) mutable_state_store.go
978 > executionStateBlob, err := executionStateBlobFromRow(result)
979 > if err != nil {
980 return nil, serviceerror.NewUnavailablef("GetCurrentExecution operation failed. Error: %v", err)
981 }
982
983 // TODO: fix blob ExecutionState in storage should not be a blob.
984 > executionState, err := d.serializer.WorkflowExecutionStateFromBlob(executionStateBlob) mutable_state_store.go
985 > if err != nil {
986 return nil, err
987 }
988
989 > return &p.InternalGetCurrentExecutionResponse{ mutable_state_store.go
990 > RunID: currentRunID,
991 > ExecutionState: executionState,
992 > }, nil
993 }
994
1092 func (d *MutableStateStore) getCurrentRecordRunID(
1093 archetypeID chasm.ArchetypeID,
1094 > ) string { mutable_state_store.go
1095 > if !softassert.That(
1096 > d.logger,
1097 > archetypeID != chasm.UnspecifiedArchetypeID,
1098 > "ArchetypeID not specified, defaulting to Workflow.",
1099 > ) {
1100 return permanentRunID
1101 }
1102
1103 > if archetypeID == chasm.WorkflowArchetypeID { mutable_state_store.go
1104 > return permanentRunID mutable_state_store.go
1105 > }
1106
1107 return gocql.ArchetypeIDToUUID(archetypeID)
1110 func mutableStateFromRow(
1111 result map[string]any,
1112 > ) (*p.InternalWorkflowMutableState, error) { mutable_state_store.go
1113 > eiBytes, ok := result["execution"].([]byte)
1114 > if !ok {
1115 return nil, newPersistedTypeMismatchError("execution", "", eiBytes, result)
1116 }
1117
1118 > eiEncoding, ok := result["execution_encoding"].(string) mutable_state_store.go
1119 > if !ok {
1120 return nil, newPersistedTypeMismatchError("execution_encoding", "", eiEncoding, result)
1121 }
1122
1123 > nextEventID, ok := result["next_event_id"].(int64) mutable_state_store.go
1124 > if !ok {
1125 return nil, newPersistedTypeMismatchError("next_event_id", "", nextEventID, result)
1126 }
1127
1128 > protoState, err := executionStateBlobFromRow(result) mutable_state_store.go
1129 > if err != nil {
1130 return nil, err
1131 }
1132
1133 > mutableState := &p.InternalWorkflowMutableState{ mutable_state_store.go
1134 > ExecutionInfo: p.NewDataBlob(eiBytes, eiEncoding),
1135 > ExecutionState: protoState,
1136 > NextEventID: nextEventID,
1137 > }
1138 > return mutableState, nil
1139 }
1140
1141 func executionStateBlobFromRow(
1142 result map[string]any,
1143 > ) (*commonpb.DataBlob, error) { mutable_state_store.go
1144 > state, ok := result["execution_state"].([]byte)
1145 > if !ok {
1146 return nil, newPersistedTypeMismatchError("execution_state", "", state, result)
1147 }
1148
1149 > stateEncoding, ok := result["execution_state_encoding"].(string) mutable_state_store.go
1150 > if !ok {
1151 return nil, newPersistedTypeMismatchError("execution_state_encoding", "", stateEncoding, result)
1152 }
1153
1154 > return p.NewDataBlob(state, stateEncoding), nil mutable_state_store.go
1155 }
go.temporal.io/server/common/persistence/tests/execution_mutable_state.go 257 covered LOC · 26 ranges

Open complete file

60 serializer serialization.Serializer,
61 logger log.Logger,
62 > ) *ExecutionMutableStateSuite { execution_mutable_state.go
63 > return &ExecutionMutableStateSuite{
64 > Assertions: require.New(t),
65 > ProtoAssertions: protorequire.New(t),
66 > ShardManager: p.NewShardManager(
67 > shardStore,
68 > serializer,
69 > ),
70 > ExecutionManager: p.NewExecutionManager(
71 > executionStore,
72 > serializer,
73 > nil,
74 > logger,
75 > dynamicconfig.GetIntPropertyFn(4*1024*1024),
76 > dynamicconfig.GetBoolPropertyFn(false),
77 > ),
78 > HistoryBranchUtil: p.NewHistoryBranchUtil(serializer),
79 > Logger: logger,
80 > }
81 > }
82
83 > func (s *ExecutionMutableStateSuite) SetupSuite() { execution_mutable_state.go
84 > }
85
86 > func (s *ExecutionMutableStateSuite) TearDownSuite() { execution_mutable_state.go
87 > }
88
89 > func (s *ExecutionMutableStateSuite) SetupTest() { execution_mutable_state.go
90 > s.Assertions = require.New(s.T())
91 > s.Ctx, s.Cancel = context.WithTimeout(context.Background(), 30*time.Second*debug.TimeoutMultiplier)
92 >
93 > s.ShardID++
94 > resp, err := s.ShardManager.GetOrCreateShard(s.Ctx, &p.GetOrCreateShardRequest{
95 > ShardID: s.ShardID,
96 > InitialShardInfo: &persistencespb.ShardInfo{
97 > ShardId: s.ShardID,
98 > RangeId: 1,
99 > },
100 > })
101 > s.NoError(err)
102 > previousRangeID := resp.ShardInfo.RangeId
103 > resp.ShardInfo.RangeId++
104 > err = s.ShardManager.UpdateShard(s.Ctx, &p.UpdateShardRequest{
105 > ShardInfo: resp.ShardInfo,
106 > PreviousRangeID: previousRangeID,
107 > })
108 > s.NoError(err)
109 > s.RangeID = resp.ShardInfo.RangeId
110 >
111 > s.NamespaceID = uuid.New().String()
112 > s.WorkflowID = uuid.New().String()
113 > s.RunID = uuid.New().String()
114 > }
115
116 > func (s *ExecutionMutableStateSuite) TearDownTest() { execution_mutable_state.go
117 > s.Cancel()
118 > }
119
120 func (s *ExecutionMutableStateSuite) TestCreate_BrandNew() {
2013 }
2014
2015 > func (s *ExecutionMutableStateSuite) TestConflictResolve_Zombie_WithNew() { execution_mutable_state.go
2016 > s.CreateWorkflow(
2017 > rand.Int63(),
2018 > enumsspb.WORKFLOW_EXECUTION_STATE_CREATED,
2019 > enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
2020 > rand.Int63(),
2021 > )
2022 > baseRunID := uuid.New().String()
2023 > baseBranchToken := RandomBranchToken(s.NamespaceID, s.WorkflowID, baseRunID, s.HistoryBranchUtil)
2024 > baseSnapshot, baseEvents := RandomSnapshot(
2025 > s.T(),
2026 > s.NamespaceID,
2027 > s.WorkflowID,
2028 > baseRunID,
2029 > common.FirstEventID,
2030 > rand.Int63(),
2031 > enumsspb.WORKFLOW_EXECUTION_STATE_ZOMBIE,
2032 > enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
2033 > rand.Int63(),
2034 > baseBranchToken,
2035 > )
2036 > _, err := s.ExecutionManager.CreateWorkflowExecution(s.Ctx, &p.CreateWorkflowExecutionRequest{
2037 > ShardID: s.ShardID,
2038 > RangeID: s.RangeID,
2039 > Mode: p.CreateWorkflowModeBypassCurrent,
2040 >
2041 > PreviousRunID: "",
2042 > PreviousLastWriteVersion: 0,
2043 >
2044 > ArchetypeID: chasm.WorkflowArchetypeID,
2045 >
2046 > NewWorkflowSnapshot: *baseSnapshot,
2047 > NewWorkflowEvents: baseEvents,
2048 > })
2049 > s.NoError(err)
2050 >
2051 > resetSnapshot, resetEvents := RandomSnapshot(
2052 > s.T(),
2053 > s.NamespaceID,
2054 > s.WorkflowID,
2055 > baseRunID,
2056 > baseSnapshot.NextEventID,
2057 > rand.Int63(),
2058 > enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED,
2059 > enumspb.WORKFLOW_EXECUTION_STATUS_COMPLETED,
2060 > baseSnapshot.DBRecordVersion+1,
2061 > baseBranchToken,
2062 > )
2063 > newRunID := uuid.New().String()
2064 > newBranchToken := RandomBranchToken(s.NamespaceID, s.WorkflowID, newRunID, s.HistoryBranchUtil)
2065 > newSnapshot, newEvents := RandomSnapshot(
2066 > s.T(),
2067 > s.NamespaceID,
2068 > s.WorkflowID,
2069 > newRunID,
2070 > common.FirstEventID,
2071 > rand.Int63(),
2072 > enumsspb.WORKFLOW_EXECUTION_STATE_ZOMBIE,
2073 > enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING,
2074 > rand.Int63(),
2075 > newBranchToken,
2076 > )
2077 > _, err = s.ExecutionManager.ConflictResolveWorkflowExecution(s.Ctx, &p.ConflictResolveWorkflowExecutionRequest{
2078 > ShardID: s.ShardID,
2079 > RangeID: s.RangeID,
2080 > Mode: p.ConflictResolveWorkflowModeBypassCurrent,
2081 >
2082 > ArchetypeID: chasm.WorkflowArchetypeID,
2083 >
2084 > ResetWorkflowSnapshot: *resetSnapshot,
2085 > ResetWorkflowEvents: resetEvents,
2086 >
2087 > NewWorkflowSnapshot: newSnapshot,
2088 > NewWorkflowEvents: newEvents,
2089 >
2090 > CurrentWorkflowMutation: nil,
2091 > CurrentWorkflowEvents: nil,
2092 > })
2093 > s.NoError(err)
2094 >
2095 > s.AssertMSEqualWithDB(chasm.WorkflowArchetypeID, resetSnapshot)
2096 > s.AssertMSEqualWithDB(chasm.WorkflowArchetypeID, newSnapshot)
2097 > s.AssertHEEqualWithDB(baseBranchToken, baseEvents, resetEvents)
2098 > s.AssertHEEqualWithDB(newBranchToken, newEvents)
2099 > }
2100
2101 func (s *ExecutionMutableStateSuite) TestSet_NotExists() {
2610 status enumspb.WorkflowExecutionStatus,
2611 dbRecordVersion int64,
2612 > ) ([]byte, *p.WorkflowSnapshot, []*p.WorkflowEvents) { execution_mutable_state.go
2613 > branchToken := RandomBranchToken(s.NamespaceID, s.WorkflowID, s.RunID, s.HistoryBranchUtil)
2614 > snapshot, events := RandomSnapshot(
2615 > s.T(),
2616 > s.NamespaceID,
2617 > s.WorkflowID,
2618 > s.RunID,
2619 > common.FirstEventID,
2620 > lastWriteVersion,
2621 > state,
2622 > status,
2623 > dbRecordVersion,
2624 > branchToken,
2625 > )
2626 > _, err := s.ExecutionManager.CreateWorkflowExecution(s.Ctx, &p.CreateWorkflowExecutionRequest{
2627 > ShardID: s.ShardID,
2628 > RangeID: s.RangeID,
2629 > Mode: p.CreateWorkflowModeBrandNew,
2630 >
2631 > PreviousRunID: "",
2632 > PreviousLastWriteVersion: 0,
2633 >
2634 > ArchetypeID: chasm.WorkflowArchetypeID,
2635 >
2636 > NewWorkflowSnapshot: *snapshot,
2637 > NewWorkflowEvents: events,
2638 > })
2639 > s.NoError(err)
2640 > return branchToken, snapshot, events
2641 > }
2642
2643 func (s *ExecutionMutableStateSuite) CreateCHASMExecution(
2694 }
2695
2696 > func (s *ExecutionMutableStateSuite) AssertHEEqualWithDB(branchToken []byte, events ...[]*p.WorkflowEvents) { execution_mutable_state.go
2697 > s.assertHEWithDB(branchToken, events, false)
2698 > }
2699
2700 func (s *ExecutionMutableStateSuite) AssertHEPrefixWithDB(branchToken []byte, events ...[]*p.WorkflowEvents) {
2706 eventBatches [][]*p.WorkflowEvents,
2707 assertPrefix bool,
2709 > var historyEvents []*historypb.HistoryEvent
2710 > for _, eventBatch := range eventBatches {
2711 > for _, event := range eventBatch {
2712 > historyEvents = append(historyEvents, event.Events...)
2713 > }
2714 }
2715 > pageSize := len(historyEvents) execution_mutable_state.go
2716 > if !assertPrefix {
2717 > pageSize++ // plus one to check against extra page execution_mutable_state.go
2718 > }
2719 > resp, err := s.ExecutionManager.ReadHistoryBranch(s.Ctx, &p.ReadHistoryBranchRequest{ execution_mutable_state.go
2720 > ShardID: s.ShardID,
2721 > BranchToken: branchToken,
2722 > MinEventID: common.FirstEventID,
2723 > MaxEventID: math.MaxInt64,
2724 > PageSize: pageSize,
2725 > NextPageToken: nil,
2726 > })
2727 > s.NoError(err)
2728 > if !assertPrefix {
2729 > s.Nil(resp.NextPageToken) execution_mutable_state.go
2730 > }
2731 > s.Len(resp.HistoryEvents, len(historyEvents)) execution_mutable_state.go
2732 > for i, event := range historyEvents {
2733 > s.ProtoEqual(event, resp.HistoryEvents[i])
2734 > }
2735 }
2736
2739 snapshot *p.WorkflowSnapshot,
2740 mutations ...*p.WorkflowMutation,
2742 > resp, err := s.ExecutionManager.GetWorkflowExecution(s.Ctx, &p.GetWorkflowExecutionRequest{
2743 > ShardID: s.ShardID,
2744 > NamespaceID: snapshot.ExecutionInfo.NamespaceId,
2745 > WorkflowID: snapshot.ExecutionInfo.WorkflowId,
2746 > RunID: snapshot.ExecutionState.RunId,
2747 > ArchetypeID: archetypeID,
2748 > })
2749 > s.NoError(err)
2750 >
2751 > actualMutableState := resp.State
2752 > actualDBRecordVersion := resp.DBRecordVersion
2753 >
2754 > expectedMutableState, expectedDBRecordVersion := s.Accumulate(snapshot, mutations...)
2755 >
2756 > // need to special handling signal request IDs ...
2757 > // since ^ is slice
2758 > s.Equal(
2759 > convert.StringSliceToSet(expectedMutableState.SignalRequestedIds),
2760 > convert.StringSliceToSet(actualMutableState.SignalRequestedIds),
2761 > )
2762 > actualMutableState.SignalRequestedIds = expectedMutableState.SignalRequestedIds
2763 >
2764 > s.Equal(expectedDBRecordVersion, actualDBRecordVersion)
2765 > s.ProtoEqual(expectedMutableState, actualMutableState)
2766 > }
2767
2768 func (s *ExecutionMutableStateSuite) Accumulate(
2769 snapshot *p.WorkflowSnapshot,
2770 mutations ...*p.WorkflowMutation,
2771 > ) (*persistencespb.WorkflowMutableState, int64) { execution_mutable_state.go
2772 > mutableState := &persistencespb.WorkflowMutableState{
2773 > ExecutionInfo: snapshot.ExecutionInfo,
2774 > ExecutionState: snapshot.ExecutionState,
2775 > NextEventId: snapshot.NextEventID,
2776 > ActivityInfos: snapshot.ActivityInfos,
2777 > TimerInfos: snapshot.TimerInfos,
2778 > ChildExecutionInfos: snapshot.ChildExecutionInfos,
2779 > RequestCancelInfos: snapshot.RequestCancelInfos,
2780 > SignalInfos: snapshot.SignalInfos,
2781 > SignalRequestedIds: convert.StringSetToSlice(snapshot.SignalRequestedIDs),
2782 > ChasmNodes: snapshot.ChasmNodes,
2783 > }
2784 > dbRecordVersion := snapshot.DBRecordVersion
2785 >
2786 > for _, mutation := range mutations {
2787 s.Equal(dbRecordVersion, mutation.DBRecordVersion-1)
2788 dbRecordVersion = mutation.DBRecordVersion
2846
2847 // need to serialize & deserialize to get rid of timezone information ...
2848 > bytes, err := proto.Marshal(mutableState) execution_mutable_state.go
2849 > s.NoError(err)
2850 > mutableState = &persistencespb.WorkflowMutableState{}
2851 > err = proto.Unmarshal(bytes, mutableState)
2852 > s.NoError(err)
2853 >
2854 > // make equal test easier
2855 > if mutableState.ActivityInfos == nil {
2856 mutableState.ActivityInfos = make(map[int64]*persistencespb.ActivityInfo)
2857 }
2858 > if mutableState.TimerInfos == nil { execution_mutable_state.go
2859 mutableState.TimerInfos = make(map[string]*persistencespb.TimerInfo)
2860 }
2861 > if mutableState.ChildExecutionInfos == nil { execution_mutable_state.go
2862 mutableState.ChildExecutionInfos = make(map[int64]*persistencespb.ChildExecutionInfo)
2863 }
2864 > if mutableState.RequestCancelInfos == nil { execution_mutable_state.go
2865 mutableState.RequestCancelInfos = make(map[int64]*persistencespb.RequestCancelInfo)
2866 }
2867 > if mutableState.SignalInfos == nil { execution_mutable_state.go
2868 mutableState.SignalInfos = make(map[int64]*persistencespb.SignalInfo)
2869 }
2870 > if mutableState.SignalRequestedIds == nil { execution_mutable_state.go
2871 mutableState.SignalRequestedIds = make([]string, 0)
2872 }
2873 > if mutableState.BufferedEvents == nil { execution_mutable_state.go
2874 > mutableState.BufferedEvents = make([]*historypb.HistoryEvent, 0) execution_mutable_state.go
2875 > }
2876 > if mutableState.ChasmNodes == nil { execution_mutable_state.go
2877 mutableState.ChasmNodes = make(map[string]*persistencespb.ChasmNode)
2878 }
2879
2880 > return mutableState, dbRecordVersion execution_mutable_state.go
2881 }
go.temporal.io/server/common/dynamicconfig/setting_gen.go 255 covered LOC · 55 ranges

Open complete file

26 type GlobalBoolConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[bool]
27
28 > func NewGlobalBoolSetting(key string, def bool, description string) GlobalBoolSetting { setting_gen.go
29 > return NewGlobalTypedSettingWithConverter[bool](key, convertBool, def, description)
30 > }
31
32 func NewGlobalBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) GlobalBoolConstrainedDefaultSetting {
36 type BoolPropertyFn = TypedPropertyFn[bool]
37
38 > func GetBoolPropertyFn(value bool) BoolPropertyFn { setting_gen.go
39 > return GetTypedPropertyFn(value)
40 > }
41
42 type NamespaceBoolSetting = NamespaceTypedSetting[bool]
43 type NamespaceBoolConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[bool]
44
45 > func NewNamespaceBoolSetting(key string, def bool, description string) NamespaceBoolSetting { setting_gen.go
46 > return NewNamespaceTypedSettingWithConverter[bool](key, convertBool, def, description)
47 > }
48
49 func NewNamespaceBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) NamespaceBoolConstrainedDefaultSetting {
60 type NamespaceIDBoolConstrainedDefaultSetting = NamespaceIDTypedConstrainedDefaultSetting[bool]
61
62 > func NewNamespaceIDBoolSetting(key string, def bool, description string) NamespaceIDBoolSetting { setting_gen.go
63 > return NewNamespaceIDTypedSettingWithConverter[bool](key, convertBool, def, description)
64 > }
65
66 func NewNamespaceIDBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) NamespaceIDBoolConstrainedDefaultSetting {
77 type TaskQueueBoolConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[bool]
78
79 > func NewTaskQueueBoolSetting(key string, def bool, description string) TaskQueueBoolSetting { setting_gen.go
80 > return NewTaskQueueTypedSettingWithConverter[bool](key, convertBool, def, description)
81 > }
82
83 func NewTaskQueueBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) TaskQueueBoolConstrainedDefaultSetting {
128 type DestinationBoolConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[bool]
129
130 > func NewDestinationBoolSetting(key string, def bool, description string) DestinationBoolSetting { setting_gen.go
131 > return NewDestinationTypedSettingWithConverter[bool](key, convertBool, def, description)
132 > }
133
134 func NewDestinationBoolSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[bool], description string) DestinationBoolConstrainedDefaultSetting {
162 type GlobalIntConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[int]
163
164 > func NewGlobalIntSetting(key string, def int, description string) GlobalIntSetting { setting_gen.go
165 > return NewGlobalTypedSettingWithConverter[int](key, convertInt, def, description)
166 > }
167
168 func NewGlobalIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) GlobalIntConstrainedDefaultSetting {
172 type IntPropertyFn = TypedPropertyFn[int]
173
174 > func GetIntPropertyFn(value int) IntPropertyFn { setting_gen.go
175 > return GetTypedPropertyFn(value)
176 > }
177
178 type NamespaceIntSetting = NamespaceTypedSetting[int]
179 type NamespaceIntConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[int]
180
181 > func NewNamespaceIntSetting(key string, def int, description string) NamespaceIntSetting { setting_gen.go
182 > return NewNamespaceTypedSettingWithConverter[int](key, convertInt, def, description)
183 > }
184
185 func NewNamespaceIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) NamespaceIntConstrainedDefaultSetting {
189 type IntPropertyFnWithNamespaceFilter = TypedPropertyFnWithNamespaceFilter[int]
190
191 > func GetIntPropertyFnFilteredByNamespace(value int) IntPropertyFnWithNamespaceFilter { setting_gen.go
192 > return GetTypedPropertyFnFilteredByNamespace(value)
193 > }
194
195 type NamespaceIDIntSetting = NamespaceIDTypedSetting[int]
213 type TaskQueueIntConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[int]
214
215 > func NewTaskQueueIntSetting(key string, def int, description string) TaskQueueIntSetting { setting_gen.go
216 > return NewTaskQueueTypedSettingWithConverter[int](key, convertInt, def, description)
217 > }
218
219 > func NewTaskQueueIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) TaskQueueIntConstrainedDefaultSetting { setting_gen.go
220 > return NewTaskQueueTypedSettingWithConstrainedDefault[int](key, convertInt, cdef, description)
221 > }
222
223 type IntPropertyFnWithTaskQueueFilter = TypedPropertyFnWithTaskQueueFilter[int]
230 type ShardIDIntConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[int]
231
232 > func NewShardIDIntSetting(key string, def int, description string) ShardIDIntSetting { setting_gen.go
233 > return NewShardIDTypedSettingWithConverter[int](key, convertInt, def, description)
234 > }
235
236 func NewShardIDIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) ShardIDIntConstrainedDefaultSetting {
264 type DestinationIntConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[int]
265
266 > func NewDestinationIntSetting(key string, def int, description string) DestinationIntSetting { setting_gen.go
267 > return NewDestinationTypedSettingWithConverter[int](key, convertInt, def, description)
268 > }
269
270 func NewDestinationIntSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[int], description string) DestinationIntConstrainedDefaultSetting {
298 type GlobalFloatConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[float64]
299
300 > func NewGlobalFloatSetting(key string, def float64, description string) GlobalFloatSetting { setting_gen.go
301 > return NewGlobalTypedSettingWithConverter[float64](key, convertFloat, def, description)
302 > }
303
304 func NewGlobalFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) GlobalFloatConstrainedDefaultSetting {
315 type NamespaceFloatConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[float64]
316
317 > func NewNamespaceFloatSetting(key string, def float64, description string) NamespaceFloatSetting { setting_gen.go
318 > return NewNamespaceTypedSettingWithConverter[float64](key, convertFloat, def, description)
319 > }
320
321 func NewNamespaceFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) NamespaceFloatConstrainedDefaultSetting {
349 type TaskQueueFloatConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[float64]
350
351 > func NewTaskQueueFloatSetting(key string, def float64, description string) TaskQueueFloatSetting { setting_gen.go
352 > return NewTaskQueueTypedSettingWithConverter[float64](key, convertFloat, def, description)
353 > }
354
355 func NewTaskQueueFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) TaskQueueFloatConstrainedDefaultSetting {
366 type ShardIDFloatConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[float64]
367
368 > func NewShardIDFloatSetting(key string, def float64, description string) ShardIDFloatSetting { setting_gen.go
369 > return NewShardIDTypedSettingWithConverter[float64](key, convertFloat, def, description)
370 > }
371
372 func NewShardIDFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) ShardIDFloatConstrainedDefaultSetting {
400 type DestinationFloatConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[float64]
401
402 > func NewDestinationFloatSetting(key string, def float64, description string) DestinationFloatSetting { setting_gen.go
403 > return NewDestinationTypedSettingWithConverter[float64](key, convertFloat, def, description)
404 > }
405
406 func NewDestinationFloatSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[float64], description string) DestinationFloatConstrainedDefaultSetting {
434 type GlobalStringConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[string]
435
436 > func NewGlobalStringSetting(key string, def string, description string) GlobalStringSetting { setting_gen.go
437 > return NewGlobalTypedSettingWithConverter[string](key, convertString, def, description)
438 > }
439
440 func NewGlobalStringSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[string], description string) GlobalStringConstrainedDefaultSetting {
570 type GlobalDurationConstrainedDefaultSetting = GlobalTypedConstrainedDefaultSetting[time.Duration]
571
572 > func NewGlobalDurationSetting(key string, def time.Duration, description string) GlobalDurationSetting { setting_gen.go
573 > return NewGlobalTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
574 > }
575
576 func NewGlobalDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) GlobalDurationConstrainedDefaultSetting {
587 type NamespaceDurationConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[time.Duration]
588
589 > func NewNamespaceDurationSetting(key string, def time.Duration, description string) NamespaceDurationSetting { setting_gen.go
590 > return NewNamespaceTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
591 > }
592
593 func NewNamespaceDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) NamespaceDurationConstrainedDefaultSetting {
604 type NamespaceIDDurationConstrainedDefaultSetting = NamespaceIDTypedConstrainedDefaultSetting[time.Duration]
605
606 > func NewNamespaceIDDurationSetting(key string, def time.Duration, description string) NamespaceIDDurationSetting { setting_gen.go
607 > return NewNamespaceIDTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
608 > }
609
610 func NewNamespaceIDDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) NamespaceIDDurationConstrainedDefaultSetting {
621 type TaskQueueDurationConstrainedDefaultSetting = TaskQueueTypedConstrainedDefaultSetting[time.Duration]
622
623 > func NewTaskQueueDurationSetting(key string, def time.Duration, description string) TaskQueueDurationSetting { setting_gen.go
624 > return NewTaskQueueTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
625 > }
626
627 > func NewTaskQueueDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) TaskQueueDurationConstrainedDefaultSetting { setting_gen.go
628 > return NewTaskQueueTypedSettingWithConstrainedDefault[time.Duration](key, convertDuration, cdef, description)
629 > }
630
631 type DurationPropertyFnWithTaskQueueFilter = TypedPropertyFnWithTaskQueueFilter[time.Duration]
638 type ShardIDDurationConstrainedDefaultSetting = ShardIDTypedConstrainedDefaultSetting[time.Duration]
639
640 > func NewShardIDDurationSetting(key string, def time.Duration, description string) ShardIDDurationSetting { setting_gen.go
641 > return NewShardIDTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
642 > }
643
644 func NewShardIDDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) ShardIDDurationConstrainedDefaultSetting {
655 type TaskTypeDurationConstrainedDefaultSetting = TaskTypeTypedConstrainedDefaultSetting[time.Duration]
656
657 > func NewTaskTypeDurationSetting(key string, def time.Duration, description string) TaskTypeDurationSetting { setting_gen.go
658 > return NewTaskTypeTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
659 > }
660
661 func NewTaskTypeDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) TaskTypeDurationConstrainedDefaultSetting {
672 type DestinationDurationConstrainedDefaultSetting = DestinationTypedConstrainedDefaultSetting[time.Duration]
673
674 > func NewDestinationDurationSetting(key string, def time.Duration, description string) DestinationDurationSetting { setting_gen.go
675 > return NewDestinationTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
676 > }
677
678 func NewDestinationDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) DestinationDurationConstrainedDefaultSetting {
689 type ChasmTaskTypeDurationConstrainedDefaultSetting = ChasmTaskTypeTypedConstrainedDefaultSetting[time.Duration]
690
691 > func NewChasmTaskTypeDurationSetting(key string, def time.Duration, description string) ChasmTaskTypeDurationSetting { setting_gen.go
692 > return NewChasmTaskTypeTypedSettingWithConverter[time.Duration](key, convertDuration, def, description)
693 > }
694
695 func NewChasmTaskTypeDurationSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[time.Duration], description string) ChasmTaskTypeDurationConstrainedDefaultSetting {
723 type NamespaceMapConstrainedDefaultSetting = NamespaceTypedConstrainedDefaultSetting[map[string]any]
724
725 > func NewNamespaceMapSetting(key string, def map[string]any, description string) NamespaceMapSetting { setting_gen.go
726 > return NewNamespaceTypedSettingWithConverter[map[string]any](key, convertMap, def, description)
727 > }
728
729 func NewNamespaceMapSettingWithConstrainedDefault(key string, cdef []TypedConstrainedValue[map[string]any], description string) NamespaceMapConstrainedDefaultSetting {
845 // values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
846 // when using non-empty maps or slices as defaults, the result may not be what you want.
847 > func NewGlobalTypedSetting[T any](key string, def T, description string) GlobalTypedSetting[T] { setting_gen.go
848 > // Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
849 > warnDefaultSharedStructure(key, def)
850 > // If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
851 > _ = deepCopyForMapstructure(def)
852 >
853 > s := GlobalTypedSetting[T]{
854 > key: MakeKey(key),
855 > def: def,
856 > convert: ConvertStructure[T](def),
857 > description: description,
858 > }
859 > register(s)
860 > return s
861 > }
862
863 // NewGlobalTypedSettingWithConverter creates a setting with a custom converter function.
864 > func NewGlobalTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) GlobalTypedSetting[T] { setting_gen.go
865 > s := GlobalTypedSetting[T]{
866 > key: MakeKey(key),
867 > def: def,
868 > convert: convert,
869 > description: description,
870 > }
871 > register(s)
872 > return s
873 > }
874
875 // NewGlobalTypedSettingWithConstrainedDefault creates a setting with a compound default value.
885 }
886
887 > func (s GlobalTypedSetting[T]) Key() Key { return s.key } setting_gen.go
888 func (s GlobalTypedSetting[T]) Precedence() Precedence { return PrecedenceGlobal }
889 func (s GlobalTypedSetting[T]) Validate(v any) error {
969 }
970
971 > func GetTypedPropertyFn[T any](value T) TypedPropertyFn[T] { setting_gen.go
972 > return func() T {
973 > return value setting_gen.go
974 > }
975 }
976
981 // values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
982 // when using non-empty maps or slices as defaults, the result may not be what you want.
983 > func NewNamespaceTypedSetting[T any](key string, def T, description string) NamespaceTypedSetting[T] { setting_gen.go
984 > // Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
985 > warnDefaultSharedStructure(key, def)
986 > // If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
987 > _ = deepCopyForMapstructure(def)
988 >
989 > s := NamespaceTypedSetting[T]{
990 > key: MakeKey(key),
991 > def: def,
992 > convert: ConvertStructure[T](def),
993 > description: description,
994 > }
995 > register(s)
996 > return s
997 > }
998
999 // NewNamespaceTypedSettingWithConverter creates a setting with a custom converter function.
1000 > func NewNamespaceTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) NamespaceTypedSetting[T] { setting_gen.go
1001 > s := NamespaceTypedSetting[T]{
1002 > key: MakeKey(key),
1003 > def: def,
1004 > convert: convert,
1005 > description: description,
1006 > }
1007 > register(s)
1008 > return s
1009 > }
1010
1011 // NewNamespaceTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1021 }
1022
1023 > func (s NamespaceTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1024 func (s NamespaceTypedSetting[T]) Precedence() Precedence { return PrecedenceNamespace }
1025 func (s NamespaceTypedSetting[T]) Validate(v any) error {
1105 }
1106
1107 > func GetTypedPropertyFnFilteredByNamespace[T any](value T) TypedPropertyFnWithNamespaceFilter[T] { setting_gen.go
1108 > return func(namespace string) T {
1109 return value
1110 }
1134
1135 // NewNamespaceIDTypedSettingWithConverter creates a setting with a custom converter function.
1136 > func NewNamespaceIDTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) NamespaceIDTypedSetting[T] { setting_gen.go
1137 > s := NamespaceIDTypedSetting[T]{
1138 > key: MakeKey(key),
1139 > def: def,
1140 > convert: convert,
1141 > description: description,
1142 > }
1143 > register(s)
1144 > return s
1145 > }
1146
1147 // NewNamespaceIDTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1157 }
1158
1159 > func (s NamespaceIDTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1160 func (s NamespaceIDTypedSetting[T]) Precedence() Precedence { return PrecedenceNamespaceID }
1161 func (s NamespaceIDTypedSetting[T]) Validate(v any) error {
1253 // values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
1254 // when using non-empty maps or slices as defaults, the result may not be what you want.
1255 > func NewTaskQueueTypedSetting[T any](key string, def T, description string) TaskQueueTypedSetting[T] { setting_gen.go
1256 > // Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
1257 > warnDefaultSharedStructure(key, def)
1258 > // If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
1259 > _ = deepCopyForMapstructure(def)
1260 >
1261 > s := TaskQueueTypedSetting[T]{
1262 > key: MakeKey(key),
1263 > def: def,
1264 > convert: ConvertStructure[T](def),
1265 > description: description,
1266 > }
1267 > register(s)
1268 > return s
1269 > }
1270
1271 // NewTaskQueueTypedSettingWithConverter creates a setting with a custom converter function.
1272 > func NewTaskQueueTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) TaskQueueTypedSetting[T] { setting_gen.go
1273 > s := TaskQueueTypedSetting[T]{
1274 > key: MakeKey(key),
1275 > def: def,
1276 > convert: convert,
1277 > description: description,
1278 > }
1279 > register(s)
1280 > return s
1281 > }
1282
1283 // NewTaskQueueTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1284 > func NewTaskQueueTypedSettingWithConstrainedDefault[T any](key string, convert func(any) (T, error), cdef []TypedConstrainedValue[T], description string) TaskQueueTypedConstrainedDefaultSetting[T] { setting_gen.go
1285 > s := TaskQueueTypedConstrainedDefaultSetting[T]{
1286 > key: MakeKey(key),
1287 > cdef: cdef,
1288 > convert: convert,
1289 > description: description,
1290 > }
1291 > register(s)
1292 > return s
1293 > }
1294
1295 > func (s TaskQueueTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1296 func (s TaskQueueTypedSetting[T]) Precedence() Precedence { return PrecedenceTaskQueue }
1297 func (s TaskQueueTypedSetting[T]) Validate(v any) error {
1300 }
1301
1302 > func (s TaskQueueTypedConstrainedDefaultSetting[T]) Key() Key { return s.key } setting_gen.go
1303 func (s TaskQueueTypedConstrainedDefaultSetting[T]) Precedence() Precedence { return PrecedenceTaskQueue }
1304 func (s TaskQueueTypedConstrainedDefaultSetting[T]) Validate(v any) error {
1430
1431 // NewShardIDTypedSettingWithConverter creates a setting with a custom converter function.
1432 > func NewShardIDTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) ShardIDTypedSetting[T] { setting_gen.go
1433 > s := ShardIDTypedSetting[T]{
1434 > key: MakeKey(key),
1435 > def: def,
1436 > convert: convert,
1437 > description: description,
1438 > }
1439 > register(s)
1440 > return s
1441 > }
1442
1443 // NewShardIDTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1453 }
1454
1455 > func (s ShardIDTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1456 func (s ShardIDTypedSetting[T]) Precedence() Precedence { return PrecedenceShardID }
1457 func (s ShardIDTypedSetting[T]) Validate(v any) error {
1566
1567 // NewTaskTypeTypedSettingWithConverter creates a setting with a custom converter function.
1568 > func NewTaskTypeTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) TaskTypeTypedSetting[T] { setting_gen.go
1569 > s := TaskTypeTypedSetting[T]{
1570 > key: MakeKey(key),
1571 > def: def,
1572 > convert: convert,
1573 > description: description,
1574 > }
1575 > register(s)
1576 > return s
1577 > }
1578
1579 // NewTaskTypeTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1589 }
1590
1591 > func (s TaskTypeTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1592 func (s TaskTypeTypedSetting[T]) Precedence() Precedence { return PrecedenceTaskType }
1593 func (s TaskTypeTypedSetting[T]) Validate(v any) error {
1685 // values. The value from dynamic config will be _merged_ over a deep copy of 'def'. Be very careful
1686 // when using non-empty maps or slices as defaults, the result may not be what you want.
1687 > func NewDestinationTypedSetting[T any](key string, def T, description string) DestinationTypedSetting[T] { setting_gen.go
1688 > // Warn on any shared structure used with ConvertStructure, even though we handle it by deep copying.
1689 > warnDefaultSharedStructure(key, def)
1690 > // If even deep copy won't even work, we should panic early. Do that by calling deep copy once here.
1691 > _ = deepCopyForMapstructure(def)
1692 >
1693 > s := DestinationTypedSetting[T]{
1694 > key: MakeKey(key),
1695 > def: def,
1696 > convert: ConvertStructure[T](def),
1697 > description: description,
1698 > }
1699 > register(s)
1700 > return s
1701 > }
1702
1703 // NewDestinationTypedSettingWithConverter creates a setting with a custom converter function.
1704 > func NewDestinationTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) DestinationTypedSetting[T] { setting_gen.go
1705 > s := DestinationTypedSetting[T]{
1706 > key: MakeKey(key),
1707 > def: def,
1708 > convert: convert,
1709 > description: description,
1710 > }
1711 > register(s)
1712 > return s
1713 > }
1714
1715 // NewDestinationTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1725 }
1726
1727 > func (s DestinationTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1728 func (s DestinationTypedSetting[T]) Precedence() Precedence { return PrecedenceDestination }
1729 func (s DestinationTypedSetting[T]) Validate(v any) error {
1858
1859 // NewChasmTaskTypeTypedSettingWithConverter creates a setting with a custom converter function.
1860 > func NewChasmTaskTypeTypedSettingWithConverter[T any](key string, convert func(any) (T, error), def T, description string) ChasmTaskTypeTypedSetting[T] { setting_gen.go
1861 > s := ChasmTaskTypeTypedSetting[T]{
1862 > key: MakeKey(key),
1863 > def: def,
1864 > convert: convert,
1865 > description: description,
1866 > }
1867 > register(s)
1868 > return s
1869 > }
1870
1871 // NewChasmTaskTypeTypedSettingWithConstrainedDefault creates a setting with a compound default value.
1881 }
1882
1883 > func (s ChasmTaskTypeTypedSetting[T]) Key() Key { return s.key } setting_gen.go
1884 func (s ChasmTaskTypeTypedSetting[T]) Precedence() Precedence { return PrecedenceChasmTaskType }
1885 func (s ChasmTaskTypeTypedSetting[T]) Validate(v any) error {
go.temporal.io/server/common/persistence/history_manager.go 211 covered LOC · 47 ranges

Open complete file

324 func (m *executionManagerImpl) serializeAppendHistoryNodesRequest(
325 request *AppendHistoryNodesRequest,
326 > ) (*InternalAppendHistoryNodesRequest, error) { history_manager.go
327 > branch, err := m.GetHistoryBranchUtil().ParseHistoryBranchInfo(request.BranchToken)
328 > if err != nil {
329 return nil, serviceerror.NewInvalidArgument(fmt.Sprintf("unable to parse branch token: %v", err))
330 }
331
332 > if len(request.Events) == 0 { history_manager.go
333 return nil, &InvalidPersistenceRequestError{
334 Msg: "events to be appended cannot be empty",
335 }
336 }
337 > sortAncestors(branch.Ancestors) history_manager.go
338 >
339 > version := request.Events[0].Version
340 > nodeID := request.Events[0].EventId
341 > lastID := nodeID - 1
342 >
343 > if nodeID <= 0 {
344 return nil, &InvalidPersistenceRequestError{
345 Msg: "eventID cannot be less than 1",
346 }
347 }
348 > for _, e := range request.Events { history_manager.go
349 > if e.Version != version {
350 return nil, &InvalidPersistenceRequestError{
351 Msg: "event version must be the same inside a batch",
352 }
353 }
354 > if e.EventId != lastID+1 { history_manager.go
355 return nil, &InvalidPersistenceRequestError{
356 Msg: "event ID must be continous",
357 }
358 }
359 > lastID++ history_manager.go
360 }
361
362 // nodeID will be the first eventID
363 > blob, err := m.serializer.SerializeEvents(request.Events) history_manager.go
364 > if err != nil {
365 return nil, err
366 }
367 > size := len(blob.Data) history_manager.go
368 > sizeLimit := m.transactionSizeLimit()
369 > if size > sizeLimit {
370 return nil, &TransactionSizeLimitError{
371 Msg: fmt.Sprintf("transaction size of %v bytes exceeds limit of %v bytes", size, sizeLimit),
373 }
374
375 > req := &InternalAppendHistoryNodesRequest{ history_manager.go
376 > BranchToken: request.BranchToken,
377 > IsNewBranch: request.IsNewBranch,
378 > Info: request.Info,
379 > BranchInfo: branch,
380 > Node: InternalHistoryNode{
381 > NodeID: nodeID,
382 > Events: blob,
383 > PrevTransactionID: request.PrevTransactionID,
384 > TransactionID: request.TransactionID,
385 > },
386 > ShardID: request.ShardID,
387 > }
388 >
389 > if req.IsNewBranch {
390 > // TreeInfo is only needed for new branch history_manager.go
391 > treeInfoBlob, err := m.serializer.HistoryTreeInfoToBlob(&persistencespb.HistoryTreeInfo{
392 > BranchToken: request.BranchToken, // NOTE: this is redundant but double-writing until 1 minor release later
393 > BranchInfo: branch,
394 > ForkTime: timestamp.TimeNowPtrUtc(),
395 > Info: request.Info,
396 > })
397 > if err != nil {
398 return nil, err
399 }
400 > req.TreeInfo = treeInfoBlob history_manager.go
401 }
402
403 > if nodeID < GetBeginNodeID(branch) { history_manager.go
404 return nil, &InvalidPersistenceRequestError{
405 Msg: "cannot append to ancestors' nodes",
532 ctx context.Context,
533 request *ReadHistoryBranchRequest,
534 > ) (*ReadHistoryBranchResponse, error) { history_manager.go
535 >
536 > resp := &ReadHistoryBranchResponse{}
537 > var err error
538 > resp.HistoryEvents, _, _, resp.NextPageToken, resp.Size, err = m.readHistoryBranch(ctx, false, request)
539 > return resp, err
540 > }
541
542 // ReadRawHistoryBranch returns raw history binary data for a branch
616 pageSize int,
617 metadataOnly bool,
618 > ) ([]InternalHistoryNode, *historyPagingToken, error) { history_manager.go
619 >
620 > if token.CurrentRangeIndex == notStartedIndex {
621 > for idx, br := range branchAncestors {
622 > // this range won't contain any nodes needed
623 > if minNodeID >= br.GetEndNodeId() {
624 continue
625 }
626 // similarly, the ranges and the rest won't contain any nodes needed,
627 > if maxNodeID <= br.GetBeginNodeId() { history_manager.go
628 break
629 }
630
631 > if token.CurrentRangeIndex == notStartedIndex { history_manager.go
632 > token.CurrentRangeIndex = idx
633 > }
634 > token.FinalRangeIndex = idx
635 }
636
637 > if token.CurrentRangeIndex == notStartedIndex { history_manager.go
638 return nil, nil, softassert.UnexpectedDataLoss(m.logger, "branchRange is corrupted", nil)
639 }
640 }
641
642 > currentBranch := branchAncestors[token.CurrentRangeIndex] history_manager.go
643 > // minNodeID remains the same, since caller can read from the middle
644 > // maxNodeID need to be shortened since this branch can contain additional history nodes
645 > if currentBranch.GetEndNodeId() < maxNodeID {
646 maxNodeID = currentBranch.GetEndNodeId()
647 }
648 > branchID := currentBranch.GetBranchId() history_manager.go
649 > resp, err := m.persistence.ReadHistoryBranch(ctx, &InternalReadHistoryBranchRequest{
650 > BranchToken: branchToken,
651 > ShardID: shardID,
652 > BranchID: branchID,
653 > MinNodeID: minNodeID,
654 > MaxNodeID: maxNodeID,
655 > NextPageToken: token.StoreToken,
656 > PageSize: pageSize,
657 > MetadataOnly: metadataOnly,
658 > })
659 > if err != nil {
660 return nil, nil, err
661 }
662 > token.StoreToken = resp.NextPageToken history_manager.go
663 > return resp.Nodes, token, nil
664 }
665
728 ctx context.Context,
729 request *ReadHistoryBranchRequest,
730 > ) ([]*commonpb.DataBlob, []int64, []int64, *historyPagingToken, int, error) { history_manager.go
731 >
732 > shardID := request.ShardID
733 > branchToken := request.BranchToken
734 > minNodeID := request.MinEventID
735 > maxNodeID := request.MaxEventID
736 >
737 > branch, err := m.GetHistoryBranchUtil().ParseHistoryBranchInfo(branchToken)
738 > if err != nil {
739 return nil, nil, nil, nil, 0, serviceerror.NewInvalidArgument(fmt.Sprintf("unable to parse branch token: %v", err))
740 }
741 > branchID := branch.BranchId history_manager.go
742 > branchAncestors := branch.Ancestors
743 >
744 > // merge tree ID & branch ID into branch ancestors so the processing logic is simple
745 > beginNodeID := common.FirstEventID
746 > if len(branch.Ancestors) > 0 {
747 beginNodeID = branch.Ancestors[len(branch.Ancestors)-1].GetEndNodeId()
748 }
749 > branchAncestors = append(branchAncestors, &persistencespb.HistoryBranchRange{ history_manager.go
750 > BranchId: branchID,
751 > BeginNodeId: beginNodeID,
752 > EndNodeId: maxNodeID,
753 > })
754 >
755 > token, err := m.deserializeToken(
756 > request.NextPageToken,
757 > request.MinEventID-1,
758 > defaultLastTransactionID,
759 > )
760 > if err != nil {
761 return nil, nil, nil, nil, 0, err
762 }
763
764 > nodes, token, err := m.readRawHistoryBranch( history_manager.go
765 > ctx,
766 > branchToken,
767 > shardID,
768 > branchAncestors,
769 > minNodeID,
770 > maxNodeID,
771 > token,
772 > request.PageSize,
773 > false,
774 > )
775 > if err != nil {
776 return nil, nil, nil, nil, 0, err
777 }
778 > if len(nodes) == 0 && len(request.NextPageToken) == 0 { history_manager.go
779 return nil, nil, nil, nil, 0, serviceerror.NewNotFound("Workflow execution history not found.")
780 }
781
782 > nodes, err = m.filterHistoryNodes( history_manager.go
783 > token.LastNodeID,
784 > token.LastTransactionID,
785 > nodes,
786 > )
787 > if err != nil {
788 return nil, nil, nil, nil, 0, err
789 }
790
791 > var dataBlobs []*commonpb.DataBlob history_manager.go
792 > transactionIDs := make([]int64, 0, len(nodes))
793 > nodeIDs := make([]int64, 0, len(nodes))
794 > dataSize := 0
795 > if len(nodes) > 0 {
796 > dataBlobs = make([]*commonpb.DataBlob, len(nodes))
797 > for index, node := range nodes {
798 > dataBlobs[index] = node.Events
799 > if node.Events == nil {
800 return nil, nil, nil, nil, 0, softassert.UnexpectedDataLoss(m.logger, "no events in history node", nil)
801 }
802 > dataSize += len(node.Events.Data) history_manager.go
803 > transactionIDs = append(transactionIDs, node.TransactionID)
804 > nodeIDs = append(nodeIDs, node.NodeID)
805 }
806 > lastNode := nodes[len(nodes)-1] history_manager.go
807 > token.LastNodeID = lastNode.NodeID
808 > token.LastTransactionID = lastNode.TransactionID
809 }
810 > return dataBlobs, transactionIDs, nodeIDs, token, dataSize, nil history_manager.go
811 }
812
904 byBatch bool,
905 request *ReadHistoryBranchRequest,
906 > ) ([]*historypb.HistoryEvent, []*historypb.History, []int64, []byte, int, error) { history_manager.go
907 >
908 > dataBlobs, transactionIDs, _, token, dataSize, err := m.readRawHistoryBranchAndFilter(ctx, request)
909 > if err != nil {
910 return nil, nil, nil, nil, 0, err
911 }
912
913 > historyEvents := make([]*historypb.HistoryEvent, 0, request.PageSize) history_manager.go
914 > historyEventBatches := make([]*historypb.History, 0, request.PageSize)
915 >
916 > var firstEvent, lastEvent *historypb.HistoryEvent
917 > var eventCount int
918 >
919 > dataLossTags := func(cause error) []tag.Tag {
920 return []tag.Tag{
921 tag.Cause(cause.Error()),
931 }
932
933 > for _, batch := range dataBlobs { history_manager.go
934 > events, err := m.serializer.DeserializeEvents(batch)
935 > if err != nil {
936 return nil, nil, nil, nil, dataSize, err
937 }
938 > if len(events) == 0 { history_manager.go
939 return nil, nil, nil, nil, dataSize, softassert.UnexpectedDataLoss(m.logger, dataLossMsg, errEmptyEvents, dataLossTags(errEmptyEvents)...)
940 }
941
942 > firstEvent = events[0] history_manager.go
943 > eventCount = len(events)
944 > lastEvent = events[eventCount-1]
945 >
946 > if firstEvent.GetVersion() != lastEvent.GetVersion() || firstEvent.GetEventId()+int64(eventCount-1) != lastEvent.GetEventId() {
947 // in a single batch, version should be the same, and ID should be contiguous
948 return historyEvents, historyEventBatches, transactionIDs, nil, dataSize, softassert.UnexpectedDataLoss(m.logger, dataLossMsg, errWrongVersion, dataLossTags(errWrongVersion)...)
949 }
950 > if firstEvent.GetEventId() != token.LastEventID+1 { history_manager.go
951 return historyEvents, historyEventBatches, transactionIDs, nil, dataSize, softassert.UnexpectedDataLoss(m.logger, dataLossMsg, errNonContiguousEventID, dataLossTags(errNonContiguousEventID)...)
952 }
953
954 > if byBatch { history_manager.go
955 historyEventBatches = append(historyEventBatches, &historypb.History{Events: events})
956 > } else { history_manager.go
957 > historyEvents = append(historyEvents, events...)
958 > }
959 > token.LastEventID = lastEvent.GetEventId()
960 }
961
962 > nextPageToken, err := m.serializeToken(token, false) history_manager.go
963 > if err != nil {
964 return nil, nil, nil, nil, 0, err
965 }
966 > return historyEvents, historyEventBatches, transactionIDs, nextPageToken, dataSize, nil history_manager.go
967 }
968
1040 lastTransactionID int64,
1041 nodes []InternalHistoryNode,
1042 > ) ([]InternalHistoryNode, error) { history_manager.go
1043 > var result []InternalHistoryNode
1044 > for _, node := range nodes {
1045 > // assuming that business logic layer is correct and transaction ID only increase
1046 > // thus, valid event batch will come with increasing transaction ID
1047 >
1048 > // event batches with smaller node ID
1049 > // -> should not be possible since records are already sorted
1050 > // event batches with same node ID
1051 > // -> batch with higher transaction ID is valid
1052 > // event batches with larger node ID
1053 > // -> batch with lower transaction ID is invalid (happens before)
1054 > // -> batch with higher transaction ID is valid
1055 > if node.TransactionID < lastTransactionID {
1056 continue
1057 }
1058
1059 > switch { history_manager.go
1060 case node.NodeID < lastNodeID:
1061 return nil, softassert.UnexpectedDataLoss(m.logger, "corrupted data, nodeID cannot decrease", nil)
1062 case node.NodeID == lastNodeID:
1063 return nil, softassert.UnexpectedDataLoss(m.logger, "corrupted data, same nodeID must have smaller txnID", nil)
1064 > default: // row.NodeID > lastNodeID: history_manager.go
1065 > // NOTE: when row.nodeID > lastNodeID, we expect the one with largest txnID comes first
1066 > lastTransactionID = node.TransactionID
1067 > lastNodeID = node.NodeID
1068 > result = append(result, node)
1069 }
1070 }
1071 > return result, nil history_manager.go
1072 }
1073
1106 defaultLastEventID int64,
1107 lastTransactionId int64,
1108 > ) (*historyPagingToken, error) { history_manager.go
1109 >
1110 > return m.pagingTokenSerializer.Deserialize(
1111 > token,
1112 > defaultLastEventID,
1113 > defaultLastNodeID,
1114 > lastTransactionId,
1115 > )
1116 > }
1117
1118 func (m *executionManagerImpl) serializeToken(
1119 pagingToken *historyPagingToken,
1120 reverseOrder bool,
1121 > ) ([]byte, error) { history_manager.go
1122 >
1123 > if len(pagingToken.StoreToken) == 0 {
1124 > if pagingToken.CurrentRangeIndex == pagingToken.FinalRangeIndex {
1125 > // this means that we have reached the final page of final branchRange
1126 > return nil, nil
1127 > }
1128
1129 if reverseOrder {
go.temporal.io/server/common/persistence/size.go 188 covered LOC · 9 ranges

Open complete file

10 state *persistencespb.WorkflowMutableState,
11 historyStatistics *HistoryStatistics,
12 > ) *MutableStateStatistics { size.go
13 > if internalState == nil {
14 return nil
15 }
16
17 > executionInfoSize := sizeOfBlob(internalState.ExecutionInfo) size.go
18 > executionStateSize := sizeOfBlob(internalState.ExecutionState)
19 >
20 > totalActivityCount := state.ExecutionInfo.ActivityCount
21 > activityInfoCount := len(internalState.ActivityInfos)
22 > activityInfoSize := sizeOfInt64BlobMap(internalState.ActivityInfos)
23 >
24 > totalUserTimerCount := state.ExecutionInfo.UserTimerCount
25 > timerInfoCount := len(internalState.TimerInfos)
26 > timerInfoSize := sizeOfStringBlobMap(internalState.TimerInfos)
27 >
28 > totalChildExecutionCount := state.ExecutionInfo.ChildExecutionCount
29 > childExecutionInfoCount := len(internalState.ChildExecutionInfos)
30 > childExecutionInfoSize := sizeOfInt64BlobMap(internalState.ChildExecutionInfos)
31 >
32 > totalRequestCancelExternalCount := state.ExecutionInfo.RequestCancelExternalCount
33 > requestCancelInfoCount := len(internalState.RequestCancelInfos)
34 > requestCancelInfoSize := sizeOfInt64BlobMap(internalState.RequestCancelInfos)
35 >
36 > totalSignalExternalCount := state.ExecutionInfo.SignalExternalCount
37 > signalInfoCount := len(internalState.SignalInfos)
38 > signalInfoSize := sizeOfInt64BlobMap(internalState.SignalInfos)
39 >
40 > totalSignalCount := state.ExecutionInfo.SignalCount
41 > signalRequestIDCount := len(internalState.SignalRequestedIDs)
42 > signalRequestIDSize := sizeOfStringSlice(internalState.SignalRequestedIDs)
43 >
44 > bufferedEventsCount := len(internalState.BufferedEvents)
45 > bufferedEventsSize := sizeOfBlobSlice(internalState.BufferedEvents)
46 >
47 > totalUpdateCount := state.ExecutionInfo.UpdateCount
48 > updateInfoCount := len(state.ExecutionInfo.UpdateInfos)
49 >
50 > chasmTotalSize := sizeOfChasmNodeMap(internalState.ChasmNodes)
51 >
52 > totalSize := executionInfoSize
53 > totalSize += executionStateSize
54 > totalSize += activityInfoSize
55 > totalSize += timerInfoSize
56 > totalSize += childExecutionInfoSize
57 > totalSize += requestCancelInfoSize
58 > totalSize += signalInfoSize
59 > totalSize += signalRequestIDSize
60 > totalSize += bufferedEventsSize
61 > totalSize += chasmTotalSize
62 >
63 > return &MutableStateStatistics{
64 > TotalSize: totalSize,
65 > HistoryStatistics: historyStatistics,
66 >
67 > ExecutionInfoSize: executionInfoSize,
68 > ExecutionStateSize: executionStateSize,
69 >
70 > ActivityInfoSize: activityInfoSize,
71 > ActivityInfoCount: activityInfoCount,
72 > TotalActivityCount: totalActivityCount,
73 >
74 > TimerInfoSize: timerInfoSize,
75 > TimerInfoCount: timerInfoCount,
76 > TotalUserTimerCount: totalUserTimerCount,
77 >
78 > ChildInfoSize: childExecutionInfoSize,
79 > ChildInfoCount: childExecutionInfoCount,
80 > TotalChildExecutionCount: totalChildExecutionCount,
81 >
82 > RequestCancelInfoSize: requestCancelInfoSize,
83 > RequestCancelInfoCount: requestCancelInfoCount,
84 > TotalRequestCancelExternalCount: totalRequestCancelExternalCount,
85 >
86 > SignalInfoSize: signalInfoSize,
87 > SignalInfoCount: signalInfoCount,
88 > TotalSignalExternalCount: totalSignalExternalCount,
89 >
90 > SignalRequestIDSize: signalRequestIDSize,
91 > SignalRequestIDCount: signalRequestIDCount,
92 > TotalSignalCount: totalSignalCount,
93 >
94 > BufferedEventsSize: bufferedEventsSize,
95 > BufferedEventsCount: bufferedEventsCount,
96 >
97 > UpdateInfoCount: updateInfoCount,
98 > TotalUpdateCount: totalUpdateCount,
99 >
100 > ChasmTotalSize: chasmTotalSize,
101 > }
102 }
103
105 mutation *InternalWorkflowMutation,
106 historyStatistics *HistoryStatistics,
107 > ) *MutableStateStatistics { size.go
108 > if mutation == nil {
109 > return nil size.go
110 > }
111
112 executionInfoSize := sizeOfBlob(mutation.ExecutionInfoBlob)
220 }
221
222 > func taskCountsByCategory(t *map[tasks.Category][]InternalHistoryTask) map[string]int { size.go
223 > counts := make(map[string]int)
224 > for category, tasks := range *t {
225 > counts[category.Name()] = len(tasks) size.go
226 > }
227 > return counts size.go
228 }
229
231 snapshot *InternalWorkflowSnapshot,
232 historyStatistics *HistoryStatistics,
233 > ) *MutableStateStatistics { size.go
234 > if snapshot == nil {
235 return nil
236 }
237
238 > executionInfoSize := sizeOfBlob(snapshot.ExecutionInfoBlob) size.go
239 > executionStateSize := sizeOfBlob(snapshot.ExecutionStateBlob)
240 >
241 > totalActivityCount := snapshot.ExecutionInfo.ActivityCount
242 > activityInfoCount := len(snapshot.ActivityInfos)
243 > activityInfoSize := sizeOfInt64BlobMap(snapshot.ActivityInfos)
244 >
245 > totalUserTimerCount := snapshot.ExecutionInfo.UserTimerCount
246 > timerInfoCount := len(snapshot.TimerInfos)
247 > timerInfoSize := sizeOfStringBlobMap(snapshot.TimerInfos)
248 >
249 > totalChildExecutionCount := snapshot.ExecutionInfo.ChildExecutionCount
250 > childExecutionInfoCount := len(snapshot.ChildExecutionInfos)
251 > childExecutionInfoSize := sizeOfInt64BlobMap(snapshot.ChildExecutionInfos)
252 >
253 > totalRequestCancelExternalCount := snapshot.ExecutionInfo.RequestCancelExternalCount
254 > requestCancelInfoCount := len(snapshot.RequestCancelInfos)
255 > requestCancelInfoSize := sizeOfInt64BlobMap(snapshot.RequestCancelInfos)
256 >
257 > totalSignalExternalCount := snapshot.ExecutionInfo.SignalExternalCount
258 > signalInfoCount := len(snapshot.SignalInfos)
259 > signalInfoSize := sizeOfInt64BlobMap(snapshot.SignalInfos)
260 >
261 > totalSignalCount := snapshot.ExecutionInfo.SignalCount
262 > signalRequestIDCount := len(snapshot.SignalRequestedIDs)
263 > signalRequestIDSize := sizeOfStringSet(snapshot.SignalRequestedIDs)
264 >
265 > totalUpdateCount := snapshot.ExecutionInfo.UpdateCount
266 > updateInfoCount := len(snapshot.ExecutionInfo.UpdateInfos)
267 >
268 > bufferedEventsCount := 0
269 > bufferedEventsSize := 0
270 >
271 > chasmTotalSize := sizeOfChasmNodeMap(snapshot.ChasmNodes)
272 >
273 > totalSize := executionInfoSize
274 > totalSize += executionStateSize
275 > totalSize += activityInfoSize
276 > totalSize += timerInfoSize
277 > totalSize += childExecutionInfoSize
278 > totalSize += requestCancelInfoSize
279 > totalSize += signalInfoSize
280 > totalSize += signalRequestIDSize
281 > totalSize += bufferedEventsSize
282 > totalSize += chasmTotalSize
283 >
284 > taskCountByCategory := taskCountsByCategory(&snapshot.Tasks)
285 >
286 > return &MutableStateStatistics{
287 > TotalSize: totalSize,
288 > HistoryStatistics: historyStatistics,
289 >
290 > ExecutionInfoSize: executionInfoSize,
291 > ExecutionStateSize: executionStateSize,
292 >
293 > ActivityInfoSize: activityInfoSize,
294 > ActivityInfoCount: activityInfoCount,
295 > TotalActivityCount: totalActivityCount,
296 >
297 > TimerInfoSize: timerInfoSize,
298 > TimerInfoCount: timerInfoCount,
299 > TotalUserTimerCount: totalUserTimerCount,
300 >
301 > ChildInfoSize: childExecutionInfoSize,
302 > ChildInfoCount: childExecutionInfoCount,
303 > TotalChildExecutionCount: totalChildExecutionCount,
304 >
305 > RequestCancelInfoSize: requestCancelInfoSize,
306 > RequestCancelInfoCount: requestCancelInfoCount,
307 > TotalRequestCancelExternalCount: totalRequestCancelExternalCount,
308 >
309 > SignalInfoSize: signalInfoSize,
310 > SignalInfoCount: signalInfoCount,
311 > TotalSignalExternalCount: totalSignalExternalCount,
312 >
313 > SignalRequestIDSize: signalRequestIDSize,
314 > SignalRequestIDCount: signalRequestIDCount,
315 > TotalSignalCount: totalSignalCount,
316 >
317 > BufferedEventsSize: bufferedEventsSize,
318 > BufferedEventsCount: bufferedEventsCount,
319 >
320 > TaskCountByCategory: taskCountByCategory,
321 >
322 > TotalUpdateCount: totalUpdateCount,
323 > UpdateInfoCount: updateInfoCount,
324 >
325 > ChasmTotalSize: chasmTotalSize,
326 > }
327 }
go.temporal.io/server/common/persistence/tests/util.go 177 covered LOC · 22 ranges

Open complete file

46 dbRecordVersion int64,
47 branchToken []byte,
48 > ) (*p.WorkflowSnapshot, []*p.WorkflowEvents) { util.go
49 > snapshot := &p.WorkflowSnapshot{
50 > ExecutionInfo: RandomExecutionInfo(namespaceID, workflowID, eventID, lastWriteVersion, branchToken),
51 > ExecutionState: RandomExecutionState(runID, state, status, lastWriteVersion),
52 >
53 > NextEventID: eventID + 1, // NOTE: RandomSnapshot generates a single history event, hence NextEventID is plus 1
54 >
55 > ActivityInfos: RandomInt64ActivityInfoMap(),
56 > TimerInfos: RandomStringTimerInfoMap(),
57 > ChildExecutionInfos: RandomInt64ChildExecutionInfoMap(),
58 > RequestCancelInfos: RandomInt64RequestCancelInfoMap(),
59 > SignalInfos: RandomInt64SignalInfoMap(),
60 > SignalRequestedIDs: map[string]struct{}{uuid.New().String(): {}},
61 > ChasmNodes: RandomChasmNodeMap(),
62 >
63 > Tasks: map[tasks.Category][]tasks.Task{
64 > tasks.CategoryTransfer: {},
65 > tasks.CategoryTimer: {},
66 > tasks.CategoryReplication: {},
67 > tasks.CategoryVisibility: {},
68 > },
69 >
70 > Condition: rand.Int63(),
71 > DBRecordVersion: dbRecordVersion,
72 > }
73 >
74 > if branchToken == nil {
75 return snapshot, nil
76 }
77
78 > return snapshot, []*p.WorkflowEvents{{ util.go
79 > NamespaceID: namespaceID,
80 > WorkflowID: workflowID,
81 > RunID: runID,
82 > BranchToken: branchToken,
83 > Events: []*historypb.HistoryEvent{RandomHistoryEvent(eventID, lastWriteVersion)},
84 > }}
85 }
86
158 }
159
160 > func RandomChasmNodeMap() map[string]*persistencespb.ChasmNode { util.go
161 > return map[string]*persistencespb.ChasmNode{
162 > uuid.New().String(): RandomChasmNode(),
163 > }
164 > }
165
166 > func RandomChasmNode() *persistencespb.ChasmNode { util.go
167 > // Some arbitrary random data to ensure the chasm node's attributes are preserved.
168 > var blobInfo persistencespb.WorkflowExecutionInfo
169 > _ = fakedata.FakeStruct(&blobInfo)
170 > blob, _ := serialization.Encode(&blobInfo)
171 >
172 > var versionedTransition persistencespb.VersionedTransition
173 > _ = fakedata.FakeStruct(&versionedTransition)
174 >
175 > return &persistencespb.ChasmNode{
176 > Metadata: &persistencespb.ChasmNodeMetadata{
177 > InitialVersionedTransition: &versionedTransition,
178 > LastUpdateVersionedTransition: &versionedTransition,
179 > Attributes: &persistencespb.ChasmNodeMetadata_DataAttributes{},
180 > },
181 > Data: blob,
182 > }
183 > }
184
185 func RandomExecutionInfo(
189 lastWriteVersion int64,
190 branchToken []byte,
191 > ) *persistencespb.WorkflowExecutionInfo { util.go
192 > var executionInfo persistencespb.WorkflowExecutionInfo
193 > _ = fakedata.FakeStruct(&executionInfo)
194 > executionInfo.NamespaceId = namespaceID
195 > executionInfo.WorkflowId = workflowID
196 >
197 > if branchToken != nil {
198 > executionInfo.VersionHistories = RandomVersionHistory(eventID, lastWriteVersion, branchToken) util.go
199 > } else { util.go
200 executionInfo.VersionHistories = versionhistory.NewVersionHistories(&historyspb.VersionHistory{})
201 }
202 > executionInfo.TransitionHistory = []*persistencespb.VersionedTransition{{ util.go
203 > NamespaceFailoverVersion: lastWriteVersion,
204 > TransitionCount: rand.Int63(),
205 > }}
206 > return &executionInfo
207 }
208
212 status enumspb.WorkflowExecutionStatus,
213 lastWriteVersion int64,
214 > ) *persistencespb.WorkflowExecutionState { util.go
215 > createRequestID := uuid.NewString()
216 > return &persistencespb.WorkflowExecutionState{
217 > CreateRequestId: createRequestID,
218 > RunId: runID,
219 > State: state,
220 > Status: status,
221 > LastUpdateVersionedTransition: &persistencespb.VersionedTransition{
222 > NamespaceFailoverVersion: lastWriteVersion,
223 > TransitionCount: rand.Int63(),
224 > },
225 > RequestIds: map[string]*persistencespb.RequestIDInfo{
226 > createRequestID: {
227 > EventType: enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED,
228 > EventId: common.FirstEventID,
229 > },
230 > uuid.NewString(): {
231 > EventType: enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_OPTIONS_UPDATED,
232 > EventId: common.BufferedEventID,
233 > },
234 > },
235 > }
236 > }
237
238 > func RandomInt64ActivityInfoMap() map[int64]*persistencespb.ActivityInfo { util.go
239 > return map[int64]*persistencespb.ActivityInfo{
240 > rand.Int63(): RandomActivityInfo(),
241 > }
242 > }
243
244 > func RandomStringTimerInfoMap() map[string]*persistencespb.TimerInfo { util.go
245 > return map[string]*persistencespb.TimerInfo{
246 > uuid.New().String(): RandomTimerInfo(),
247 > }
248 > }
249
250 > func RandomInt64ChildExecutionInfoMap() map[int64]*persistencespb.ChildExecutionInfo { util.go
251 > return map[int64]*persistencespb.ChildExecutionInfo{
252 > rand.Int63(): RandomChildExecutionInfo(),
253 > }
254 > }
255
256 > func RandomInt64RequestCancelInfoMap() map[int64]*persistencespb.RequestCancelInfo { util.go
257 > return map[int64]*persistencespb.RequestCancelInfo{
258 > rand.Int63(): RandomRequestCancelInfo(),
259 > }
260 > }
261
262 > func RandomInt64SignalInfoMap() map[int64]*persistencespb.SignalInfo { util.go
263 > return map[int64]*persistencespb.SignalInfo{
264 > rand.Int63(): RandomSignalInfo(),
265 > }
266 > }
267
268 > func RandomActivityInfo() *persistencespb.ActivityInfo { util.go
269 > var activityInfo persistencespb.ActivityInfo
270 > _ = fakedata.FakeStruct(&activityInfo)
271 > return &activityInfo
272 > }
273
274 > func RandomTimerInfo() *persistencespb.TimerInfo { util.go
275 > var timerInfo persistencespb.TimerInfo
276 > _ = fakedata.FakeStruct(&timerInfo)
277 > return &timerInfo
278 > }
279
280 > func RandomChildExecutionInfo() *persistencespb.ChildExecutionInfo { util.go
281 > var childExecutionInfo persistencespb.ChildExecutionInfo
282 > _ = fakedata.FakeStruct(&childExecutionInfo)
283 > return &childExecutionInfo
284 > }
285
286 > func RandomRequestCancelInfo() *persistencespb.RequestCancelInfo { util.go
287 > var requestCancelInfo persistencespb.RequestCancelInfo
288 > _ = fakedata.FakeStruct(&requestCancelInfo)
289 > return &requestCancelInfo
290 > }
291
292 > func RandomSignalInfo() *persistencespb.SignalInfo { util.go
293 > var signalInfo persistencespb.SignalInfo
294 > _ = fakedata.FakeStruct(&signalInfo)
295 > return &signalInfo
296 > }
297
298 > func RandomHistoryEvent(eventID int64, version int64) *historypb.HistoryEvent { util.go
299 > var historyEvent historypb.HistoryEvent
300 > _ = fakedata.FakeStruct(&historyEvent)
301 > historyEvent.EventId = eventID
302 > historyEvent.Version = version
303 > return &historyEvent
304 > }
305
306 func RandomResetPoints() *workflowpb.ResetPoints {
331 lastWriteVersion int64,
332 branchToken []byte,
333 > ) *historyspb.VersionHistories { util.go
334 > return &historyspb.VersionHistories{
335 > CurrentVersionHistoryIndex: 0,
336 > Histories: []*historyspb.VersionHistory{{
337 > BranchToken: branchToken,
338 > Items: []*historyspb.VersionHistoryItem{{
339 > EventId: eventID,
340 > Version: lastWriteVersion,
341 > }},
342 > }},
343 > }
344 > }
345
346 func RandomBranchToken(
349 runID string,
350 historyBranchUtil p.HistoryBranchUtil,
351 > ) []byte { util.go
352 > branchToken, _ := historyBranchUtil.NewHistoryBranch(
353 > namespaceID,
354 > workflowID,
355 > runID,
356 > uuid.NewString(),
357 > nil,
358 > nil,
359 > 0,
360 > 0,
361 > 0,
362 > )
363 > return branchToken
364 > }
365
366 func RandomTime() *timestamppb.Timestamp {
go.temporal.io/server/common/persistence/serialization/serializer.go 119 covered LOC · 44 ranges

Open complete file

139 )
140
141 > func NewSerializer() Serializer { serializer.go
142 > return &serializerImpl{encodingType: encodingTypeFromEnv()}
143 > }
144
145 func (t *serializerImpl) EncodingType() enumspb.EncodingType {
191 }
192
193 > func (t *serializerImpl) SerializeEvents(events []*historypb.HistoryEvent) (*commonpb.DataBlob, error) { serializer.go
194 > return t.serialize(&historypb.History{Events: events})
195 > }
196
197 > func (t *serializerImpl) DeserializeEvents(data *commonpb.DataBlob) ([]*historypb.HistoryEvent, error) { serializer.go
198 > if data == nil {
199 return nil, nil
200 }
201 > if len(data.Data) == 0 { serializer.go
202 return nil, nil
203 }
204
205 > events := &historypb.History{} serializer.go
206 > err := Decode(data, events)
207 > if err != nil {
208 return nil, err
209 }
210 > return events.Events, nil serializer.go
211 }
212
288 }
289
290 > func (t *serializerImpl) serialize(p proto.Message) (*commonpb.DataBlob, error) { serializer.go
291 > if p == nil {
292 return nil, nil
293 }
294 > blob, err := encodeBlob(p, t.encodingType) serializer.go
295 > if err != nil {
296 return nil, NewSerializationError(t.encodingType, err)
297 }
298 > return blob, nil serializer.go
299 }
300
372 func (e *DeserializationError) IsTerminalTaskError() bool { return true }
373
374 > func (t *serializerImpl) ShardInfoToBlob(info *persistencespb.ShardInfo) (*commonpb.DataBlob, error) { serializer.go
375 > return encodeBlob(info, t.encodingType)
376 > }
377
378 > func (t *serializerImpl) ShardInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.ShardInfo, error) { serializer.go
379 > shardInfo := &persistencespb.ShardInfo{}
380 > err := Decode(data, shardInfo)
381 >
382 > if err != nil {
383 return nil, err
384 }
385
386 > if shardInfo.GetReplicationDlqAckLevel() == nil { serializer.go
387 > shardInfo.ReplicationDlqAckLevel = make(map[string]int64) serializer.go
388 > }
389
390 > if shardInfo.GetQueueStates() == nil { serializer.go
391 > shardInfo.QueueStates = make(map[int32]*persistencespb.QueueState) serializer.go
392 > }
393 > for _, queueState := range shardInfo.QueueStates { serializer.go
394 if queueState.ReaderStates == nil {
395 queueState.ReaderStates = make(map[int64]*persistencespb.QueueReaderState)
414 }
415
416 > func (t *serializerImpl) HistoryTreeInfoToBlob(info *persistencespb.HistoryTreeInfo) (*commonpb.DataBlob, error) { serializer.go
417 > return encodeBlob(info, t.encodingType)
418 > }
419
420 func (t *serializerImpl) HistoryTreeInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.HistoryTreeInfo, error) {
423 }
424
425 > func (t *serializerImpl) HistoryBranchToBlob(info *persistencespb.HistoryBranch) (*commonpb.DataBlob, error) { serializer.go
426 > return encodeBlob(info, t.encodingType)
427 > }
428
429 // NOTE: HistoryBranch does not have an encoding type; so we use the serializer's encoding type.
430 > func (t *serializerImpl) HistoryBranchFromBlob(data []byte) (*persistencespb.HistoryBranch, error) { serializer.go
431 > result := &persistencespb.HistoryBranch{}
432 > return result, Decode(&commonpb.DataBlob{Data: data, EncodingType: t.encodingType}, result)
433 > }
434
435 > func (t *serializerImpl) WorkflowExecutionInfoToBlob(info *persistencespb.WorkflowExecutionInfo) (*commonpb.DataBlob, error) { serializer.go
436 > return encodeBlob(info, t.encodingType)
437 > }
438
439 > func (t *serializerImpl) WorkflowExecutionInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.WorkflowExecutionInfo, error) { serializer.go
440 > result := &persistencespb.WorkflowExecutionInfo{}
441 > err := Decode(data, result)
442 > if err != nil {
443 return nil, err
444 }
445 // Proto serialization replaces empty maps with nils, ensure this map is never nil.
446 > if result.SubStateMachinesByType == nil { serializer.go
447 > result.SubStateMachinesByType = make(map[string]*persistencespb.StateMachineMap) serializer.go
448 > }
449 > return result, nil serializer.go
450 }
451
452 > func (t *serializerImpl) WorkflowExecutionStateToBlob(info *persistencespb.WorkflowExecutionState) (*commonpb.DataBlob, error) { serializer.go
453 > return encodeBlob(info, t.encodingType)
454 > }
455
456 > func (t *serializerImpl) WorkflowExecutionStateFromBlob(data *commonpb.DataBlob) (*persistencespb.WorkflowExecutionState, error) { serializer.go
457 > result := &persistencespb.WorkflowExecutionState{}
458 > if err := Decode(data, result); err != nil {
459 return nil, err
460 }
461 // Initialize the WorkflowExecutionStateDetails for old records.
462 > if result.RequestIds == nil { serializer.go
463 result.RequestIds = make(map[string]*persistencespb.RequestIDInfo, 1)
464 }
465 > if result.CreateRequestId != "" && result.RequestIds[result.CreateRequestId] == nil { serializer.go
466 result.RequestIds[result.CreateRequestId] = &persistencespb.RequestIDInfo{
467 EventType: enumspb.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED,
469 }
470 }
471 > return result, nil serializer.go
472 }
473
474 > func (t *serializerImpl) ActivityInfoToBlob(info *persistencespb.ActivityInfo) (*commonpb.DataBlob, error) { serializer.go
475 > return encodeBlob(info, t.encodingType)
476 > }
477
478 > func (t *serializerImpl) ActivityInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.ActivityInfo, error) { serializer.go
479 > result := &persistencespb.ActivityInfo{}
480 > return result, Decode(data, result)
481 > }
482
483 > func (t *serializerImpl) ChildExecutionInfoToBlob(info *persistencespb.ChildExecutionInfo) (*commonpb.DataBlob, error) { serializer.go
484 > return encodeBlob(info, t.encodingType)
485 > }
486
487 > func (t *serializerImpl) ChildExecutionInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.ChildExecutionInfo, error) { serializer.go
488 > result := &persistencespb.ChildExecutionInfo{}
489 > return result, Decode(data, result)
490 > }
491
492 > func (t *serializerImpl) SignalInfoToBlob(info *persistencespb.SignalInfo) (*commonpb.DataBlob, error) { serializer.go
493 > return encodeBlob(info, t.encodingType)
494 > }
495
496 > func (t *serializerImpl) SignalInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.SignalInfo, error) { serializer.go
497 > result := &persistencespb.SignalInfo{}
498 > return result, Decode(data, result)
499 > }
500
501 > func (t *serializerImpl) RequestCancelInfoToBlob(info *persistencespb.RequestCancelInfo) (*commonpb.DataBlob, error) { serializer.go
502 > return encodeBlob(info, t.encodingType)
503 > }
504
505 > func (t *serializerImpl) RequestCancelInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.RequestCancelInfo, error) { serializer.go
506 > result := &persistencespb.RequestCancelInfo{}
507 > return result, Decode(data, result)
508 > }
509
510 > func (t *serializerImpl) TimerInfoToBlob(info *persistencespb.TimerInfo) (*commonpb.DataBlob, error) { serializer.go
511 > return encodeBlob(info, t.encodingType)
512 > }
513
514 > func (t *serializerImpl) TimerInfoFromBlob(data *commonpb.DataBlob) (*persistencespb.TimerInfo, error) { serializer.go
515 > result := &persistencespb.TimerInfo{}
516 > return result, Decode(data, result)
517 > }
518
519 func (t *serializerImpl) TaskInfoToBlob(info *persistencespb.AllocatedTaskInfo) (*commonpb.DataBlob, error) {
544 }
545
546 > func (t *serializerImpl) ChecksumToBlob(checksum *persistencespb.Checksum) (*commonpb.DataBlob, error) { serializer.go
547 > // nil is replaced with empty object because it is not supported for "checksum" field in DB.
548 > if checksum == nil {
549 > checksum = &persistencespb.Checksum{}
550 > }
551 > return encodeBlob(checksum, t.encodingType)
552 }
553
554 > func (t *serializerImpl) ChecksumFromBlob(data *commonpb.DataBlob) (*persistencespb.Checksum, error) { serializer.go
555 > result := &persistencespb.Checksum{}
556 > err := Decode(data, result)
557 > if err != nil || result.GetFlavor() == enumsspb.CHECKSUM_FLAVOR_UNSPECIFIED {
558 > // If result is an empty struct (Flavor is unspecified), replace it with nil, because everywhere in the code checksum is pointer type.
559 > return nil, err
560 > }
561 return result, nil
562 }
606 }
607
608 > func (t *serializerImpl) ChasmNodeToBlob(node *persistencespb.ChasmNode) (*commonpb.DataBlob, error) { serializer.go
609 > return encodeBlob(node, t.encodingType)
610 > }
611
612 > func (t *serializerImpl) ChasmNodeFromBlob(blob *commonpb.DataBlob) (*persistencespb.ChasmNode, error) { serializer.go
613 > result := &persistencespb.ChasmNode{}
614 > return result, Decode(blob, result)
615 > }
616
617 func (t *serializerImpl) TransferTaskInfoToBlob(info *persistencespb.TransferTaskInfo) (*commonpb.DataBlob, error) {
go.temporal.io/server/chasm/search_attribute.go 102 covered LOC · 15 ranges

Open complete file

136 }
137
138 > func newSearchAttributeFieldBool(index int) SearchAttributeFieldBool { search_attribute.go
139 > return SearchAttributeFieldBool{
140 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_BOOL, index),
141 > }
142 > }
143
144 // SearchAttributeFieldDateTime is a search attribute field for a datetime value.
147 }
148
149 > func newSearchAttributeFieldDateTime(index int) SearchAttributeFieldDateTime { search_attribute.go
150 > return SearchAttributeFieldDateTime{
151 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_DATETIME, index),
152 > }
153 > }
154
155 // SearchAttributeFieldInt is a search attribute field for an integer value.
158 }
159
160 > func newSearchAttributeFieldInt(index int) SearchAttributeFieldInt { search_attribute.go
161 > return SearchAttributeFieldInt{
162 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_INT, index),
163 > }
164 > }
165
166 // SearchAttributeFieldDouble is a search attribute field for a double value.
169 }
170
171 > func newSearchAttributeFieldDouble(index int) SearchAttributeFieldDouble { search_attribute.go
172 > return SearchAttributeFieldDouble{
173 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_DOUBLE, index),
174 > }
175 > }
176
177 // SearchAttributeFieldKeyword is a search attribute field for a keyword value.
180 }
181
182 > func newSearchAttributeFieldKeyword(index int) SearchAttributeFieldKeyword { search_attribute.go
183 > return SearchAttributeFieldKeyword{
184 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_KEYWORD, index),
185 > }
186 > }
187
188 > func newSearchAttributeFieldLowCardinalityKeyword(index int) SearchAttributeFieldKeyword { search_attribute.go
189 > return SearchAttributeFieldKeyword{
190 > field: fmt.Sprintf("%s%s%02d", sadefs.ReservedPrefix, "LowCardinalityKeyword", index),
191 > }
192 > }
193
194 // SearchAttributeFieldKeywordList is a search attribute field for a keyword list value.
197 }
198
199 > func newSearchAttributeFieldKeywordList(index int) SearchAttributeFieldKeywordList { search_attribute.go
200 > return SearchAttributeFieldKeywordList{
201 > field: resolveFieldName(enumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST, index),
202 > }
203 > }
204
205 // SearchAttributeFieldText is a search attribute field for a text value.
214 }
215
216 > func resolveFieldName(valueType enumspb.IndexedValueType, index int) string { search_attribute.go
217 > // Columns are named like TemporalBool01, TemporalDatetime01, TemporalDouble01, TemporalInt01.
218 > return fmt.Sprintf("%s%s%02d", sadefs.ReservedPrefix, valueType.String(), index)
219 > }
220
221 func (s searchAttributeDefinition) definition() searchAttributeDefinition {
239 }
240
241 > func newSearchAttributeBoolByField(field string) SearchAttributeBool { search_attribute.go
242 > return SearchAttributeBool{
243 > searchAttributeDefinition: searchAttributeDefinition{
244 > alias: field,
245 > field: field,
246 > valueType: enumspb.INDEXED_VALUE_TYPE_BOOL,
247 > },
248 > }
249 > }
250
251 // Value sets the boolean value of the search attribute.
266
267 // NewSearchAttributeDateTime creates a new date time search attribute given a predefined chasm field
268 > func NewSearchAttributeDateTime(alias string, datetimeField SearchAttributeFieldDateTime) SearchAttributeDateTime { search_attribute.go
269 > return SearchAttributeDateTime{
270 > searchAttributeDefinition: searchAttributeDefinition{
271 > alias: alias,
272 > field: datetimeField.field,
273 > valueType: enumspb.INDEXED_VALUE_TYPE_DATETIME,
274 > },
275 > }
276 > }
277
278 > func newSearchAttributeDateTimeByField(field string) SearchAttributeDateTime { search_attribute.go
279 > return SearchAttributeDateTime{
280 > searchAttributeDefinition: searchAttributeDefinition{
281 > alias: field,
282 > field: field,
283 > valueType: enumspb.INDEXED_VALUE_TYPE_DATETIME,
284 > },
285 > }
286 > }
287
288 // Value sets the date time value of the search attribute.
303
304 // NewSearchAttributeInt creates a new integer search attribute given a predefined chasm field
305 > func NewSearchAttributeInt(alias string, intField SearchAttributeFieldInt) SearchAttributeInt { search_attribute.go
306 > return SearchAttributeInt{
307 > searchAttributeDefinition: searchAttributeDefinition{
308 > alias: alias,
309 > field: intField.field,
310 > valueType: enumspb.INDEXED_VALUE_TYPE_INT,
311 > },
312 > }
313 > }
314
315 // Value sets the integer value of the search attribute.
367
368 // NewSearchAttributeKeyword creates a new keyword search attribute given a predefined chasm field
369 > func NewSearchAttributeKeyword(alias string, keywordField SearchAttributeFieldKeyword) SearchAttributeKeyword { search_attribute.go
370 > return SearchAttributeKeyword{
371 > searchAttributeDefinition: searchAttributeDefinition{
372 > alias: alias,
373 > field: keywordField.field,
374 > valueType: enumspb.INDEXED_VALUE_TYPE_KEYWORD,
375 > },
376 > }
377 > }
378
379 > func newSearchAttributeKeywordByField(field string) SearchAttributeKeyword { search_attribute.go
380 > return SearchAttributeKeyword{
381 > searchAttributeDefinition: searchAttributeDefinition{
382 > alias: field,
383 > field: field,
384 > valueType: enumspb.INDEXED_VALUE_TYPE_KEYWORD,
385 > },
386 > }
387 > }
388
389 // Value sets the string value of the search attribute.
414 }
415
416 > func newSearchAttributeKeywordListByField(field string) SearchAttributeKeywordList { search_attribute.go
417 > return SearchAttributeKeywordList{
418 > searchAttributeDefinition: searchAttributeDefinition{
419 > alias: field,
420 > field: field,
421 > valueType: enumspb.INDEXED_VALUE_TYPE_KEYWORD_LIST,
422 > },
423 > }
424 > }
425
426 // Value sets the string list value of the search attribute.
go.temporal.io/server/api/persistence/v1/hsm.pb.go 92 covered LOC · 25 ranges

Open complete file

71 func (*StateMachineNode) ProtoMessage() {}
72
73 > func (x *StateMachineNode) ProtoReflect() protoreflect.Message { hsm.pb.go
74 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[0]
75 > if x != nil {
76 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) hsm.pb.go
77 > if ms.LoadMessageInfo() == nil {
78 > ms.StoreMessageInfo(mi)
79 > }
80 > return ms
81 }
82 > return mi.MessageOf(x) hsm.pb.go
83 }
84
147 func (*StateMachineMap) ProtoMessage() {}
148
149 > func (x *StateMachineMap) ProtoReflect() protoreflect.Message { hsm.pb.go
150 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[1]
151 > if x != nil {
152 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) hsm.pb.go
153 > if ms.LoadMessageInfo() == nil {
154 > ms.StoreMessageInfo(mi)
155 > }
156 > return ms
157 }
158 > return mi.MessageOf(x) hsm.pb.go
159 }
160
194 func (*StateMachineKey) ProtoMessage() {}
195
196 > func (x *StateMachineKey) ProtoReflect() protoreflect.Message { hsm.pb.go
197 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[2]
198 > if x != nil {
199 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
200 if ms.LoadMessageInfo() == nil {
203 return ms
204 }
205 > return mi.MessageOf(x) hsm.pb.go
206 }
207
272 func (*StateMachineRef) ProtoMessage() {}
273
274 > func (x *StateMachineRef) ProtoReflect() protoreflect.Message { hsm.pb.go
275 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[3]
276 > if x != nil {
277 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
278 if ms.LoadMessageInfo() == nil {
281 return ms
282 }
283 > return mi.MessageOf(x) hsm.pb.go
284 }
285
349 func (*StateMachineTaskInfo) ProtoMessage() {}
350
351 > func (x *StateMachineTaskInfo) ProtoReflect() protoreflect.Message { hsm.pb.go
352 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[4]
353 > if x != nil {
354 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
355 if ms.LoadMessageInfo() == nil {
358 return ms
359 }
360 > return mi.MessageOf(x) hsm.pb.go
361 }
362
416 func (*StateMachineTimerGroup) ProtoMessage() {}
417
418 > func (x *StateMachineTimerGroup) ProtoReflect() protoreflect.Message { hsm.pb.go
419 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[5]
420 > if x != nil {
421 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
422 if ms.LoadMessageInfo() == nil {
425 return ms
426 }
427 > return mi.MessageOf(x) hsm.pb.go
428 }
429
478 func (*VersionedTransition) ProtoMessage() {}
479
480 > func (x *VersionedTransition) ProtoReflect() protoreflect.Message { hsm.pb.go
481 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[6]
482 > if x != nil {
483 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) hsm.pb.go
484 > if ms.LoadMessageInfo() == nil {
485 > ms.StoreMessageInfo(mi)
486 > }
487 > return ms
488 }
489 > return mi.MessageOf(x) hsm.pb.go
490 }
491
531 func (*StateMachineTombstoneBatch) ProtoMessage() {}
532
533 > func (x *StateMachineTombstoneBatch) ProtoReflect() protoreflect.Message { hsm.pb.go
534 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[7]
535 > if x != nil {
536 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) hsm.pb.go
537 > if ms.LoadMessageInfo() == nil {
538 > ms.StoreMessageInfo(mi)
539 > }
540 > return ms
541 }
542 > return mi.MessageOf(x) hsm.pb.go
543 }
544
592 func (*StateMachineTombstone) ProtoMessage() {}
593
594 > func (x *StateMachineTombstone) ProtoReflect() protoreflect.Message { hsm.pb.go
595 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[8]
596 > if x != nil {
597 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
598 if ms.LoadMessageInfo() == nil {
601 return ms
602 }
603 > return mi.MessageOf(x) hsm.pb.go
604 }
605
763 func (*StateMachinePath) ProtoMessage() {}
764
765 > func (x *StateMachinePath) ProtoReflect() protoreflect.Message { hsm.pb.go
766 > mi := &file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[9]
767 > if x != nil {
768 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
769 if ms.LoadMessageInfo() == nil {
772 return ms
773 }
774 > return mi.MessageOf(x) hsm.pb.go
775 }
776
895 }
896
897 > func init() { file_temporal_server_api_persistence_v1_hsm_proto_init() } hsm.pb.go
898 > func file_temporal_server_api_persistence_v1_hsm_proto_init() {
899 > if File_temporal_server_api_persistence_v1_hsm_proto != nil {
900 > return
901 > }
902 > file_temporal_server_api_persistence_v1_hsm_proto_msgTypes[8].OneofWrappers = []any{
903 > (*StateMachineTombstone_ActivityScheduledEventId)(nil),
904 > (*StateMachineTombstone_TimerId)(nil),
905 > (*StateMachineTombstone_ChildExecutionInitiatedEventId)(nil),
906 > (*StateMachineTombstone_RequestCancelInitiatedEventId)(nil),
907 > (*StateMachineTombstone_SignalExternalInitiatedEventId)(nil),
908 > (*StateMachineTombstone_UpdateId)(nil),
909 > (*StateMachineTombstone_StateMachinePath)(nil),
910 > (*StateMachineTombstone_ChasmNodePath)(nil),
911 > }
912 > type x struct{}
913 > out := protoimpl.TypeBuilder{
914 > File: protoimpl.DescBuilder{
915 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
916 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_hsm_proto_rawDesc), len(file_temporal_server_api_persistence_v1_hsm_proto_rawDesc)),
917 > NumEnums: 0,
918 > NumMessages: 12,
919 > NumExtensions: 0,
920 > NumServices: 0,
921 > },
922 > GoTypes: file_temporal_server_api_persistence_v1_hsm_proto_goTypes,
923 > DependencyIndexes: file_temporal_server_api_persistence_v1_hsm_proto_depIdxs,
924 > MessageInfos: file_temporal_server_api_persistence_v1_hsm_proto_msgTypes,
925 > }.Build()
926 > File_temporal_server_api_persistence_v1_hsm_proto = out.File
927 > file_temporal_server_api_persistence_v1_hsm_proto_goTypes = nil
928 > file_temporal_server_api_persistence_v1_hsm_proto_depIdxs = nil
929 }
go.temporal.io/server/common/persistence/cassandra/history_store.go 90 covered LOC · 18 ranges

Open complete file

53 session gocql.Session,
54 serializer serialization.Serializer,
55 > ) *HistoryStore { history_store.go
56 > return &HistoryStore{
57 > Session: session,
58 > HistoryBranchUtil: p.NewHistoryBranchUtil(serializer),
59 > }
60 > }
61
62 // AppendHistoryNodes upsert a batch of events as a single node to a history branch
65 ctx context.Context,
66 request *p.InternalAppendHistoryNodesRequest,
67 > ) error { history_store.go
68 > branchInfo := request.BranchInfo
69 > node := request.Node
70 >
71 > if !request.IsNewBranch {
72 > query := h.Session.Query(v2templateUpsertHistoryNode, history_store.go
73 > branchInfo.TreeId,
74 > branchInfo.BranchId,
75 > node.NodeID,
76 > node.PrevTransactionID,
77 > node.TransactionID,
78 > node.Events.Data,
79 > node.Events.EncodingType.String(),
80 > ).WithContext(ctx)
81 > if err := query.Exec(); err != nil {
82 return convertTimeoutError(gocql.ConvertError("AppendHistoryNodes", err))
83 }
84 > return nil history_store.go
85 }
86
87 > treeInfoDataBlob := request.TreeInfo history_store.go
88 > batch := h.Session.NewBatch(gocql.LoggedBatch).WithContext(ctx)
89 > batch.Query(v2templateInsertTree,
90 > branchInfo.TreeId,
91 > branchInfo.BranchId,
92 > treeInfoDataBlob.Data,
93 > treeInfoDataBlob.EncodingType.String(),
94 > )
95 > batch.Query(v2templateUpsertHistoryNode,
96 > branchInfo.TreeId,
97 > branchInfo.BranchId,
98 > node.NodeID,
99 > node.PrevTransactionID,
100 > node.TransactionID,
101 > node.Events.Data,
102 > node.Events.EncodingType.String(),
103 > )
104 > if err := h.Session.ExecuteBatch(batch); err != nil {
105 return convertTimeoutError(gocql.ConvertError("AppendHistoryNodes", err))
106 }
107 > return nil history_store.go
108 }
109
142 ctx context.Context,
143 request *p.InternalReadHistoryBranchRequest,
144 > ) (*p.InternalReadHistoryBranchResponse, error) { history_store.go
145 > branch, err := h.ParseHistoryBranchInfo(request.BranchToken)
146 > if err != nil {
147 return nil, err
148 }
149
150 > treeID, err := primitives.ValidateUUID(branch.TreeId) history_store.go
151 > if err != nil {
152 return nil, serviceerror.NewInternalf("ReadHistoryBranch - Gocql TreeId UUID cast failed. Error: %v", err)
153 }
154
155 > branchID, err := primitives.ValidateUUID(request.BranchID) history_store.go
156 > if err != nil {
157 return nil, serviceerror.NewInternalf("ReadHistoryBranch - Gocql BranchId UUID cast failed. Error: %v", err)
158 }
159
160 > var queryString string history_store.go
161 > if request.MetadataOnly {
162 queryString = v2templateReadHistoryNodeMetadata
163 > } else if request.ReverseOrder { history_store.go
164 queryString = v2templateReadHistoryNodeReverse
165 > } else { history_store.go
166 > queryString = v2templateReadHistoryNode
167 > }
168
169 > query := h.Session.Query(queryString, treeID, branchID, request.MinNodeID, request.MaxNodeID).WithContext(ctx) history_store.go
170 >
171 > iter := query.PageSize(request.PageSize).PageState(request.NextPageToken).Iter()
172 > var pagingToken []byte
173 > if len(iter.PageState()) > 0 {
174 pagingToken = iter.PageState()
175 }
176
177 > nodes := make([]p.InternalHistoryNode, 0, request.PageSize) history_store.go
178 > message := make(map[string]any)
179 > for iter.MapScan(message) {
180 > nodes = append(nodes, convertHistoryNode(message))
181 > message = make(map[string]any)
182 > }
183
184 > if err := iter.Close(); err != nil { history_store.go
185 return nil, gocql.ConvertError("ReadHistoryBranch", err)
186 }
187
188 > return &p.InternalReadHistoryBranchResponse{ history_store.go
189 > Nodes: nodes,
190 > NextPageToken: pagingToken,
191 > }, nil
192 }
193
397 }
398
399 > func (h *HistoryStore) GetHistoryBranchUtil() p.HistoryBranchUtil { history_store.go
400 > return h.HistoryBranchUtil
401 > }
402
403 func convertHistoryNode(
404 message map[string]any,
405 > ) p.InternalHistoryNode { history_store.go
406 > nodeID := message["node_id"].(int64)
407 > prevTxnID := message["prev_txn_id"].(int64)
408 > txnID := message["txn_id"].(int64)
409 >
410 > var data []byte
411 > var dataEncoding string
412 > if _, ok := message["data"]; ok {
413 > data = message["data"].([]byte)
414 > dataEncoding = message["data_encoding"].(string)
415 > }
416 > return p.InternalHistoryNode{
417 > NodeID: nodeID,
418 > PrevTransactionID: prevTxnID,
419 > TransactionID: txnID,
420 > Events: p.NewDataBlob(data, dataEncoding),
421 > }
422 }
423
go.temporal.io/server/common/persistence/tests/cassandra_test_util.go 84 covered LOC · 15 ranges

Open complete file

50 )
51
52 > func setUpCassandraTest(t *testing.T) (CassandraTestData, func()) { cassandra_test_util.go
53 > var testData CassandraTestData
54 > testData.Cfg = NewCassandraConfig()
55 > testData.Logger = log.NewZapLogger(zaptest.NewLogger(t))
56 > SetUpCassandraDatabase(t, testData.Cfg, testData.Logger)
57 > SetUpCassandraSchema(t, testData.Cfg, testData.Logger)
58 >
59 > testData.Factory = cassandra.NewFactory(
60 > *testData.Cfg,
61 > resolver.NewNoopResolver(),
62 > testCassandraClusterName,
63 > testData.Logger,
64 > metrics.NoopMetricsHandler,
65 > serialization.NewSerializer(),
66 > )
67 >
68 > tearDown := func() {
69 > testData.Factory.Close()
70 > TearDownCassandraKeyspace(t, testData.Cfg)
71 > }
72
73 > return testData, tearDown cassandra_test_util.go
74 }
75
76 > func SetUpCassandraDatabase(t *testing.T, cfg *config.Cassandra, logger log.Logger) { cassandra_test_util.go
77 > adminCfg := *cfg
78 > // NOTE need to connect with empty name to create new database
79 > adminCfg.Keyspace = "system"
80 >
81 > session, err := commongocql.NewSession(
82 > func() (*gocql.ClusterConfig, error) {
83 > return commongocql.NewCassandraCluster(adminCfg, resolver.NewNoopResolver())
84 > },
85 logger,
86 metrics.NoopMetricsHandler,
87 )
88 > if err != nil { cassandra_test_util.go
89 t.Fatalf("unable to create Cassandra session: %v", err)
90 }
91 > defer session.Close() cassandra_test_util.go
92 >
93 > if err := cassandra.CreateCassandraKeyspace(
94 > session,
95 > cfg.Keyspace,
96 > 1,
97 > true,
98 > log.NewNoopLogger(),
99 > ); err != nil {
100 t.Fatalf("unable to create Cassandra keyspace: %v", err)
101 }
102 }
103
104 > func SetUpCassandraSchema(t *testing.T, cfg *config.Cassandra, logger log.Logger) { cassandra_test_util.go
105 > ApplySchemaUpdate(t, cfg, testCassandraExecutionSchema, logger)
106 > }
107
108 > func ApplySchemaUpdate(t *testing.T, cfg *config.Cassandra, schemaFile string, logger log.Logger) { cassandra_test_util.go
109 > session, err := commongocql.NewSession(
110 > func() (*gocql.ClusterConfig, error) {
111 > return commongocql.NewCassandraCluster(*cfg, resolver.NewNoopResolver())
112 > },
113 logger,
114 metrics.NoopMetricsHandler,
115 )
116 > if err != nil { cassandra_test_util.go
117 t.Fatal(err)
118 }
119 > defer session.Close() cassandra_test_util.go
120 >
121 > schemaPath, err := filepath.Abs(schemaFile)
122 > if err != nil {
123 t.Fatal(err)
124 }
125
126 > statements, err := p.LoadAndSplitQuery([]string{schemaPath}) cassandra_test_util.go
127 > if err != nil {
128 t.Fatal(err)
129 }
130
131 > for _, stmt := range statements { cassandra_test_util.go
132 > if err = session.Query(stmt).Exec(); err != nil {
133 logger.Error(fmt.Sprintf("Unable to execute statement from file: %s\n %s", schemaFile, stmt))
134 t.Fatal(err)
137 }
138
139 > func TearDownCassandraKeyspace(t *testing.T, cfg *config.Cassandra) { cassandra_test_util.go
140 > adminCfg := *cfg
141 > // NOTE need to connect with empty name to create new database
142 > adminCfg.Keyspace = "system"
143 >
144 > session, err := commongocql.NewSession(
145 > func() (*gocql.ClusterConfig, error) {
146 > return commongocql.NewCassandraCluster(adminCfg, resolver.NewNoopResolver())
147 > },
148 log.NewNoopLogger(),
149 metrics.NoopMetricsHandler,
150 )
151 > if err != nil { cassandra_test_util.go
152 t.Fatalf("unable to create Cassandra session: %v", err)
153 }
154 > defer session.Close() cassandra_test_util.go
155 >
156 > if err := cassandra.DropCassandraKeyspace(
157 > session,
158 > cfg.Keyspace,
159 > log.NewNoopLogger(),
160 > ); err != nil {
161 t.Fatalf("unable to drop Cassandra keyspace: %v", err)
162 }
221
222 // NewCassandraConfig returns a new Cassandra config for test
223 > func NewCassandraConfig() *config.Cassandra { cassandra_test_util.go
224 > return &config.Cassandra{
225 > User: testCassandraUser,
226 > Password: testCassandraPassword,
227 > Hosts: environment.GetCassandraAddress(),
228 > Port: environment.GetCassandraPort(),
229 > Keyspace: testCassandraDatabaseNamePrefix + shuffle.String(testCassandraDatabaseNameSuffix),
230 > ConnectTimeout: 30 * time.Second,
231 > }
232 > }
go.temporal.io/server/api/persistence/v1/predicates.pb.go 83 covered LOC · 23 ranges

Open complete file

57 func (*Predicate) ProtoMessage() {}
58
59 > func (x *Predicate) ProtoReflect() protoreflect.Message { predicates.pb.go
60 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[0]
61 > if x != nil {
62 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
63 > if ms.LoadMessageInfo() == nil {
64 > ms.StoreMessageInfo(mi)
65 > }
66 > return ms
67 }
68 > return mi.MessageOf(x) predicates.pb.go
69 }
70
261 func (*UniversalPredicateAttributes) ProtoMessage() {}
262
263 > func (x *UniversalPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
264 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[1]
265 > if x != nil {
266 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
267 if ms.LoadMessageInfo() == nil {
297 func (*EmptyPredicateAttributes) ProtoMessage() {}
298
299 > func (x *EmptyPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
300 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[2]
301 > if x != nil {
302 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
303 if ms.LoadMessageInfo() == nil {
334 func (*AndPredicateAttributes) ProtoMessage() {}
335
336 > func (x *AndPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
337 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[3]
338 > if x != nil {
339 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
340 if ms.LoadMessageInfo() == nil {
378 func (*OrPredicateAttributes) ProtoMessage() {}
379
380 > func (x *OrPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
381 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[4]
382 > if x != nil {
383 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
384 if ms.LoadMessageInfo() == nil {
422 func (*NotPredicateAttributes) ProtoMessage() {}
423
424 > func (x *NotPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
425 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[5]
426 > if x != nil {
427 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
428 if ms.LoadMessageInfo() == nil {
466 func (*NamespaceIdPredicateAttributes) ProtoMessage() {}
467
468 > func (x *NamespaceIdPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
469 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[6]
470 > if x != nil {
471 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
472 if ms.LoadMessageInfo() == nil {
510 func (*TaskTypePredicateAttributes) ProtoMessage() {}
511
512 > func (x *TaskTypePredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
513 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[7]
514 > if x != nil {
515 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
516 if ms.LoadMessageInfo() == nil {
554 func (*DestinationPredicateAttributes) ProtoMessage() {}
555
556 > func (x *DestinationPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
557 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[8]
558 > if x != nil {
559 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
560 if ms.LoadMessageInfo() == nil {
598 func (*OutboundTaskGroupPredicateAttributes) ProtoMessage() {}
599
600 > func (x *OutboundTaskGroupPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
601 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[9]
602 > if x != nil {
603 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
604 if ms.LoadMessageInfo() == nil {
642 func (*OutboundTaskPredicateAttributes) ProtoMessage() {}
643
644 > func (x *OutboundTaskPredicateAttributes) ProtoReflect() protoreflect.Message { predicates.pb.go
645 > mi := &file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[10]
646 > if x != nil {
647 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
648 if ms.LoadMessageInfo() == nil {
828 }
829
830 > func init() { file_temporal_server_api_persistence_v1_predicates_proto_init() } predicates.pb.go
831 > func file_temporal_server_api_persistence_v1_predicates_proto_init() {
832 > if File_temporal_server_api_persistence_v1_predicates_proto != nil {
833 > return
834 > }
835 > file_temporal_server_api_persistence_v1_predicates_proto_msgTypes[0].OneofWrappers = []any{
836 > (*Predicate_UniversalPredicateAttributes)(nil),
837 > (*Predicate_EmptyPredicateAttributes)(nil),
838 > (*Predicate_AndPredicateAttributes)(nil),
839 > (*Predicate_OrPredicateAttributes)(nil),
840 > (*Predicate_NotPredicateAttributes)(nil),
841 > (*Predicate_NamespaceIdPredicateAttributes)(nil),
842 > (*Predicate_TaskTypePredicateAttributes)(nil),
843 > (*Predicate_DestinationPredicateAttributes)(nil),
844 > (*Predicate_OutboundTaskGroupPredicateAttributes)(nil),
845 > (*Predicate_OutboundTaskPredicateAttributes)(nil),
846 > }
847 > type x struct{}
848 > out := protoimpl.TypeBuilder{
849 > File: protoimpl.DescBuilder{
850 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
851 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_predicates_proto_rawDesc), len(file_temporal_server_api_persistence_v1_predicates_proto_rawDesc)),
852 > NumEnums: 0,
853 > NumMessages: 12,
854 > NumExtensions: 0,
855 > NumServices: 0,
856 > },
857 > GoTypes: file_temporal_server_api_persistence_v1_predicates_proto_goTypes,
858 > DependencyIndexes: file_temporal_server_api_persistence_v1_predicates_proto_depIdxs,
859 > MessageInfos: file_temporal_server_api_persistence_v1_predicates_proto_msgTypes,
860 > }.Build()
861 > File_temporal_server_api_persistence_v1_predicates_proto = out.File
862 > file_temporal_server_api_persistence_v1_predicates_proto_goTypes = nil
863 > file_temporal_server_api_persistence_v1_predicates_proto_depIdxs = nil
864 }
go.temporal.io/server/api/persistence/v1/chasm.pb.go 82 covered LOC · 19 ranges

Open complete file

37 }
38
39 > func (x *ChasmNode) Reset() { chasm.pb.go
40 > *x = ChasmNode{}
41 > mi := &file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[0]
42 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
43 > ms.StoreMessageInfo(mi)
44 > }
45
46 func (x *ChasmNode) String() string {
50 func (*ChasmNode) ProtoMessage() {}
51
52 > func (x *ChasmNode) ProtoReflect() protoreflect.Message { chasm.pb.go
53 > mi := &file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[0]
54 > if x != nil {
55 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) chasm.pb.go
56 > if ms.LoadMessageInfo() == nil {
57 > ms.StoreMessageInfo(mi)
58 > }
59 > return ms
60 }
61 > return mi.MessageOf(x) chasm.pb.go
62 }
63
111 func (*ChasmNodeMetadata) ProtoMessage() {}
112
113 > func (x *ChasmNodeMetadata) ProtoReflect() protoreflect.Message { chasm.pb.go
114 > mi := &file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[1]
115 > if x != nil {
116 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) chasm.pb.go
117 > if ms.LoadMessageInfo() == nil {
118 > ms.StoreMessageInfo(mi)
119 > }
120 > return ms
121 }
122 > return mi.MessageOf(x) chasm.pb.go
123 }
124
250 func (*ChasmComponentAttributes) ProtoMessage() {}
251
252 > func (x *ChasmComponentAttributes) ProtoReflect() protoreflect.Message { chasm.pb.go
253 > mi := &file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[2]
254 > if x != nil {
255 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
256 if ms.LoadMessageInfo() == nil {
259 return ms
260 }
261 > return mi.MessageOf(x) chasm.pb.go
262 }
263
429 func (*ChasmDataAttributes) ProtoMessage() {}
430
431 > func (x *ChasmDataAttributes) ProtoReflect() protoreflect.Message { chasm.pb.go
432 > mi := &file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[5]
433 > if x != nil {
434 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) chasm.pb.go
435 > if ms.LoadMessageInfo() == nil {
436 > ms.StoreMessageInfo(mi)
437 > }
438 > return ms
439 }
440 > return mi.MessageOf(x) chasm.pb.go
441 }
442
465 func (*ChasmCollectionAttributes) ProtoMessage() {}
466
467 > func (x *ChasmCollectionAttributes) ProtoReflect() protoreflect.Message { chasm.pb.go
468 > mi := &file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[6]
469 > if x != nil {
470 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
471 if ms.LoadMessageInfo() == nil {
474 return ms
475 }
476 > return mi.MessageOf(x) chasm.pb.go
477 }
478
502 func (*ChasmPointerAttributes) ProtoMessage() {}
503
504 > func (x *ChasmPointerAttributes) ProtoReflect() protoreflect.Message { chasm.pb.go
505 > mi := &file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[7]
506 > if x != nil {
507 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
508 if ms.LoadMessageInfo() == nil {
511 return ms
512 }
513 > return mi.MessageOf(x) chasm.pb.go
514 }
515
571 func (*ChasmTaskInfo) ProtoMessage() {}
572
573 > func (x *ChasmTaskInfo) ProtoReflect() protoreflect.Message { chasm.pb.go
574 > mi := &file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[8]
575 > if x != nil {
576 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
577 if ms.LoadMessageInfo() == nil {
580 return ms
581 }
582 > return mi.MessageOf(x) chasm.pb.go
583 }
584
1180 }
1181
1182 > func init() { file_temporal_server_api_persistence_v1_chasm_proto_init() } chasm.pb.go
1183 > func file_temporal_server_api_persistence_v1_chasm_proto_init() {
1184 > if File_temporal_server_api_persistence_v1_chasm_proto != nil {
1185 > return
1186 > }
1187 > file_temporal_server_api_persistence_v1_hsm_proto_init()
1188 > file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[1].OneofWrappers = []any{
1189 > (*ChasmNodeMetadata_ComponentAttributes)(nil),
1190 > (*ChasmNodeMetadata_DataAttributes)(nil),
1191 > (*ChasmNodeMetadata_CollectionAttributes)(nil),
1192 > (*ChasmNodeMetadata_PointerAttributes)(nil),
1193 > }
1194 > file_temporal_server_api_persistence_v1_chasm_proto_msgTypes[10].OneofWrappers = []any{
1195 > (*ChasmNexusCompletion_Success)(nil),
1196 > (*ChasmNexusCompletion_Failure)(nil),
1197 > }
1198 > type x struct{}
1199 > out := protoimpl.TypeBuilder{
1200 > File: protoimpl.DescBuilder{
1201 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1202 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_chasm_proto_rawDesc), len(file_temporal_server_api_persistence_v1_chasm_proto_rawDesc)),
1203 > NumEnums: 0,
1204 > NumMessages: 15,
1205 > NumExtensions: 0,
1206 > NumServices: 0,
1207 > },
1208 > GoTypes: file_temporal_server_api_persistence_v1_chasm_proto_goTypes,
1209 > DependencyIndexes: file_temporal_server_api_persistence_v1_chasm_proto_depIdxs,
1210 > MessageInfos: file_temporal_server_api_persistence_v1_chasm_proto_msgTypes,
1211 > }.Build()
1212 > File_temporal_server_api_persistence_v1_chasm_proto = out.File
1213 > file_temporal_server_api_persistence_v1_chasm_proto_goTypes = nil
1214 > file_temporal_server_api_persistence_v1_chasm_proto_depIdxs = nil
1215 }
go.temporal.io/server/common/persistence/query_util.go 78 covered LOC · 27 ranges

Open complete file

37 func LoadAndSplitQuery(
38 filePaths []string,
39 > ) ([]string, error) { query_util.go
40 > var files []io.Reader
41 >
42 > for _, filePath := range filePaths {
43 > f, err := os.Open(filePath)
44 > if err != nil {
45 return nil, fmt.Errorf("error opening file %s: %w", filePath, err)
46 }
47 > files = append(files, f) query_util.go
48 }
49
50 > return LoadAndSplitQueryFromReaders(files) query_util.go
51 }
52
55 func LoadAndSplitQueryFromReaders(
56 readers []io.Reader,
57 > ) ([]string, error) { query_util.go
58 > result := make([]string, 0, querySliceDefaultSize)
59 > for _, r := range readers {
60 > content, err := io.ReadAll(r)
61 > if err != nil {
62 return nil, fmt.Errorf("error reading contents: %w", err)
63 }
64 > n := len(content) query_util.go
65 > contentStr := string(bytes.ToLower(content))
66 > for i, j := 0, 0; i < n; i = j {
67 > // stack to keep track of open parenthesis/blocks
68 > var st []byte
69 > var stmtBuilder strings.Builder
70 >
71 > stmtLoop:
72 > for ; j < n; j++ {
73 > switch contentStr[j] {
74 > case queryDelimiter: query_util.go
75 > if len(st) == 0 {
76 > j++
77 > break stmtLoop
78 }
79
80 > case sqlLeftParenthesis: query_util.go
81 > st = append(st, sqlLeftParenthesis)
82
83 > case sqlRightParenthesis: query_util.go
84 > if len(st) == 0 || st[len(st)-1] != sqlLeftParenthesis {
85 return nil, fmt.Errorf("error reading contents: unmatched right parenthesis")
86 }
87 > st = st[:len(st)-1] query_util.go
88
89 case sqlDoubleDollarKeyword[0]:
99 }
100
101 > case sqlIfKeyword[0]: query_util.go
102 > if !hasWordAt(contentStr, sqlIfKeyword, j) {
103 > continue
104 }
105 if hasWordsBefore(contentStr, j-1, sqlAddKeyword, sqlColumnKeyword) ||
112 j += len(sqlIfKeyword) - 1
113
114 > case sqlLoopKeyword[0]: query_util.go
115 > if !hasWordAt(contentStr, sqlLoopKeyword, j) {
116 > continue
117 }
118 st = append(st, sqlLoopKeyword[0])
119 j += len(sqlLoopKeyword) - 1
120
121 > case sqlBeginKeyword[0]: query_util.go
122 > if hasWordAt(contentStr, sqlBeginKeyword, j) {
123 st = append(st, sqlBeginKeyword[0])
124 j += len(sqlBeginKeyword) - 1
125 }
126
127 > case sqlEndKeyword[0]: query_util.go
128 > if !hasWordAt(contentStr, sqlEndKeyword, j) {
129 > continue
130 }
131 if ok, after := hasWordAfter(contentStr, sqlIfKeyword, j+len(sqlEndKeyword)); ok {
150 }
151
152 > case sqlSingleQuote, sqlDoubleQuote: query_util.go
153 > quote := contentStr[j]
154 > j++
155 > for j < n && contentStr[j] != quote {
156 > j++
157 > }
158 > if j == n {
159 return nil, fmt.Errorf("error reading contents: unmatched quotes")
160 }
161
162 > case sqlLineComment[0]: query_util.go
163 > if j+len(sqlLineComment) <= n && contentStr[j:j+len(sqlLineComment)] == sqlLineComment {
164 > _, _ = stmtBuilder.Write(bytes.TrimRight(content[i:j], " "))
165 > for j < n && contentStr[j] != '\n' {
166 > j++
167 > }
168 > i = j
169 }
170
171 > default: query_util.go
172 // no-op: generic character
173 }
174 }
175
176 > if len(st) > 0 { query_util.go
177 switch st[len(st)-1] {
178 case sqlLeftParenthesis:
186 }
187
188 > _, _ = stmtBuilder.Write(content[i:j]) query_util.go
189 > stmt := strings.TrimSpace(stmtBuilder.String())
190 > if stmt == "" {
191 > continue query_util.go
192 }
193 > result = append(result, stmt) query_util.go
194 }
195 }
196 > return result, nil query_util.go
197 }
198
199 // hasWordAt is a simple test to check if it matches the whole word:
200 // it checks if the adjacent characters are not alphanumeric if they exist.
201 > func hasWordAt(s, word string, pos int) bool { query_util.go
202 > if pos+len(word) > len(s) || s[pos:pos+len(word)] != word {
203 > return false
204 > }
205 > if pos > 0 && isAlphanumeric(s[pos-1]) { query_util.go
206 > return false query_util.go
207 > }
208 > if pos+len(word) < len(s) && isAlphanumeric(s[pos+len(word)]) { query_util.go
209 > return false query_util.go
210 > }
211 return true
212 }
254 }
255
256 > func isAlphanumeric(c byte) bool { query_util.go
257 > return unicode.IsLetter(rune(c)) || unicode.IsDigit(rune(c))
258 > }
go.temporal.io/server/api/history/v1/message.pb.go 67 covered LOC · 18 ranges

Open complete file

92 func (*VersionHistoryItem) ProtoMessage() {}
93
94 > func (x *VersionHistoryItem) ProtoReflect() protoreflect.Message { message.pb.go
95 > mi := &file_temporal_server_api_history_v1_message_proto_msgTypes[1]
96 > if x != nil {
97 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) message.pb.go
98 > if ms.LoadMessageInfo() == nil {
99 > ms.StoreMessageInfo(mi)
100 > }
101 > return ms
102 }
103 > return mi.MessageOf(x) message.pb.go
104 }
105
109 }
110
111 > func (x *VersionHistoryItem) GetEventId() int64 { message.pb.go
112 > if x != nil {
113 > return x.EventId message.pb.go
114 > }
115 return 0
116 }
117
118 > func (x *VersionHistoryItem) GetVersion() int64 { message.pb.go
119 > if x != nil {
120 > return x.Version message.pb.go
121 > }
122 return 0
123 }
145 func (*VersionHistory) ProtoMessage() {}
146
147 > func (x *VersionHistory) ProtoReflect() protoreflect.Message { message.pb.go
148 > mi := &file_temporal_server_api_history_v1_message_proto_msgTypes[2]
149 > if x != nil {
150 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) message.pb.go
151 > if ms.LoadMessageInfo() == nil {
152 > ms.StoreMessageInfo(mi)
153 > }
154 > return ms
155 }
156 > return mi.MessageOf(x) message.pb.go
157 }
158
162 }
163
164 > func (x *VersionHistory) GetBranchToken() []byte { message.pb.go
165 > if x != nil {
166 > return x.BranchToken
167 > }
168 return nil
169 }
170
171 > func (x *VersionHistory) GetItems() []*VersionHistoryItem { message.pb.go
172 > if x != nil {
173 > return x.Items
174 > }
175 return nil
176 }
198 func (*VersionHistories) ProtoMessage() {}
199
200 > func (x *VersionHistories) ProtoReflect() protoreflect.Message { message.pb.go
201 > mi := &file_temporal_server_api_history_v1_message_proto_msgTypes[3]
202 > if x != nil {
203 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) message.pb.go
204 > if ms.LoadMessageInfo() == nil {
205 > ms.StoreMessageInfo(mi)
206 > }
207 > return ms
208 }
209 > return mi.MessageOf(x) message.pb.go
210 }
211
215 }
216
217 > func (x *VersionHistories) GetCurrentVersionHistoryIndex() int32 { message.pb.go
218 > if x != nil {
219 > return x.CurrentVersionHistoryIndex
220 > }
221 return 0
222 }
498 }
499
500 > func init() { file_temporal_server_api_history_v1_message_proto_init() } message.pb.go
501 > func file_temporal_server_api_history_v1_message_proto_init() {
502 > if File_temporal_server_api_history_v1_message_proto != nil {
503 return
504 }
505 > type x struct{} message.pb.go
506 > out := protoimpl.TypeBuilder{
507 > File: protoimpl.DescBuilder{
508 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
509 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_history_v1_message_proto_rawDesc), len(file_temporal_server_api_history_v1_message_proto_rawDesc)),
510 > NumEnums: 0,
511 > NumMessages: 8,
512 > NumExtensions: 0,
513 > NumServices: 0,
514 > },
515 > GoTypes: file_temporal_server_api_history_v1_message_proto_goTypes,
516 > DependencyIndexes: file_temporal_server_api_history_v1_message_proto_depIdxs,
517 > MessageInfos: file_temporal_server_api_history_v1_message_proto_msgTypes,
518 > }.Build()
519 > File_temporal_server_api_history_v1_message_proto = out.File
520 > file_temporal_server_api_history_v1_message_proto_goTypes = nil
521 > file_temporal_server_api_history_v1_message_proto_depIdxs = nil
522 }
go.temporal.io/server/common/persistence/cassandra/shard_store.go 65 covered LOC · 10 ranges

Open complete file

50 session gocql.Session,
51 logger log.Logger,
52 > ) *ShardStore { shard_store.go
53 > return &ShardStore{
54 > ClusterName: clusterName,
55 > Session: session,
56 > Logger: logger,
57 > }
58 > }
59
60 func (d *ShardStore) GetOrCreateShard(
61 ctx context.Context,
62 request *p.InternalGetOrCreateShardRequest,
63 > ) (*p.InternalGetOrCreateShardResponse, error) { shard_store.go
64 > query := d.Session.Query(templateGetShardQuery,
65 > request.ShardID,
66 > rowTypeShard,
67 > rowTypeShardNamespaceID,
68 > rowTypeShardWorkflowID,
69 > rowTypeShardRunID,
70 > defaultVisibilityTimestamp,
71 > rowTypeShardTaskID,
72 > ).WithContext(ctx)
73 >
74 > var data []byte
75 > var encoding string
76 > err := query.Scan(&data, &encoding)
77 > if err == nil {
78 return &p.InternalGetOrCreateShardResponse{
79 ShardInfo: p.NewDataBlob(data, encoding),
80 }, nil
81 > } else if !gocql.IsNotFoundError(err) || request.CreateShardInfo == nil { shard_store.go
82 return nil, gocql.ConvertError("GetOrCreateShard", err)
83 }
84
85 // shard was not found and we should create it
86 > rangeID, shardInfo, err := request.CreateShardInfo() shard_store.go
87 > if err != nil {
88 return nil, err
89 }
90
91 > query = d.Session.Query(templateCreateShardQuery, shard_store.go
92 > request.ShardID,
93 > rowTypeShard,
94 > rowTypeShardNamespaceID,
95 > rowTypeShardWorkflowID,
96 > rowTypeShardRunID,
97 > defaultVisibilityTimestamp,
98 > rowTypeShardTaskID,
99 > shardInfo.Data,
100 > shardInfo.EncodingType.String(),
101 > rangeID,
102 > ).WithContext(ctx)
103 >
104 > previous := make(map[string]any)
105 > applied, err := query.MapScanCAS(previous)
106 > if err != nil {
107 return nil, gocql.ConvertError("GetOrCreateShard", err)
108 }
109 > if !applied { shard_store.go
110 // conflict, try again
111 request.CreateShardInfo = nil // prevent loop
112 return d.GetOrCreateShard(ctx, request)
113 }
114 > return &p.InternalGetOrCreateShardResponse{ shard_store.go
115 > ShardInfo: shardInfo,
116 > }, nil
117 }
118
120 ctx context.Context,
121 request *p.InternalUpdateShardRequest,
122 > ) error { shard_store.go
123 > query := d.Session.Query(templateUpdateShardQuery,
124 > request.ShardInfo.Data,
125 > request.ShardInfo.EncodingType.String(),
126 > request.RangeID,
127 > request.ShardID,
128 > rowTypeShard,
129 > rowTypeShardNamespaceID,
130 > rowTypeShardWorkflowID,
131 > rowTypeShardRunID,
132 > defaultVisibilityTimestamp,
133 > rowTypeShardTaskID,
134 > request.PreviousRangeID,
135 > ).WithContext(ctx)
136 >
137 > previous := make(map[string]any)
138 > applied, err := query.MapScanCAS(previous)
139 > if err != nil {
140 return gocql.ConvertError("UpdateShard", err)
141 }
142
143 > if !applied { shard_store.go
144 var columns []string
145 for k, v := range previous {
go.temporal.io/server/api/persistence/v1/history_tree.pb.go 59 covered LOC · 11 ranges

Open complete file

53 func (*HistoryTreeInfo) ProtoMessage() {}
54
55 > func (x *HistoryTreeInfo) ProtoReflect() protoreflect.Message { history_tree.pb.go
56 > mi := &file_temporal_server_api_persistence_v1_history_tree_proto_msgTypes[0]
57 > if x != nil {
58 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
59 > if ms.LoadMessageInfo() == nil {
60 > ms.StoreMessageInfo(mi)
61 > }
62 > return ms
63 }
64 return mi.MessageOf(x)
109 }
110
111 > func (x *HistoryBranch) Reset() { history_tree.pb.go
112 > *x = HistoryBranch{}
113 > mi := &file_temporal_server_api_persistence_v1_history_tree_proto_msgTypes[1]
114 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
115 > ms.StoreMessageInfo(mi)
116 > }
117
118 func (x *HistoryBranch) String() string {
122 func (*HistoryBranch) ProtoMessage() {}
123
124 > func (x *HistoryBranch) ProtoReflect() protoreflect.Message { history_tree.pb.go
125 > mi := &file_temporal_server_api_persistence_v1_history_tree_proto_msgTypes[1]
126 > if x != nil {
127 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
128 > if ms.LoadMessageInfo() == nil {
129 > ms.StoreMessageInfo(mi)
130 > }
131 > return ms
132 }
133 > return mi.MessageOf(x) history_tree.pb.go
134 }
135
186 func (*HistoryBranchRange) ProtoMessage() {}
187
188 > func (x *HistoryBranchRange) ProtoReflect() protoreflect.Message { history_tree.pb.go
189 > mi := &file_temporal_server_api_persistence_v1_history_tree_proto_msgTypes[2]
190 > if x != nil {
191 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
192 if ms.LoadMessageInfo() == nil {
203 }
204
205 > func (x *HistoryBranchRange) GetBranchId() string { history_tree.pb.go
206 > if x != nil {
207 > return x.BranchId
208 > }
209 return ""
210 }
211
212 > func (x *HistoryBranchRange) GetBeginNodeId() int64 { history_tree.pb.go
213 > if x != nil {
214 > return x.BeginNodeId
215 > }
216 return 0
217 }
218
219 > func (x *HistoryBranchRange) GetEndNodeId() int64 { history_tree.pb.go
220 > if x != nil {
221 > return x.EndNodeId
222 > }
223 return 0
224 }
274 }
275
276 > func init() { file_temporal_server_api_persistence_v1_history_tree_proto_init() } history_tree.pb.go
277 > func file_temporal_server_api_persistence_v1_history_tree_proto_init() {
278 > if File_temporal_server_api_persistence_v1_history_tree_proto != nil {
279 return
280 }
281 > type x struct{} history_tree.pb.go
282 > out := protoimpl.TypeBuilder{
283 > File: protoimpl.DescBuilder{
284 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
285 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_history_tree_proto_rawDesc), len(file_temporal_server_api_persistence_v1_history_tree_proto_rawDesc)),
286 > NumEnums: 0,
287 > NumMessages: 3,
288 > NumExtensions: 0,
289 > NumServices: 0,
290 > },
291 > GoTypes: file_temporal_server_api_persistence_v1_history_tree_proto_goTypes,
292 > DependencyIndexes: file_temporal_server_api_persistence_v1_history_tree_proto_depIdxs,
293 > MessageInfos: file_temporal_server_api_persistence_v1_history_tree_proto_msgTypes,
294 > }.Build()
295 > File_temporal_server_api_persistence_v1_history_tree_proto = out.File
296 > file_temporal_server_api_persistence_v1_history_tree_proto_goTypes = nil
297 > file_temporal_server_api_persistence_v1_history_tree_proto_depIdxs = nil
298 }
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/gocql/client.go 56 covered LOC · 22 ranges

Open complete file

22 cfg config.Cassandra,
23 resolver resolver.ServiceResolver,
24 > ) (*gocql.ClusterConfig, error) { client.go
25 > var resolvedHosts []string
26 > for _, host := range parseHosts(cfg.Hosts) {
27 > resolvedHosts = append(resolvedHosts, resolver.Resolve(host)...) client.go
28 > }
29
30 > cluster := gocql.NewCluster(resolvedHosts...) client.go
31 > if err := ConfigureCassandraCluster(cfg, cluster); err != nil {
32 return nil, err
33 }
34
35 > return cluster, nil client.go
36 }
37
39 //
40 //nolint:revive // cognitive complexity 61 (> max enabled 25)
41 > func ConfigureCassandraCluster(cfg config.Cassandra, cluster *gocql.ClusterConfig) error { client.go
42 > cluster.ProtoVersion = 4
43 > if cfg.Port > 0 {
44 > cluster.Port = cfg.Port client.go
45 > }
46 > if cfg.User != "" && cfg.Password != "" { client.go
47 > cluster.Authenticator = gocql.PasswordAuthenticator{ client.go
48 > Username: cfg.User,
49 > Password: cfg.Password,
50 > AllowedAuthenticators: cfg.AllowedAuthenticators,
51 > }
52 > }
53 > if cfg.Keyspace != "" { client.go
54 > cluster.Keyspace = cfg.Keyspace client.go
55 > }
56 > if cfg.Datacenter != "" { client.go
57 cluster.HostFilter = gocql.DataCentreHostFilter(cfg.Datacenter)
58 }
59 > if cfg.TLS != nil && cfg.TLS.Enabled { client.go
60 if cfg.TLS.CertData != "" && cfg.TLS.CertFile != "" {
61 return errors.New("only one of certData or certFile properties should be specified")
125 }
126
127 > if cfg.MaxConns > 0 { client.go
128 cluster.NumConns = cfg.MaxConns
129 }
130
131 > cluster.ConnectTimeout = 10 * time.Second * debug.TimeoutMultiplier client.go
132 > if cfg.ConnectTimeout > 0 {
133 > cluster.ConnectTimeout = cfg.ConnectTimeout client.go
134 > }
135
136 > cluster.Timeout = cluster.ConnectTimeout client.go
137 > if cfg.Timeout > 0 {
138 cluster.Timeout = cfg.Timeout
139 }
140
141 > cluster.WriteTimeout = cluster.Timeout client.go
142 > if cfg.WriteTimeout > 0 {
143 cluster.WriteTimeout = cfg.WriteTimeout
144 }
145
146 > cluster.ProtoVersion = 4 client.go
147 > cluster.Consistency = cfg.Consistency.GetConsistency()
148 > cluster.SerialConsistency = cfg.Consistency.GetSerialConsistency()
149 > cluster.DisableInitialHostLookup = cfg.DisableInitialHostLookup
150 >
151 > cluster.ReconnectionPolicy = &gocql.ExponentialReconnectionPolicy{
152 > MaxRetries: 30,
153 > InitialInterval: time.Second,
154 > MaxInterval: 10 * time.Second,
155 > }
156 >
157 > cluster.PoolConfig.HostSelectionPolicy = gocql.TokenAwareHostPolicy(gocql.RoundRobinHostPolicy())
158 >
159 > if cfg.AddressTranslator != nil && cfg.AddressTranslator.Translator != "" {
160 addressTranslator, err := translator.LookupTranslator(cfg.AddressTranslator.Translator)
161 if err != nil {
168 }
169
170 > return nil client.go
171 }
172
173 // parseHosts returns parses a list of hosts separated by comma
174 > func parseHosts(input string) []string { client.go
175 > var hosts []string
176 > for h := range strings.SplitSeq(input, ",") {
177 > if host := strings.TrimSpace(h); len(host) > 0 {
178 > hosts = append(hosts, host) client.go
179 > }
180 }
181 > return hosts client.go
182 }
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/gocql/session.go 54 covered LOC · 16 ranges

Open complete file

42 logger log.Logger,
43 metricsHandler metrics.Handler,
44 > ) (*session, error) { session.go
45 >
46 > gocqlSession, err := initSession(logger, newClusterConfigFunc, metricsHandler)
47 > if err != nil {
48 return nil, err
49 }
50
51 > session := &session{ session.go
52 > status: common.DaemonStatusStarted,
53 > newClusterConfigFunc: newClusterConfigFunc,
54 > logger: logger,
55 > metricsHandler: metricsHandler,
56 >
57 > sessionInitTime: time.Now().UTC(),
58 > }
59 > session.Value.Store(gocqlSession)
60 > return session, nil
61 }
62
96 newClusterConfigFunc func() (*gocql.ClusterConfig, error),
97 metricsHandler metrics.Handler,
98 > ) (gs *gocql.Session, retErr error) { session.go
99 > defer log.CapturePanic(logger, &retErr)
100 > cluster, err := newClusterConfigFunc()
101 > if err != nil {
102 return nil, err
103 }
104 > start := time.Now() session.go
105 > defer func() {
106 > metrics.CassandraInitSessionLatency.With(metricsHandler).Record(time.Since(start))
107 > }()
108 > return cluster.CreateSession()
109 }
110
112 stmt string,
113 values ...any,
114 > ) Query { session.go
115 > q := s.Value.Load().(*gocql.Session).Query(stmt, values...)
116 > if q == nil {
117 return nil
118 }
119
120 > return &query{ session.go
121 > session: s,
122 > gocqlQuery: q,
123 > }
124 }
125
126 func (s *session) NewBatch(
127 batchType BatchType,
128 > ) *Batch { session.go
129 > b := s.Value.Load().(*gocql.Session).NewBatch(mustConvertBatchType(batchType))
130 > if b == nil {
131 return nil
132 }
133 > return &Batch{ session.go
134 > session: s,
135 > gocqlBatch: b,
136 > }
137 }
138
139 func (s *session) ExecuteBatch(
140 b *Batch,
141 > ) (retError error) { session.go
142 > defer func() { s.handleError(retError) }()
143
144 > return s.Value.Load().(*gocql.Session).ExecuteBatch(b.gocqlBatch) session.go
145 }
146
148 b *Batch,
149 previous map[string]any,
150 > ) (_ bool, _ Iter, retError error) { session.go
151 > defer func() { s.handleError(retError) }()
152
153 > applied, iter, err := s.Value.Load().(*gocql.Session).MapExecuteBatchCAS(b.gocqlBatch, previous) session.go
154 > return applied, iter, err
155 }
156
163 }
164
165 > func (s *session) Close() { session.go
166 > if !atomic.CompareAndSwapInt32(
167 > &s.status,
168 > common.DaemonStatusStarted,
169 > common.DaemonStatusStopped,
170 > ) {
171 return
172 }
173 > s.Value.Load().(*gocql.Session).Close() session.go
174 }
175
176 func (s *session) handleError(
177 err error,
178 > ) { session.go
179 > switch err {
180 case gocql.ErrNoConnections,
181 gocql.ErrSessionClosed:
182 s.refresh()
183 > default: session.go
184 // noop
185 }
go.temporal.io/server/api/persistence/v1/update.pb.go 52 covered LOC · 10 ranges

Open complete file

51 func (*UpdateAdmissionInfo) ProtoMessage() {}
52
53 > func (x *UpdateAdmissionInfo) ProtoReflect() protoreflect.Message { update.pb.go
54 > mi := &file_temporal_server_api_persistence_v1_update_proto_msgTypes[0]
55 > if x != nil {
56 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
57 if ms.LoadMessageInfo() == nil {
60 return ms
61 }
62 > return mi.MessageOf(x) update.pb.go
63 }
64
116 func (*UpdateAcceptanceInfo) ProtoMessage() {}
117
118 > func (x *UpdateAcceptanceInfo) ProtoReflect() protoreflect.Message { update.pb.go
119 > mi := &file_temporal_server_api_persistence_v1_update_proto_msgTypes[1]
120 > if x != nil {
121 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
122 if ms.LoadMessageInfo() == nil {
125 return ms
126 }
127 > return mi.MessageOf(x) update.pb.go
128 }
129
164 func (*UpdateCompletionInfo) ProtoMessage() {}
165
166 > func (x *UpdateCompletionInfo) ProtoReflect() protoreflect.Message { update.pb.go
167 > mi := &file_temporal_server_api_persistence_v1_update_proto_msgTypes[2]
168 > if x != nil {
169 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
170 if ms.LoadMessageInfo() == nil {
173 return ms
174 }
175 > return mi.MessageOf(x) update.pb.go
176 }
177
222 func (*UpdateInfo) ProtoMessage() {}
223
224 > func (x *UpdateInfo) ProtoReflect() protoreflect.Message { update.pb.go
225 > mi := &file_temporal_server_api_persistence_v1_update_proto_msgTypes[3]
226 > if x != nil {
227 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) update.pb.go
228 > if ms.LoadMessageInfo() == nil {
229 > ms.StoreMessageInfo(mi)
230 > }
231 > return ms
232 }
233 > return mi.MessageOf(x) update.pb.go
234 }
235
422 }
423
424 > func init() { file_temporal_server_api_persistence_v1_update_proto_init() } update.pb.go
425 > func file_temporal_server_api_persistence_v1_update_proto_init() {
426 > if File_temporal_server_api_persistence_v1_update_proto != nil {
427 > return
428 > }
429 > file_temporal_server_api_persistence_v1_hsm_proto_init()
430 > file_temporal_server_api_persistence_v1_update_proto_msgTypes[0].OneofWrappers = []any{
431 > (*UpdateAdmissionInfo_HistoryPointer_)(nil),
432 > }
433 > file_temporal_server_api_persistence_v1_update_proto_msgTypes[3].OneofWrappers = []any{
434 > (*UpdateInfo_Acceptance)(nil),
435 > (*UpdateInfo_Completion)(nil),
436 > (*UpdateInfo_Admission)(nil),
437 > }
438 > type x struct{}
439 > out := protoimpl.TypeBuilder{
440 > File: protoimpl.DescBuilder{
441 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
442 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_update_proto_rawDesc), len(file_temporal_server_api_persistence_v1_update_proto_rawDesc)),
443 > NumEnums: 0,
444 > NumMessages: 5,
445 > NumExtensions: 0,
446 > NumServices: 0,
447 > },
448 > GoTypes: file_temporal_server_api_persistence_v1_update_proto_goTypes,
449 > DependencyIndexes: file_temporal_server_api_persistence_v1_update_proto_depIdxs,
450 > MessageInfos: file_temporal_server_api_persistence_v1_update_proto_msgTypes,
451 > }.Build()
452 > File_temporal_server_api_persistence_v1_update_proto = out.File
453 > file_temporal_server_api_persistence_v1_update_proto_goTypes = nil
454 > file_temporal_server_api_persistence_v1_update_proto_depIdxs = nil
455 }
go.temporal.io/server/common/persistence/operation_mode_validator.go 46 covered LOC · 17 ranges

Open complete file

15 mode CreateWorkflowMode,
16 newWorkflowSnapshot WorkflowSnapshot,
18 >
19 > workflowState := newWorkflowSnapshot.ExecutionState.State
20 > if err := checkWorkflowState(workflowState); err != nil {
21 return err
22 }
23
24 > switch mode { operation_mode_validator.go
25 case CreateWorkflowModeBrandNew,
26 > CreateWorkflowModeUpdateCurrent: operation_mode_validator.go
27 > if workflowState == enumsspb.WORKFLOW_EXECUTION_STATE_ZOMBIE {
28 return newInvalidCreateWorkflowMode(
29 mode,
31 )
32 }
33 > return nil operation_mode_validator.go
34
35 > case CreateWorkflowModeBypassCurrent: operation_mode_validator.go
36 > if workflowState == enumsspb.WORKFLOW_EXECUTION_STATE_CREATED ||
37 > workflowState == enumsspb.WORKFLOW_EXECUTION_STATE_RUNNING {
38 return newInvalidCreateWorkflowMode(
39 mode,
144 newWorkflowSnapshot *WorkflowSnapshot,
145 currentWorkflowMutation *WorkflowMutation,
146 > ) error { operation_mode_validator.go
147 >
148 > resetWorkflowState := resetWorkflowSnapshot.ExecutionState.State
149 > if err := checkWorkflowState(resetWorkflowState); err != nil {
150 return err
151 }
152 > var newWorkflowState *enumsspb.WorkflowExecutionState operation_mode_validator.go
153 > if newWorkflowSnapshot != nil {
154 > newWorkflowState = &newWorkflowSnapshot.ExecutionState.State operation_mode_validator.go
155 > if err := checkWorkflowState(*newWorkflowState); err != nil {
156 return err
157 }
158 }
159 > var currentWorkflowState *enumsspb.WorkflowExecutionState operation_mode_validator.go
160 > if currentWorkflowMutation != nil {
161 currentWorkflowState = &currentWorkflowMutation.ExecutionState.State
162 if err := checkWorkflowState(*currentWorkflowState); err != nil {
165 }
166
167 > switch mode { operation_mode_validator.go
168 case ConflictResolveWorkflowModeUpdateCurrent:
169 // update current record
244 return nil
245
246 > case ConflictResolveWorkflowModeBypassCurrent: operation_mode_validator.go
247 > // bypass current record
248 > // * current workflow cannot be set
249 > // 1. reset workflow only ->
250 > // reset workflow cannot be created / running
251 > // 2. reset workflow & new workflow ->
252 > // reset workflow cannot be created / running / zombie,
253 > // new workflow cannot be created / running / completed
254 >
255 > // precondition
256 > if currentWorkflowMutation != nil {
257 return serviceerror.NewInternalf("Invalid workflow conflict resolve mode %v, encountered current workflow", mode)
258 }
259
260 // case 1
261 > if newWorkflowState == nil { operation_mode_validator.go
262 if resetWorkflowState == enumsspb.WORKFLOW_EXECUTION_STATE_CREATED ||
263 resetWorkflowState == enumsspb.WORKFLOW_EXECUTION_STATE_RUNNING {
271
272 // case 2
273 > if resetWorkflowState == enumsspb.WORKFLOW_EXECUTION_STATE_CREATED || operation_mode_validator.go
274 > resetWorkflowState == enumsspb.WORKFLOW_EXECUTION_STATE_RUNNING ||
275 > resetWorkflowState == enumsspb.WORKFLOW_EXECUTION_STATE_ZOMBIE ||
276 > *newWorkflowState == enumsspb.WORKFLOW_EXECUTION_STATE_CREATED ||
277 > *newWorkflowState == enumsspb.WORKFLOW_EXECUTION_STATE_RUNNING ||
278 > *newWorkflowState == enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED {
279 return newInvalidConflictResolveWorkflowWithNewMode(
280 mode,
290 }
291
292 > func checkWorkflowState(state enumsspb.WorkflowExecutionState) error { operation_mode_validator.go
293 > switch state {
294 case enumsspb.WORKFLOW_EXECUTION_STATE_CREATED,
295 enumsspb.WORKFLOW_EXECUTION_STATE_RUNNING,
296 enumsspb.WORKFLOW_EXECUTION_STATE_ZOMBIE,
297 enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED,
298 > enumsspb.WORKFLOW_EXECUTION_STATE_CORRUPTED: operation_mode_validator.go
299 > return nil
300 default:
301 return serviceerror.NewInternalf("unknown workflow state: %v", state)
go.temporal.io/server/api/historyservice/v1/request_response.pb.go 45 covered LOC · 1 range

Open complete file

11956 }
11957
11958 > func init() { file_temporal_server_api_historyservice_v1_request_response_proto_init() } request_response.pb.go
11959 > func file_temporal_server_api_historyservice_v1_request_response_proto_init() {
11960 > if File_temporal_server_api_historyservice_v1_request_response_proto != nil {
11961 > return
11962 > }
11963 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[107].OneofWrappers = []any{
11964 > (*StreamWorkflowReplicationMessagesRequest_SyncReplicationState)(nil),
11965 > }
11966 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[108].OneofWrappers = []any{
11967 > (*StreamWorkflowReplicationMessagesResponse_Messages)(nil),
11968 > }
11969 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[134].OneofWrappers = []any{
11970 > (*CompleteNexusOperationChasmRequest_Success)(nil),
11971 > (*CompleteNexusOperationChasmRequest_Failure)(nil),
11972 > }
11973 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[136].OneofWrappers = []any{
11974 > (*CompleteNexusOperationRequest_Success)(nil),
11975 > (*CompleteNexusOperationRequest_Failure)(nil),
11976 > }
11977 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[162].OneofWrappers = []any{
11978 > (*ExecuteMultiOperationRequest_Operation_StartWorkflow)(nil),
11979 > (*ExecuteMultiOperationRequest_Operation_UpdateWorkflow)(nil),
11980 > }
11981 > file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes[163].OneofWrappers = []any{
11982 > (*ExecuteMultiOperationResponse_Response_StartWorkflow)(nil),
11983 > (*ExecuteMultiOperationResponse_Response_UpdateWorkflow)(nil),
11984 > }
11985 > type x struct{}
11986 > out := protoimpl.TypeBuilder{
11987 > File: protoimpl.DescBuilder{
11988 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
11989 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_historyservice_v1_request_response_proto_rawDesc), len(file_temporal_server_api_historyservice_v1_request_response_proto_rawDesc)),
11990 > NumEnums: 0,
11991 > NumMessages: 171,
11992 > NumExtensions: 1,
11993 > NumServices: 0,
11994 > },
11995 > GoTypes: file_temporal_server_api_historyservice_v1_request_response_proto_goTypes,
11996 > DependencyIndexes: file_temporal_server_api_historyservice_v1_request_response_proto_depIdxs,
11997 > MessageInfos: file_temporal_server_api_historyservice_v1_request_response_proto_msgTypes,
11998 > ExtensionInfos: file_temporal_server_api_historyservice_v1_request_response_proto_extTypes,
11999 > }.Build()
12000 > File_temporal_server_api_historyservice_v1_request_response_proto = out.File
12001 > file_temporal_server_api_historyservice_v1_request_response_proto_goTypes = nil
12002 > file_temporal_server_api_historyservice_v1_request_response_proto_depIdxs = nil
12003 }
go.temporal.io/server/api/matchingservice/v1/request_response.pb.go 43 covered LOC · 1 range

Open complete file

6833 }
6834
6835 > func init() { file_temporal_server_api_matchingservice_v1_request_response_proto_init() } request_response.pb.go
6836 > func file_temporal_server_api_matchingservice_v1_request_response_proto_init() {
6837 > if File_temporal_server_api_matchingservice_v1_request_response_proto != nil {
6838 > return
6839 > }
6840 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[27].OneofWrappers = []any{
6841 > (*UpdateWorkerBuildIdCompatibilityRequest_ApplyPublicRequest_)(nil),
6842 > (*UpdateWorkerBuildIdCompatibilityRequest_RemoveBuildIds_)(nil),
6843 > (*UpdateWorkerBuildIdCompatibilityRequest_PersistUnknownBuildId)(nil),
6844 > }
6845 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[29].OneofWrappers = []any{
6846 > (*GetWorkerVersioningRulesRequest_Request)(nil),
6847 > }
6848 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[31].OneofWrappers = []any{
6849 > (*UpdateWorkerVersioningRulesRequest_Request)(nil),
6850 > }
6851 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[37].OneofWrappers = []any{
6852 > (*SyncDeploymentUserDataRequest_UpdateVersionData)(nil),
6853 > (*SyncDeploymentUserDataRequest_ForgetVersion)(nil),
6854 > }
6855 > file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes[56].OneofWrappers = []any{
6856 > (*DispatchNexusTaskResponse_HandlerError)(nil),
6857 > (*DispatchNexusTaskResponse_Response)(nil),
6858 > (*DispatchNexusTaskResponse_RequestTimeout)(nil),
6859 > (*DispatchNexusTaskResponse_Failure)(nil),
6860 > }
6861 > type x struct{}
6862 > out := protoimpl.TypeBuilder{
6863 > File: protoimpl.DescBuilder{
6864 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
6865 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_matchingservice_v1_request_response_proto_rawDesc), len(file_temporal_server_api_matchingservice_v1_request_response_proto_rawDesc)),
6866 > NumEnums: 0,
6867 > NumMessages: 97,
6868 > NumExtensions: 0,
6869 > NumServices: 0,
6870 > },
6871 > GoTypes: file_temporal_server_api_matchingservice_v1_request_response_proto_goTypes,
6872 > DependencyIndexes: file_temporal_server_api_matchingservice_v1_request_response_proto_depIdxs,
6873 > MessageInfos: file_temporal_server_api_matchingservice_v1_request_response_proto_msgTypes,
6874 > }.Build()
6875 > File_temporal_server_api_matchingservice_v1_request_response_proto = out.File
6876 > file_temporal_server_api_matchingservice_v1_request_response_proto_goTypes = nil
6877 > file_temporal_server_api_matchingservice_v1_request_response_proto_depIdxs = nil
6878 }
go.temporal.io/server/common/persistence/shard_manager.go 40 covered LOC · 10 ranges

Open complete file

19 shardStore ShardStore,
20 serializer serialization.Serializer,
21 > ) ShardManager { shard_manager.go
22 > return &shardManagerImpl{
23 > shardStore: shardStore,
24 > serializer: serializer,
25 > }
26 > }
27
28 func (m *shardManagerImpl) Close() {
37 ctx context.Context,
38 request *GetOrCreateShardRequest,
39 > ) (*GetOrCreateShardResponse, error) { shard_manager.go
40 > createShardInfo := func() (int64, *commonpb.DataBlob, error) {
41 > shardInfo := request.InitialShardInfo shard_manager.go
42 > if shardInfo == nil {
43 shardInfo = &persistencespb.ShardInfo{}
44 }
45 > shardInfo.ShardId = request.ShardID shard_manager.go
46 > shardInfo.UpdateTime = timestamp.TimeNowPtrUtc()
47 > data, err := m.serializer.ShardInfoToBlob(shardInfo)
48 > if err != nil {
49 return 0, nil, err
50 }
51 > return shardInfo.GetRangeId(), data, nil shard_manager.go
52 }
53 > internalResp, err := m.shardStore.GetOrCreateShard(ctx, &InternalGetOrCreateShardRequest{ shard_manager.go
54 > ShardID: request.ShardID,
55 > CreateShardInfo: createShardInfo,
56 > LifecycleContext: request.LifecycleContext,
57 > })
58 > if err != nil {
59 return nil, err
60 }
61 > shardInfo, err := m.serializer.ShardInfoFromBlob(internalResp.ShardInfo) shard_manager.go
62 > if err != nil {
63 return nil, err
64 }
65 > return &GetOrCreateShardResponse{ shard_manager.go
66 > ShardInfo: shardInfo,
67 > }, nil
68 }
69
71 ctx context.Context,
72 request *UpdateShardRequest,
73 > ) error { shard_manager.go
74 > shardInfo := request.ShardInfo
75 > shardInfo.UpdateTime = timestamp.TimeNowPtrUtc()
76 >
77 > shardInfoBlob, err := m.serializer.ShardInfoToBlob(shardInfo)
78 > if err != nil {
79 return err
80 }
81 > internalRequest := &InternalUpdateShardRequest{ shard_manager.go
82 > ShardID: request.ShardInfo.GetShardId(),
83 > RangeID: request.ShardInfo.GetRangeId(),
84 > Owner: request.ShardInfo.GetOwner(),
85 > ShardInfo: shardInfoBlob,
86 > PreviousRangeID: request.PreviousRangeID,
87 > }
88 > return m.shardStore.UpdateShard(ctx, internalRequest)
89 }
90
go.temporal.io/server/common/persistence/size_util.go 39 covered LOC · 18 ranges

Open complete file

7 func sizeOfBlob(
8 blob *commonpb.DataBlob,
9 > ) int { size_util.go
10 > return blob.Size()
11 > }
12
13 func sizeOfInt64Set(
20 func sizeOfStringSet(
21 stringSet map[string]struct{},
22 > ) int { size_util.go
23 > size := 0
24 > for requestID := range stringSet {
25 > size += len(requestID) size_util.go
26 > }
27 > return size size_util.go
28 }
29
30 func sizeOfInt64BlobMap(
31 kvBlob map[int64]*commonpb.DataBlob,
32 > ) int { size_util.go
33 > // 8 == 64 bit / 8 bit per byte
34 > size := 8 * len(kvBlob)
35 > for _, blob := range kvBlob {
36 > size += blob.Size() size_util.go
37 > }
38 > return size size_util.go
39 }
40
43 func sizeOfChasmNodeMap(
44 nodeMap map[string]InternalChasmNode,
45 > ) int { size_util.go
46 > size := 0
47 > for path, node := range nodeMap {
48 > size += len(path) + node.Metadata.Size() + node.Data.Size() size_util.go
49 > }
50 > return size size_util.go
51 }
52
53 func sizeOfStringBlobMap(
54 kvBlob map[string]*commonpb.DataBlob,
55 > ) int { size_util.go
56 > size := 0
57 > for id, blob := range kvBlob {
58 > // 8 == 64 bit / 8 bit per byte size_util.go
59 > size += len(id) + blob.Size()
60 > }
61 > return size size_util.go
62 }
63
64 func sizeOfStringSlice(
65 stringSlice []string,
66 > ) int { size_util.go
67 > size := 0
68 > for _, str := range stringSlice {
69 > size += len(str) size_util.go
70 > }
71 > return size size_util.go
72 }
73
74 func sizeOfBlobSlice(
75 blobSlice []*commonpb.DataBlob,
76 > ) int { size_util.go
77 > size := 0
78 > for _, blob := range blobSlice {
79 size += blob.Size()
80 }
81 > return size size_util.go
82 }
go.temporal.io/server/api/persistence/v1/workflow_mutable_state.pb.go 38 covered LOC · 5 ranges

Open complete file

42 }
43
44 > func (x *WorkflowMutableState) Reset() { workflow_mutable_state.pb.go
45 > *x = WorkflowMutableState{}
46 > mi := &file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_msgTypes[0]
47 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
48 > ms.StoreMessageInfo(mi)
49 > }
50
51 func (x *WorkflowMutableState) String() string {
55 func (*WorkflowMutableState) ProtoMessage() {}
56
57 > func (x *WorkflowMutableState) ProtoReflect() protoreflect.Message { workflow_mutable_state.pb.go
58 > mi := &file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_msgTypes[0]
59 > if x != nil {
60 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) workflow_mutable_state.pb.go
61 > if ms.LoadMessageInfo() == nil {
62 > ms.StoreMessageInfo(mi)
63 > }
64 > return ms
65 }
66 return mi.MessageOf(x)
532 }
533
534 > func init() { file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_init() } workflow_mutable_state.pb.go
535 > func file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_init() {
536 > if File_temporal_server_api_persistence_v1_workflow_mutable_state_proto != nil {
537 return
538 }
539 > file_temporal_server_api_persistence_v1_chasm_proto_init() workflow_mutable_state.pb.go
540 > file_temporal_server_api_persistence_v1_executions_proto_init()
541 > file_temporal_server_api_persistence_v1_hsm_proto_init()
542 > file_temporal_server_api_persistence_v1_update_proto_init()
543 > type x struct{}
544 > out := protoimpl.TypeBuilder{
545 > File: protoimpl.DescBuilder{
546 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
547 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_rawDesc), len(file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_rawDesc)),
548 > NumEnums: 0,
549 > NumMessages: 16,
550 > NumExtensions: 0,
551 > NumServices: 0,
552 > },
553 > GoTypes: file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_goTypes,
554 > DependencyIndexes: file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_depIdxs,
555 > MessageInfos: file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_msgTypes,
556 > }.Build()
557 > File_temporal_server_api_persistence_v1_workflow_mutable_state_proto = out.File
558 > file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_goTypes = nil
559 > file_temporal_server_api_persistence_v1_workflow_mutable_state_proto_depIdxs = nil
560 }
go.temporal.io/server/common/backoff/retrypolicy.go 38 covered LOC · 7 ranges

Open complete file

80
81 // NewExponentialRetryPolicy returns an instance of ExponentialRetryPolicy using the provided initialInterval
82 > func NewExponentialRetryPolicy(initialInterval time.Duration) *ExponentialRetryPolicy { retrypolicy.go
83 > p := &ExponentialRetryPolicy{
84 > initialInterval: initialInterval,
85 > backoffCoefficient: defaultBackoffCoefficient,
86 > maximumInterval: defaultMaximumInterval,
87 > expirationInterval: defaultExpirationInterval,
88 > maximumAttempts: defaultMaximumAttempts,
89 > }
90 >
91 > return p
92 > }
93
94 // NewRetrier is used for creating a new instance of Retrier
113 // All retries are computed using the following formula:
114 // initialInterval * math.Pow(backoffCoefficient, currentAttempt)
115 > func (p *ExponentialRetryPolicy) WithBackoffCoefficient(backoffCoefficient float64) *ExponentialRetryPolicy { retrypolicy.go
116 > p.backoffCoefficient = backoffCoefficient
117 > return p
118 > }
119
120 // WithMaximumInterval sets the maximum interval for each retry.
121 // This does *not* cause the policy to stop retrying when the interval between retries reaches the supplied duration.
122 // That is what WithExpirationInterval does. Instead, this prevents the interval from exceeding maximumInterval.
123 > func (p *ExponentialRetryPolicy) WithMaximumInterval(maximumInterval time.Duration) *ExponentialRetryPolicy { retrypolicy.go
124 > p.maximumInterval = maximumInterval
125 > return p
126 > }
127
128 // WithExpirationInterval sets the absolute expiration interval for all retries
129 > func (p *ExponentialRetryPolicy) WithExpirationInterval(expirationInterval time.Duration) *ExponentialRetryPolicy { retrypolicy.go
130 > p.expirationInterval = expirationInterval
131 > return p
132 > }
133
134 // WithMaximumAttempts sets the maximum number of retry attempts
135 > func (p *ExponentialRetryPolicy) WithMaximumAttempts(maximumAttempts int) *ExponentialRetryPolicy { retrypolicy.go
136 > p.maximumAttempts = maximumAttempts
137 > return p
138 > }
139
140 // ComputeNextDelay returns the next delay interval. This is used by Retrier to delay calling the operation again
267 var _ RetryPolicy = (*ConstantDelayRetryPolicy)(nil)
268
269 > func NewConstantDelayRetryPolicy(delay time.Duration) *ConstantDelayRetryPolicy { retrypolicy.go
270 > return &ConstantDelayRetryPolicy{
271 > maximumAttempts: defaultMaximumAttempts,
272 > jitterPct: defaultJitterPct,
273 > delay: delay,
274 > }
275 > }
276
277 > func (p *ConstantDelayRetryPolicy) WithMaximumAttempts(maximumAttempts int) *ConstantDelayRetryPolicy { retrypolicy.go
278 > p.maximumAttempts = maximumAttempts
279 > return p
280 > }
281
282 func (p *ConstantDelayRetryPolicy) WithJitter(jitterPct float64) *ConstantDelayRetryPolicy {
go.temporal.io/server/common/metrics/defs.go 38 covered LOC · 6 ranges

Open complete file

20 )
21
22 > func NewTimerDef(name string, opts ...Option) timerDefinition { defs.go
23 > // This line cannot be combined with others!
24 > // This ensures the stack trace has information of the caller.
25 > def := newMetricDefinition(name, opts...)
26 > globalRegistry.register(def)
27 > return timerDefinition{def}
28 > }
29
30 > func NewBytesHistogramDef(name string, opts ...Option) histogramDefinition { defs.go
31 > // This line cannot be combined with others!
32 > // This ensures the stack trace has information of the caller.
33 > def := newMetricDefinition(name, append(opts, WithUnit(Bytes))...)
34 > globalRegistry.register(def)
35 > return histogramDefinition{def}
36 > }
37
38 > func NewDimensionlessHistogramDef(name string, opts ...Option) histogramDefinition { defs.go
39 > // This line cannot be combined with others!
40 > // This ensures the stack trace has information of the caller.
41 > def := newMetricDefinition(name, append(opts, WithUnit(Dimensionless))...)
42 > globalRegistry.register(def)
43 > return histogramDefinition{def}
44 > }
45
46 > func NewCounterDef(name string, opts ...Option) counterDefinition { defs.go
47 > // This line cannot be combined with others!
48 > // This ensures the stack trace has information of the caller.
49 > def := newMetricDefinition(name, opts...)
50 > globalRegistry.register(def)
51 > return counterDefinition{def}
52 > }
53
54 > func NewGaugeDef(name string, opts ...Option) gaugeDefinition { defs.go
55 > // This line cannot be combined with others!
56 > // This ensures the stack trace has information of the caller.
57 > def := newMetricDefinition(name, opts...)
58 > globalRegistry.register(def)
59 > return gaugeDefinition{def}
60 > }
61
62 func (d histogramDefinition) With(handler Handler) HistogramIface {
72 }
73
74 > func (d timerDefinition) With(handler Handler) TimerIface { defs.go
75 > return handler.Timer(d.name)
76 > }
go.temporal.io/server/api/adminservice/v1/request_response.pb.go 36 covered LOC · 1 range

Open complete file

6623 }
6624
6625 > func init() { file_temporal_server_api_adminservice_v1_request_response_proto_init() } request_response.pb.go
6626 > func file_temporal_server_api_adminservice_v1_request_response_proto_init() {
6627 > if File_temporal_server_api_adminservice_v1_request_response_proto != nil {
6628 > return
6629 > }
6630 > file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes[59].OneofWrappers = []any{
6631 > (*StreamWorkflowReplicationMessagesRequest_SyncReplicationState)(nil),
6632 > }
6633 > file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes[60].OneofWrappers = []any{
6634 > (*StreamWorkflowReplicationMessagesResponse_Messages)(nil),
6635 > }
6636 > file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes[61].OneofWrappers = []any{
6637 > (*GetNamespaceRequest_Namespace)(nil),
6638 > (*GetNamespaceRequest_Id)(nil),
6639 > }
6640 > file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes[90].OneofWrappers = []any{
6641 > (*StartAdminBatchOperationRequest_RefreshTasksOperation)(nil),
6642 > }
6643 > type x struct{}
6644 > out := protoimpl.TypeBuilder{
6645 > File: protoimpl.DescBuilder{
6646 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
6647 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_adminservice_v1_request_response_proto_rawDesc), len(file_temporal_server_api_adminservice_v1_request_response_proto_rawDesc)),
6648 > NumEnums: 1,
6649 > NumMessages: 105,
6650 > NumExtensions: 0,
6651 > NumServices: 0,
6652 > },
6653 > GoTypes: file_temporal_server_api_adminservice_v1_request_response_proto_goTypes,
6654 > DependencyIndexes: file_temporal_server_api_adminservice_v1_request_response_proto_depIdxs,
6655 > EnumInfos: file_temporal_server_api_adminservice_v1_request_response_proto_enumTypes,
6656 > MessageInfos: file_temporal_server_api_adminservice_v1_request_response_proto_msgTypes,
6657 > }.Build()
6658 > File_temporal_server_api_adminservice_v1_request_response_proto = out.File
6659 > file_temporal_server_api_adminservice_v1_request_response_proto_goTypes = nil
6660 > file_temporal_server_api_adminservice_v1_request_response_proto_depIdxs = nil
6661 }
go.temporal.io/server/api/replication/v1/message.pb.go 36 covered LOC · 2 ranges

Open complete file

2441 }
2442
2443 > func init() { file_temporal_server_api_replication_v1_message_proto_init() } message.pb.go
2444 > func file_temporal_server_api_replication_v1_message_proto_init() {
2445 > if File_temporal_server_api_replication_v1_message_proto != nil {
2446 return
2447 }
2448 > file_temporal_server_api_replication_v1_message_proto_msgTypes[0].OneofWrappers = []any{ message.pb.go
2449 > (*ReplicationTask_NamespaceTaskAttributes)(nil),
2450 > (*ReplicationTask_SyncShardStatusTaskAttributes)(nil),
2451 > (*ReplicationTask_SyncActivityTaskAttributes)(nil),
2452 > (*ReplicationTask_HistoryTaskAttributes)(nil),
2453 > (*ReplicationTask_SyncWorkflowStateTaskAttributes)(nil),
2454 > (*ReplicationTask_TaskQueueUserDataAttributes)(nil),
2455 > (*ReplicationTask_SyncHsmAttributes)(nil),
2456 > (*ReplicationTask_BackfillHistoryTaskAttributes)(nil),
2457 > (*ReplicationTask_VerifyVersionedTransitionTaskAttributes)(nil),
2458 > (*ReplicationTask_SyncVersionedTransitionTaskAttributes)(nil),
2459 > }
2460 > file_temporal_server_api_replication_v1_message_proto_msgTypes[21].OneofWrappers = []any{
2461 > (*VersionedTransitionArtifact_SyncWorkflowStateMutationAttributes)(nil),
2462 > (*VersionedTransitionArtifact_SyncWorkflowStateSnapshotAttributes)(nil),
2463 > }
2464 > type x struct{}
2465 > out := protoimpl.TypeBuilder{
2466 > File: protoimpl.DescBuilder{
2467 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
2468 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_replication_v1_message_proto_rawDesc), len(file_temporal_server_api_replication_v1_message_proto_rawDesc)),
2469 > NumEnums: 0,
2470 > NumMessages: 23,
2471 > NumExtensions: 0,
2472 > NumServices: 0,
2473 > },
2474 > GoTypes: file_temporal_server_api_replication_v1_message_proto_goTypes,
2475 > DependencyIndexes: file_temporal_server_api_replication_v1_message_proto_depIdxs,
2476 > MessageInfos: file_temporal_server_api_replication_v1_message_proto_msgTypes,
2477 > }.Build()
2478 > File_temporal_server_api_replication_v1_message_proto = out.File
2479 > file_temporal_server_api_replication_v1_message_proto_goTypes = nil
2480 > file_temporal_server_api_replication_v1_message_proto_depIdxs = nil
2481 }
go.temporal.io/server/common/namespace/testconstructors.go 36 covered LOC · 8 ranges

Open complete file

13 config *persistencespb.NamespaceConfig,
14 targetCluster string,
15 > ) *Namespace { testconstructors.go
16 > detail := &persistencespb.NamespaceDetail{
17 > Info: ensureInfo(info),
18 > Config: ensureConfig(config),
19 > ReplicationConfig: &persistencespb.NamespaceReplicationConfig{
20 > ActiveClusterName: targetCluster,
21 > Clusters: []string{targetCluster},
22 > },
23 > FailoverVersion: common.EmptyVersion,
24 > }
25 > factory := NewDefaultReplicationResolverFactory()
26 > resolver := factory(detail)
27 > ns, _ := FromPersistentState(detail, resolver, WithGlobalFlag(false))
28 > return ns
29 > }
30
31 // NewNamespaceForTest returns an entry with test data
55 repConfig *persistencespb.NamespaceReplicationConfig,
56 failoverVersion int64,
57 > ) *Namespace { testconstructors.go
58 > detail := &persistencespb.NamespaceDetail{
59 > Info: ensureInfo(info),
60 > Config: ensureConfig(config),
61 > ReplicationConfig: ensureRepConfig(repConfig),
62 > FailoverVersion: failoverVersion,
63 > }
64 > factory := NewDefaultReplicationResolverFactory()
65 > resolver := factory(detail)
66 > ns, _ := FromPersistentState(detail, resolver, WithGlobalFlag(true))
67 > return ns
68 > }
69
70 > func ensureInfo(proto *persistencespb.NamespaceInfo) *persistencespb.NamespaceInfo { testconstructors.go
71 > if proto == nil {
72 return &persistencespb.NamespaceInfo{}
73 }
74 > return proto testconstructors.go
75 }
76
77 > func ensureConfig(proto *persistencespb.NamespaceConfig) *persistencespb.NamespaceConfig { testconstructors.go
78 > if proto == nil {
79 return &persistencespb.NamespaceConfig{}
80 }
81 > return proto testconstructors.go
82 }
83
84 > func ensureRepConfig(proto *persistencespb.NamespaceReplicationConfig) *persistencespb.NamespaceReplicationConfig { testconstructors.go
85 > if proto == nil {
86 return &persistencespb.NamespaceReplicationConfig{}
87 }
88 > return proto testconstructors.go
89 }
go.temporal.io/server/common/persistence/versionhistory/version_history.go 36 covered LOC · 12 ranges

Open complete file

8
9 // NewVersionHistory create a new instance of VersionHistory.
10 > func NewVersionHistory(branchToken []byte, items []*historyspb.VersionHistoryItem) *historyspb.VersionHistory { version_history.go
11 > return &historyspb.VersionHistory{
12 > BranchToken: branchToken,
13 > Items: items,
14 > }
15 > }
16
17 // CopyVersionHistory copies VersionHistory.
18 > func CopyVersionHistory(v *historyspb.VersionHistory) *historyspb.VersionHistory { version_history.go
19 > token := make([]byte, len(v.BranchToken))
20 > copy(token, v.BranchToken)
21 >
22 > items := CopyVersionHistoryItems(v.Items)
23 >
24 > return NewVersionHistory(token, items)
25 > }
26
27 > func CopyVersionHistoryItems(items []*historyspb.VersionHistoryItem) []*historyspb.VersionHistoryItem { version_history.go
28 > var result []*historyspb.VersionHistoryItem
29 > for _, item := range items {
30 > result = append(result, CopyVersionHistoryItem(item)) version_history.go
31 > }
32 > return result version_history.go
33 }
34
91
92 // ContainsVersionHistoryItem check whether VersionHistory has given VersionHistoryItem.
93 > func ContainsVersionHistoryItem(v *historyspb.VersionHistory, item *historyspb.VersionHistoryItem) bool { version_history.go
94 > prevEventID := common.FirstEventID - 1
95 > for _, currentItem := range v.Items {
96 > if item.GetVersion() == currentItem.GetVersion() {
97 > if prevEventID < item.GetEventId() && item.GetEventId() <= currentItem.GetEventId() { version_history.go
98 > return true version_history.go
99 > }
100 } else if item.GetVersion() < currentItem.GetVersion() {
101 return false
215
216 // GetLastVersionHistoryItem return the last VersionHistoryItem.
217 > func GetLastVersionHistoryItem(v *historyspb.VersionHistory) (*historyspb.VersionHistoryItem, error) { version_history.go
218 > return getLastVersionHistoryItem(v.Items)
219 > }
220
221 > func getLastVersionHistoryItem(v []*historyspb.VersionHistoryItem) (*historyspb.VersionHistoryItem, error) { version_history.go
222 > if len(v) == 0 {
223 return nil, serviceerror.NewInternal("version history is empty.")
224 }
225 > return CopyVersionHistoryItem(v[len(v)-1]), nil version_history.go
226 }
227
248
249 // IsEmptyVersionHistory indicate whether version history is empty
250 > func IsEmptyVersionHistory(v *historyspb.VersionHistory) bool { version_history.go
251 > return len(v.Items) == 0
252 > }
253
254 // CompareVersionHistory compares 2 version history items
go.temporal.io/server/common/persistence/xdc_cache.go 36 covered LOC · 7 ranges

Open complete file

53 minEventID int64,
54 version int64,
55 > ) XDCCacheKey { xdc_cache.go
56 > return XDCCacheKey{
57 > WorkflowKey: workflowKey,
58 > MinEventID: minEventID,
59 > Version: version,
60 > }
61 > }
62
63 func NewXDCCacheValue(
66 eventBlobs []*commonpb.DataBlob,
67 nextEventID int64,
68 > ) XDCCacheValue { xdc_cache.go
69 > return XDCCacheValue{
70 > BaseWorkflowInfo: baseWorkflowInfo,
71 > VersionHistoryItems: versionHistoryItems,
72 > EventBlobs: eventBlobs,
73 > NextEventID: nextEventID,
74 > }
75 > }
76
77 func (v XDCCacheValue) CacheSize() int {
138 eventID int64,
139 version int64,
140 > ) ([]*historyspb.VersionHistoryItem, []byte, *workflowspb.BaseExecutionInfo, error) { xdc_cache.go
141 > baseWorkflowInfo := CopyBaseWorkflowInfo(executionInfo.BaseExecutionInfo)
142 > versionHistories := executionInfo.VersionHistories
143 > versionHistoryIndex, err := versionhistory.FindFirstVersionHistoryIndexByVersionHistoryItem(
144 > versionHistories,
145 > versionhistory.NewVersionHistoryItem(
146 > eventID,
147 > version,
148 > ),
149 > )
150 > if err != nil {
151 return nil, nil, nil, err
152 }
153
154 > versionHistoryBranch, err := versionhistory.GetVersionHistory(versionHistories, versionHistoryIndex) xdc_cache.go
155 > if err != nil {
156 return nil, nil, nil, err
157 }
158 > return versionhistory.CopyVersionHistory(versionHistoryBranch).GetItems(), versionHistoryBranch.GetBranchToken(), baseWorkflowInfo, nil xdc_cache.go
159 }
160
161 func CopyBaseWorkflowInfo(
162 baseWorkflowInfo *workflowspb.BaseExecutionInfo,
163 > ) *workflowspb.BaseExecutionInfo { xdc_cache.go
164 > if baseWorkflowInfo == nil {
165 return nil
166 }
167 > return &workflowspb.BaseExecutionInfo{ xdc_cache.go
168 > RunId: baseWorkflowInfo.RunId,
169 > LowestCommonAncestorEventId: baseWorkflowInfo.LowestCommonAncestorEventId,
170 > LowestCommonAncestorEventVersion: baseWorkflowInfo.LowestCommonAncestorEventVersion,
171 > }
172 }
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/gocql/query.go 34 covered LOC · 14 ranges

Open complete file

19 session *session,
20 gocqlQuery *gocql.Query,
21 > ) *query { query.go
22 > return &query{
23 > session: session,
24 > gocqlQuery: gocqlQuery,
25 > }
26 > }
27
28 > func (q *query) Exec() (retError error) { query.go
29 > defer func() { q.session.handleError(retError) }()
30
31 > return q.gocqlQuery.Exec() query.go
32 }
33
34 func (q *query) Scan(
35 dest ...any,
36 > ) (retError error) { query.go
37 > defer func() { q.session.handleError(retError) }()
38
39 > return q.gocqlQuery.Scan(dest...) query.go
40 }
41
50 func (q *query) MapScan(
51 m map[string]any,
52 > ) (retError error) { query.go
53 > defer func() { q.session.handleError(retError) }()
54
55 > return q.gocqlQuery.MapScan(m) query.go
56 }
57
58 func (q *query) MapScanCAS(
59 dest map[string]any,
60 > ) (_ bool, retError error) { query.go
61 > defer func() { q.session.handleError(retError) }()
62
63 > return q.gocqlQuery.MapScanCAS(dest) query.go
64 }
65
66 > func (q *query) Iter() Iter { query.go
67 > iter := q.gocqlQuery.Iter()
68 > return newIter(q.session, iter)
69 > }
70
71 > func (q *query) PageSize(n int) Query { query.go
72 > q.gocqlQuery.PageSize(n)
73 > return newQuery(q.session, q.gocqlQuery)
74 > }
75
76 > func (q *query) PageState(state []byte) Query { query.go
77 > q.gocqlQuery.PageState(state)
78 > return newQuery(q.session, q.gocqlQuery)
79 > }
80
81 func (q *query) Consistency(c Consistency) Query {
89 }
90
91 > func (q *query) WithContext(ctx context.Context) Query { query.go
92 > q2 := q.gocqlQuery.WithContext(ctx)
93 > if q2 == nil {
94 return nil
95 }
96 > return newQuery(q.session, q2) query.go
97 }
98
go.temporal.io/server/common/log/tag/tags.go 33 covered LOC · 11 ranges

Open complete file

30
31 // Operation returns tag for Operation
32 > func Operation(operation string) ZapTag { tags.go
33 > return NewStringTag("operation", operation)
34 > }
35
36 // Error returns tag for Error
70
71 // WorkflowAction returns tag for WorkflowAction
72 > func workflowAction(action string) ZapTag { tags.go
73 > return NewStringTag("wf-action", action)
74 > }
75
76 // WorkflowListFilterType returns tag for WorkflowListFilterType
77 > func workflowListFilterType(listFilterType string) ZapTag { tags.go
78 > return NewStringTag("wf-list-filter-type", listFilterType)
79 > }
80
81 // general
376
377 // Component returns tag for Component
378 > func component(component string) ZapTag { tags.go
379 > return NewStringTag("component", component)
380 > }
381
382 // Lifecycle returns tag for Lifecycle
383 > func lifecycle(lifecycle string) ZapTag { tags.go
384 > return NewStringTag("lifecycle", lifecycle)
385 > }
386
387 // StoreOperation returns tag for StoreOperation
388 > func storeOperation(storeOperation string) ZapTag { tags.go
389 > return NewStringTag("store-operation", storeOperation)
390 > }
391
392 // OperationResult returns tag for OperationResult
393 > func operationResult(operationResult string) ZapTag { tags.go
394 > return NewStringTag("operation-result", operationResult)
395 > }
396
397 // ErrorType returns tag for ErrorType
401
402 // errorType returns tag for ErrorType given a string
403 > func errorType(errorType string) ZapTag { tags.go
404 > return NewStringTag("error-type", errorType)
405 > }
406
407 // Shardupdate returns tag for Shardupdate
408 > func shardupdate(shardupdate string) ZapTag { tags.go
409 > return NewStringTag("shard-update", shardupdate)
410 > }
411
412 // scope returns a tag for scope
413 // Pre-defined scope tags are in values.go.
414 > func scope(scope string) ZapTag { tags.go
415 > return NewStringTag("scope", scope)
416 > }
417
418 // general
459
460 // Value returns tag for Value
461 > func Value(v any) ZapTag { tags.go
462 > return NewAnyTag("value", v)
463 > }
464
465 // ValueType returns tag for ValueType
go.temporal.io/server/common/persistence/cassandra/factory.go 33 covered LOC · 7 ranges

Open complete file

36 metricsHandler metrics.Handler,
37 serializer serialization.Serializer,
38 > ) *Factory { factory.go
39 > session, err := commongocql.NewSession(
40 > func() (*gocql.ClusterConfig, error) {
41 > return commongocql.NewCassandraCluster(cfg, r)
42 > },
43 logger,
44 metricsHandler,
45 )
46 > if err != nil { factory.go
47 logger.Fatal("unable to initialize cassandra session", tag.Error(err))
48 }
49 > return NewFactoryFromSession( factory.go
50 > cfg,
51 > clusterName,
52 > logger,
53 > session,
54 > serializer,
55 > )
56 }
57
63 session commongocql.Session,
64 serializer serialization.Serializer,
65 > ) *Factory { factory.go
66 > return &Factory{
67 > cfg: cfg,
68 > clusterName: clusterName,
69 > logger: logger,
70 > session: session,
71 > serializer: serializer,
72 > }
73 > }
74
75 // NewTaskStore returns a new task store
84
85 // NewShardStore returns a new shard store
86 > func (f *Factory) NewShardStore() (p.ShardStore, error) { factory.go
87 > return NewShardStore(f.clusterName, f.session, f.logger), nil
88 > }
89
90 // NewMetadataStore returns a metadata store
99
100 // NewExecutionStore returns a new ExecutionStore.
101 > func (f *Factory) NewExecutionStore() (p.ExecutionStore, error) { factory.go
102 > return NewExecutionStore(f.session, f.serializer, f.logger), nil
103 > }
104
105 // NewQueue returns a new queue backed by cassandra
120
121 // Close closes the factory
122 > func (f *Factory) Close() { factory.go
123 > f.Lock()
124 > defer f.Unlock()
125 > f.session.Close()
126 > }
go.temporal.io/server/common/dynamicconfig/deepcopy.go 31 covered LOC · 6 ranges

Open complete file

9 // deepCopyForMapstructure does a simple deep copy of T. Fancy cases (anything other than plain old data)
10 // is not handled and will panic.
11 > func deepCopyForMapstructure[T any](t T) T { deepcopy.go
12 > // nolint:revive // this will be triggered from a static initializer before it can be triggered from production code
13 > return deepCopyValue(reflect.ValueOf(t)).Interface().(T)
14 > }
15
16 > func deepCopyValue(v reflect.Value) reflect.Value { deepcopy.go
17 > switch v.Kind() {
18 case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
19 reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
20 > reflect.Uintptr, reflect.Float32, reflect.Float64, reflect.String: deepcopy.go
21 > nv := reflect.New(v.Type()).Elem()
22 > nv.Set(v)
23 > return nv
24 case reflect.Array:
25 nv := reflect.New(v.Type()).Elem()
42 }
43 return deepCopyValue(v.Elem()).Addr()
44 > case reflect.Slice: deepcopy.go
45 > if v.IsNil() {
46 > return v
47 > }
48 nv := reflect.MakeSlice(v.Type(), v.Len(), v.Len())
49 for i := range v.Len() {
51 }
52 return nv
53 > case reflect.Struct: deepcopy.go
54 > // Special case for time.Time: it has unexported fields so we can't copy it field by
55 > // field, but we can copy zero values (which is all we need for default values).
56 > if v.Type() == reflect.TypeFor[time.Time]() {
57 > if v.Interface().(time.Time).IsZero() {
58 > return reflect.ValueOf(time.Time{})
59 > }
60 // nolint:forbidigo // this will be triggered from a static initializer before it can be triggered from production code
61 panic(fmt.Sprintf("Can't deep copy non-zero time.Time: %v", v.Interface()))
62 }
63 > nv := reflect.New(v.Type()).Elem() deepcopy.go
64 > for i := range v.Type().NumField() {
65 > nv.Field(i).Set(deepCopyValue(v.Field(i)))
66 > }
67 > return nv
68 > case reflect.Interface, reflect.Func, reflect.Chan:
69 > // only nil values of any other reference types allowed!
70 > if v.IsNil() {
71 > return v
72 > }
73 fallthrough
74 default:
go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/execution_maps.go 30 covered LOC · 5 ranges

Open complete file

53 )
54
55 > func stringMap(a []string, f func(string) string) []string { execution_maps.go
56 > b := make([]string, len(a))
57 > for i, v := range a {
58 > b[i] = f(v)
59 > }
60 > return b
61 }
62
63 > func makeDeleteMapQry(tableName string) string { execution_maps.go
64 > return fmt.Sprintf(deleteMapQryTemplate, tableName)
65 > }
66
67 > func makeSetKeyInMapQry(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
68 > return fmt.Sprintf(setKeyInMapQryTemplate,
69 > tableName,
70 > strings.Join(nonPrimaryKeyColumns, ","),
71 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
72 > return ":" + x
73 > }), ","),
74 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
75 > return x + "=VALUES(" + x + ")"
76 > }), ","),
77 mapKeyName)
78 }
79
80 > func makeDeleteKeyInMapQry(tableName string, mapKeyName string) string { execution_maps.go
81 > return fmt.Sprintf(deleteKeyInMapQryTemplate,
82 > tableName,
83 > mapKeyName)
84 > }
85
86 > func makeGetMapQryTemplate(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
87 > return fmt.Sprintf(getMapQryTemplate,
88 > tableName,
89 > mapKeyName,
90 > strings.Join(nonPrimaryKeyColumns, ","))
91 > }
92
93 var (
go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/execution_maps.go 30 covered LOC · 6 ranges

Open complete file

86 )
87
88 > func stringMap(a []string, f func(string) string) []string { execution_maps.go
89 > b := make([]string, len(a))
90 > for i, v := range a {
91 > b[i] = f(v)
92 > }
93 > return b
94 }
95
96 > func makeDeleteMapQry(tableName string) string { execution_maps.go
97 > return fmt.Sprintf(deleteMapQueryTemplate, tableName)
98 > }
99
100 > func makeSetKeyInMapQry(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
101 > return fmt.Sprintf(setKeyInMapQueryTemplate,
102 > tableName,
103 > strings.Join(nonPrimaryKeyColumns, ","),
104 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
105 > return ":" + x
106 > }), ","),
107 mapKeyName,
108 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string { execution_maps.go
109 > return "excluded." + x
110 > }), ","))
111 }
112
113 > func makeDeleteKeyInMapQry(tableName string, mapKeyName string) string { execution_maps.go
114 > return fmt.Sprintf(deleteKeyInMapQueryTemplate,
115 > tableName,
116 > mapKeyName)
117 > }
118
119 > func makeGetMapQryTemplate(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
120 > return fmt.Sprintf(getMapQueryTemplate,
121 > tableName,
122 > mapKeyName,
123 > strings.Join(nonPrimaryKeyColumns, ","))
124 > }
125
126 var (
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/execution_maps.go 30 covered LOC · 5 ranges

Open complete file

52 )
53
54 > func stringMap(a []string, f func(string) string) []string { execution_maps.go
55 > b := make([]string, len(a))
56 > for i, v := range a {
57 > b[i] = f(v)
58 > }
59 > return b
60 }
61
62 > func makeDeleteMapQry(tableName string) string { execution_maps.go
63 > return fmt.Sprintf(deleteMapQryTemplate, tableName)
64 > }
65
66 > func makeSetKeyInMapQry(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
67 > return fmt.Sprintf(setKeyInMapQryTemplate,
68 > tableName,
69 > strings.Join(nonPrimaryKeyColumns, ","),
70 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
71 > return ":" + x
72 > }), ","),
73 > strings.Join(stringMap(nonPrimaryKeyColumns, func(x string) string {
74 > return x + "=" + x
75 > }), ","),
76 mapKeyName)
77 }
78
79 > func makeDeleteKeyInMapQry(tableName string, mapKeyName string) string { execution_maps.go
80 > return fmt.Sprintf(deleteKeyInMapQryTemplate,
81 > tableName,
82 > mapKeyName)
83 > }
84
85 > func makeGetMapQryTemplate(tableName string, nonPrimaryKeyColumns []string, mapKeyName string) string { execution_maps.go
86 > return fmt.Sprintf(getMapQryTemplate,
87 > tableName,
88 > mapKeyName,
89 > strings.Join(nonPrimaryKeyColumns, ","))
90 > }
91
92 var (
go.temporal.io/server/common/searchattribute/sadefs/constants.go 30 covered LOC · 9 ranges

Open complete file

261 }
262
263 > dbCustomSearchAttributeFieldNameRE = func() map[enumspb.IndexedValueType]*regexp.Regexp { constants.go
264 > res := map[enumspb.IndexedValueType]*regexp.Regexp{}
265 > for t := range defaultNumDBCustomSearchAttributes {
266 > res[t] = regexp.MustCompile(fmt.Sprintf(`^%s(0[1-9]|[1-9][0-9])$`, t.String()))
267 > }
268 > return res
269 }()
270 )
271
272 // System returns a clone of the system search attributes map.
273 > func System() map[string]enumspb.IndexedValueType { constants.go
274 > return maps.Clone(system)
275 > }
276
277 // Predefined returns a clone of the predefined search attributes map.
278 > func Predefined() map[string]enumspb.IndexedValueType { constants.go
279 > return maps.Clone(predefined)
280 > }
281
282 // PredefinedWhiteList returns a clone of the predefined whitelist search attributes map.
283 > func PredefinedWhiteList() map[string]enumspb.IndexedValueType { constants.go
284 > return maps.Clone(predefinedWhiteList)
285 > }
286
287 // Reserved returns a clone of the reserved field names map.
343 // GetSqlDbColName maps system and reserved search attributes to column names for SQL tables.
344 // If the input is not a system or reserved search attribute, then it returns the input.
345 > func GetSqlDbColName(name string) string { constants.go
346 > if fieldName, ok := sqlDbSystemNameToColName[name]; ok {
347 > return fieldName constants.go
348 > }
349 return name
350 }
352 func GetDBIndexSearchAttributes(
353 override map[enumspb.IndexedValueType]int,
354 > ) *persistencespb.IndexSearchAttributes { constants.go
355 > csa := map[string]enumspb.IndexedValueType{}
356 > for saType, defaultNumAttrs := range defaultNumDBCustomSearchAttributes {
357 > numAttrs := defaultNumAttrs
358 > if value, ok := override[saType]; ok {
359 numAttrs = value
360 }
361 > for i := range numAttrs { constants.go
362 > csa[fmt.Sprintf("%s%02d", saType.String(), i+1)] = saType
363 > }
364 }
365 > return &persistencespb.IndexSearchAttributes{ constants.go
366 > CustomSearchAttributes: csa,
367 > }
368 }
369
go.temporal.io/server/api/clock/v1/message.pb.go 29 covered LOC · 5 ranges

Open complete file

45 func (*VectorClock) ProtoMessage() {}
46
47 > func (x *VectorClock) ProtoReflect() protoreflect.Message { message.pb.go
48 > mi := &file_temporal_server_api_clock_v1_message_proto_msgTypes[0]
49 > if x != nil {
50 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) message.pb.go
51 > if ms.LoadMessageInfo() == nil {
52 > ms.StoreMessageInfo(mi)
53 > }
54 > return ms
55 }
56 > return mi.MessageOf(x) message.pb.go
57 }
58
193 }
194
195 > func init() { file_temporal_server_api_clock_v1_message_proto_init() } message.pb.go
196 > func file_temporal_server_api_clock_v1_message_proto_init() {
197 > if File_temporal_server_api_clock_v1_message_proto != nil {
198 return
199 }
200 > type x struct{} message.pb.go
201 > out := protoimpl.TypeBuilder{
202 > File: protoimpl.DescBuilder{
203 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
204 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_clock_v1_message_proto_rawDesc), len(file_temporal_server_api_clock_v1_message_proto_rawDesc)),
205 > NumEnums: 0,
206 > NumMessages: 2,
207 > NumExtensions: 0,
208 > NumServices: 0,
209 > },
210 > GoTypes: file_temporal_server_api_clock_v1_message_proto_goTypes,
211 > DependencyIndexes: file_temporal_server_api_clock_v1_message_proto_depIdxs,
212 > MessageInfos: file_temporal_server_api_clock_v1_message_proto_msgTypes,
213 > }.Build()
214 > File_temporal_server_api_clock_v1_message_proto = out.File
215 > file_temporal_server_api_clock_v1_message_proto_goTypes = nil
216 > file_temporal_server_api_clock_v1_message_proto_depIdxs = nil
217 }
go.temporal.io/server/api/taskqueue/v1/message.pb.go 29 covered LOC · 2 ranges

Open complete file

1330 }
1331
1332 > func init() { file_temporal_server_api_taskqueue_v1_message_proto_init() } message.pb.go
1333 > func file_temporal_server_api_taskqueue_v1_message_proto_init() {
1334 > if File_temporal_server_api_taskqueue_v1_message_proto != nil {
1335 return
1336 }
1337 > file_temporal_server_api_taskqueue_v1_message_proto_msgTypes[0].OneofWrappers = []any{ message.pb.go
1338 > (*TaskVersionDirective_UseAssignmentRules)(nil),
1339 > (*TaskVersionDirective_AssignedBuildId)(nil),
1340 > }
1341 > file_temporal_server_api_taskqueue_v1_message_proto_msgTypes[5].OneofWrappers = []any{
1342 > (*TaskQueuePartition_NormalPartitionId)(nil),
1343 > (*TaskQueuePartition_StickyName)(nil),
1344 > (*TaskQueuePartition_WorkerCommands)(nil),
1345 > }
1346 > type x struct{}
1347 > out := protoimpl.TypeBuilder{
1348 > File: protoimpl.DescBuilder{
1349 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1350 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_taskqueue_v1_message_proto_rawDesc), len(file_temporal_server_api_taskqueue_v1_message_proto_rawDesc)),
1351 > NumEnums: 0,
1352 > NumMessages: 16,
1353 > NumExtensions: 0,
1354 > NumServices: 0,
1355 > },
1356 > GoTypes: file_temporal_server_api_taskqueue_v1_message_proto_goTypes,
1357 > DependencyIndexes: file_temporal_server_api_taskqueue_v1_message_proto_depIdxs,
1358 > MessageInfos: file_temporal_server_api_taskqueue_v1_message_proto_msgTypes,
1359 > }.Build()
1360 > File_temporal_server_api_taskqueue_v1_message_proto = out.File
1361 > file_temporal_server_api_taskqueue_v1_message_proto_goTypes = nil
1362 > file_temporal_server_api_taskqueue_v1_message_proto_depIdxs = nil
1363 }
go.temporal.io/server/api/workflow/v1/message.pb.go 29 covered LOC · 5 ranges

Open complete file

189 func (*BaseExecutionInfo) ProtoMessage() {}
190
191 > func (x *BaseExecutionInfo) ProtoReflect() protoreflect.Message { message.pb.go
192 > mi := &file_temporal_server_api_workflow_v1_message_proto_msgTypes[2]
193 > if x != nil {
194 > ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) message.pb.go
195 > if ms.LoadMessageInfo() == nil {
196 > ms.StoreMessageInfo(mi)
197 > }
198 > return ms
199 }
200 > return mi.MessageOf(x) message.pb.go
201 }
202
278 }
279
280 > func init() { file_temporal_server_api_workflow_v1_message_proto_init() } message.pb.go
281 > func file_temporal_server_api_workflow_v1_message_proto_init() {
282 > if File_temporal_server_api_workflow_v1_message_proto != nil {
283 return
284 }
285 > type x struct{} message.pb.go
286 > out := protoimpl.TypeBuilder{
287 > File: protoimpl.DescBuilder{
288 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
289 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_workflow_v1_message_proto_rawDesc), len(file_temporal_server_api_workflow_v1_message_proto_rawDesc)),
290 > NumEnums: 0,
291 > NumMessages: 3,
292 > NumExtensions: 0,
293 > NumServices: 0,
294 > },
295 > GoTypes: file_temporal_server_api_workflow_v1_message_proto_goTypes,
296 > DependencyIndexes: file_temporal_server_api_workflow_v1_message_proto_depIdxs,
297 > MessageInfos: file_temporal_server_api_workflow_v1_message_proto_msgTypes,
298 > }.Build()
299 > File_temporal_server_api_workflow_v1_message_proto = out.File
300 > file_temporal_server_api_workflow_v1_message_proto_goTypes = nil
301 > file_temporal_server_api_workflow_v1_message_proto_depIdxs = nil
302 }
go.temporal.io/server/common/config/persistence.go 29 covered LOC · 14 ranges

Open complete file

197
198 // GetConsistency returns the gosql.Consistency setting from the configuration for the given store type
199 > func (c *CassandraStoreConsistency) GetConsistency() gocql.Consistency { persistence.go
200 > return gocql.ParseConsistency(c.getConsistencySettings().Consistency)
201 > }
202
203 // GetSerialConsistency returns the gosql.SerialConsistency setting from the configuration for the store
204 > func (c *CassandraStoreConsistency) GetSerialConsistency() gocql.SerialConsistency { persistence.go
205 > res, err := parseSerialConsistency(c.getConsistencySettings().SerialConsistency)
206 > if err != nil {
207 panic(fmt.Sprintf("unable to decode cassandra serial consistency: %v", err))
208 }
209 > return res persistence.go
210 }
211
212 > func (c *CassandraStoreConsistency) getConsistencySettings() *CassandraConsistencySettings { persistence.go
213 > return ensureStoreConsistencyNotNil(c).Default
214 > }
215
216 > func ensureStoreConsistencyNotNil(c *CassandraStoreConsistency) *CassandraStoreConsistency { persistence.go
217 > if c == nil {
218 > c = &CassandraStoreConsistency{} persistence.go
219 > }
220 > if c.Default == nil { persistence.go
221 > c.Default = &CassandraConsistencySettings{} persistence.go
222 > }
223 > if c.Default.Consistency == "" { persistence.go
224 > c.Default.Consistency = "LOCAL_QUORUM" persistence.go
225 > }
226 > if c.Default.SerialConsistency == "" { persistence.go
227 > c.Default.SerialConsistency = "LOCAL_SERIAL" persistence.go
228 > }
229
230 > return c persistence.go
231 }
232
276 }
277
278 > func parseSerialConsistency(serialConsistency string) (gocql.SerialConsistency, error) { persistence.go
279 > var s gocql.SerialConsistency
280 > err := s.UnmarshalText([]byte(strings.ToUpper(serialConsistency)))
281 > return s, err
282 > }
283
284 func (c *SQL) validate() error {
go.temporal.io/server/common/util.go 28 covered LOC · 5 ranges

Open complete file

161
162 // CreatePersistenceClientRetryPolicy creates a retry policy for calls to persistence
163 > func CreatePersistenceClientRetryPolicy() backoff.RetryPolicy { util.go
164 > return backoff.NewExponentialRetryPolicy(persistenceClientRetryInitialInterval).
165 > WithMaximumAttempts(persistenceClientRetryMaxAttempts)
166 > }
167
168 // CreateFrontendClientRetryPolicy creates a retry policy for calls to frontend service
249
250 // CreateTaskReschedulePolicy creates a retry policy for rescheduling task with errors not equal to ErrTaskRetry
251 > func CreateTaskReschedulePolicy() backoff.RetryPolicy { util.go
252 > return backoff.NewExponentialRetryPolicy(taskRescheduleInitialInterval).
253 > WithBackoffCoefficient(taskRescheduleBackoffCoefficient).
254 > WithMaximumInterval(taskRescheduleMaxInterval).
255 > WithExpirationInterval(backoff.NoInterval)
256 > }
257
258 // CreateDependencyTaskNotCompletedReschedulePolicy creates a retry policy for rescheduling task with
259 // ErrDependencyTaskNotCompleted
260 > func CreateDependencyTaskNotCompletedReschedulePolicy() backoff.RetryPolicy { util.go
261 > return backoff.NewExponentialRetryPolicy(dependencyTaskNotCompletedRescheduleInitialInterval).
262 > WithBackoffCoefficient(dependencyTaskNotCompletedRescheduleBackoffCoefficient).
263 > WithMaximumInterval(dependencyTaskNotCompletedRescheduleMaxInterval).
264 > WithExpirationInterval(backoff.NoInterval)
265 > }
266
267 // CreateTaskNotReadyReschedulePolicy creates a retry policy for rescheduling task with ErrTaskRetry
268 > func CreateTaskNotReadyReschedulePolicy() backoff.RetryPolicy { util.go
269 > return backoff.NewExponentialRetryPolicy(taskNotReadyRescheduleInitialInterval).
270 > WithBackoffCoefficient(taskNotReadyRescheduleBackoffCoefficient).
271 > WithMaximumInterval(taskNotReadyRescheduleMaxInterval).
272 > WithExpirationInterval(backoff.NoInterval)
273 > }
274
275 // CreateTaskResourceExhaustedReschedulePolicy creates a retry policy for rescheduling task with resource exhausted error
276 > func CreateTaskResourceExhaustedReschedulePolicy() backoff.RetryPolicy { util.go
277 > return backoff.NewExponentialRetryPolicy(taskResourceExhaustedRescheduleInitialInterval).
278 > WithBackoffCoefficient(taskResourceExhaustedRescheduleBackoffCoefficient).
279 > WithMaximumInterval(taskResourceExhaustedRescheduleMaxInterval).
280 > WithExpirationInterval(backoff.NoInterval)
281 > }
282
283 // CreateSdkClientFactoryRetryPolicy creates a retry policy to handle SdkClientFactory NewClient when frontend service is not ready
go.temporal.io/server/api/persistence/v1/queues.pb.go 27 covered LOC · 3 ranges

Open complete file

98 func (*QueueState) ProtoMessage() {}
99
100 > func (x *QueueState) ProtoReflect() protoreflect.Message { queues.pb.go
101 > mi := &file_temporal_server_api_persistence_v1_queues_proto_msgTypes[1]
102 > if x != nil {
103 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
104 if ms.LoadMessageInfo() == nil {
107 return ms
108 }
109 > return mi.MessageOf(x) queues.pb.go
110 }
111
616 }
617
618 > func init() { file_temporal_server_api_persistence_v1_queues_proto_init() } queues.pb.go
619 > func file_temporal_server_api_persistence_v1_queues_proto_init() {
620 > if File_temporal_server_api_persistence_v1_queues_proto != nil {
621 > return
622 > }
623 > file_temporal_server_api_persistence_v1_predicates_proto_init()
624 > type x struct{}
625 > out := protoimpl.TypeBuilder{
626 > File: protoimpl.DescBuilder{
627 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
628 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_queues_proto_rawDesc), len(file_temporal_server_api_persistence_v1_queues_proto_rawDesc)),
629 > NumEnums: 0,
630 > NumMessages: 12,
631 > NumExtensions: 0,
632 > NumServices: 0,
633 > },
634 > GoTypes: file_temporal_server_api_persistence_v1_queues_proto_goTypes,
635 > DependencyIndexes: file_temporal_server_api_persistence_v1_queues_proto_depIdxs,
636 > MessageInfos: file_temporal_server_api_persistence_v1_queues_proto_msgTypes,
637 > }.Build()
638 > File_temporal_server_api_persistence_v1_queues_proto = out.File
639 > file_temporal_server_api_persistence_v1_queues_proto_goTypes = nil
640 > file_temporal_server_api_persistence_v1_queues_proto_depIdxs = nil
641 }
go.temporal.io/server/common/persistence/serialization/codec.go 27 covered LOC · 12 ranges

Open complete file

26 // encodingTypeFromEnv returns an EncodingType based on the environment variable `TEMPORAL_TEST_DATA_ENCODING`.
27 // It defaults to "ENCODING_TYPE_PROTO3" codec if the environment variable is not set.
28 > func encodingTypeFromEnv() enumspb.EncodingType { codec.go
29 > codecType := os.Getenv(SerializerDataEncodingEnvVar)
30 > switch strings.ToLower(codecType) {
31 > case "", "proto3": codec.go
32 > return enumspb.ENCODING_TYPE_PROTO3
33 case "json":
34 return enumspb.ENCODING_TYPE_JSON
57 // Encode encodes the given proto message. It respects the `TEMPORAL_TEST_DATA_ENCODING` environment variable;
58 // otherwise, it defaults to "ENCODING_TYPE_PROTO3".
59 > func Encode(m proto.Message, options ...EncodeOption) (*commonpb.DataBlob, error) { codec.go
60 > return encodeBlob(m, encodingTypeFromEnv(), options...)
61 > }
62
63 func encodeBlob(
65 encoding enumspb.EncodingType,
66 options ...EncodeOption,
67 > ) (*commonpb.DataBlob, error) { codec.go
68 > opts := encodeOptions{}
69 > for _, option := range options {
70 option(&opts)
71 }
72
73 > if m == nil { codec.go
74 return &commonpb.DataBlob{
75 Data: nil,
78 }
79
80 > switch encoding { codec.go
81 case enumspb.ENCODING_TYPE_JSON:
82 blob, err := codec.NewJSONPBEncoder().Encode(m)
88 EncodingType: enumspb.ENCODING_TYPE_JSON,
89 }, nil
90 > case enumspb.ENCODING_TYPE_PROTO3: codec.go
91 > data, err := proto.MarshalOptions{Deterministic: opts.deterministic}.Marshal(m)
92 > if err != nil {
93 return nil, NewSerializationError(enumspb.ENCODING_TYPE_PROTO3, err)
94 }
95 > return &commonpb.DataBlob{ codec.go
96 > EncodingType: enumspb.ENCODING_TYPE_PROTO3,
97 > Data: data,
98 > }, nil
99 default:
100 return nil, NewUnknownEncodingTypeError(encoding.String(), enumspb.ENCODING_TYPE_JSON, enumspb.ENCODING_TYPE_PROTO3)
102 }
103
104 > func Decode(data *commonpb.DataBlob, result proto.Message) error { codec.go
105 > if data == nil {
106 return NewDeserializationError(enumspb.ENCODING_TYPE_UNSPECIFIED, errors.New("cannot decode nil"))
107 }
108
109 > switch data.EncodingType { codec.go
110 case enumspb.ENCODING_TYPE_JSON:
111 return codec.NewJSONPBEncoder().Decode(data.Data, result)
112 > case enumspb.ENCODING_TYPE_PROTO3: codec.go
113 > err := proto.Unmarshal(data.Data, result)
114 > if err != nil {
115 return NewDeserializationError(enumspb.ENCODING_TYPE_PROTO3, err)
116 }
117 > return nil codec.go
118 default:
119 return NewUnknownEncodingTypeError(data.EncodingType.String(), enumspb.ENCODING_TYPE_JSON, enumspb.ENCODING_TYPE_PROTO3)
go.temporal.io/server/api/enums/v1/common.pb.go 26 covered LOC · 4 ranges

Open complete file

120 }
121
122 > func (ChecksumFlavor) Descriptor() protoreflect.EnumDescriptor { common.pb.go
123 > return file_temporal_server_api_enums_v1_common_proto_enumTypes[1].Descriptor()
124 > }
125
126 func (ChecksumFlavor) Type() protoreflect.EnumType {
201 }
202
203 > func (CallbackState) Descriptor() protoreflect.EnumDescriptor { common.pb.go
204 > return file_temporal_server_api_enums_v1_common_proto_enumTypes[2].Descriptor()
205 > }
206
207 func (CallbackState) Type() protoreflect.EnumType {
264 }
265
266 > func init() { file_temporal_server_api_enums_v1_common_proto_init() } common.pb.go
267 > func file_temporal_server_api_enums_v1_common_proto_init() {
268 > if File_temporal_server_api_enums_v1_common_proto != nil {
269 return
270 }
271 > type x struct{} common.pb.go
272 > out := protoimpl.TypeBuilder{
273 > File: protoimpl.DescBuilder{
274 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
275 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_common_proto_rawDesc), len(file_temporal_server_api_enums_v1_common_proto_rawDesc)),
276 > NumEnums: 3,
277 > NumMessages: 0,
278 > NumExtensions: 0,
279 > NumServices: 0,
280 > },
281 > GoTypes: file_temporal_server_api_enums_v1_common_proto_goTypes,
282 > DependencyIndexes: file_temporal_server_api_enums_v1_common_proto_depIdxs,
283 > EnumInfos: file_temporal_server_api_enums_v1_common_proto_enumTypes,
284 > }.Build()
285 > File_temporal_server_api_enums_v1_common_proto = out.File
286 > file_temporal_server_api_enums_v1_common_proto_goTypes = nil
287 > file_temporal_server_api_enums_v1_common_proto_depIdxs = nil
288 }
go.temporal.io/server/api/enums/v1/task.pb.go 26 covered LOC · 4 ranges

Open complete file

303 }
304
305 > func (TaskType) Descriptor() protoreflect.EnumDescriptor { task.pb.go
306 > return file_temporal_server_api_enums_v1_task_proto_enumTypes[1].Descriptor()
307 > }
308
309 func (TaskType) Type() protoreflect.EnumType {
361 }
362
363 > func (TaskPriority) Descriptor() protoreflect.EnumDescriptor { task.pb.go
364 > return file_temporal_server_api_enums_v1_task_proto_enumTypes[2].Descriptor()
365 > }
366
367 func (TaskPriority) Type() protoreflect.EnumType {
456 }
457
458 > func init() { file_temporal_server_api_enums_v1_task_proto_init() } task.pb.go
459 > func file_temporal_server_api_enums_v1_task_proto_init() {
460 > if File_temporal_server_api_enums_v1_task_proto != nil {
461 return
462 }
463 > type x struct{} task.pb.go
464 > out := protoimpl.TypeBuilder{
465 > File: protoimpl.DescBuilder{
466 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
467 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_task_proto_rawDesc), len(file_temporal_server_api_enums_v1_task_proto_rawDesc)),
468 > NumEnums: 3,
469 > NumMessages: 0,
470 > NumExtensions: 0,
471 > NumServices: 0,
472 > },
473 > GoTypes: file_temporal_server_api_enums_v1_task_proto_goTypes,
474 > DependencyIndexes: file_temporal_server_api_enums_v1_task_proto_depIdxs,
475 > EnumInfos: file_temporal_server_api_enums_v1_task_proto_enumTypes,
476 > }.Build()
477 > File_temporal_server_api_enums_v1_task_proto = out.File
478 > file_temporal_server_api_enums_v1_task_proto_goTypes = nil
479 > file_temporal_server_api_enums_v1_task_proto_depIdxs = nil
480 }
go.temporal.io/server/api/enums/v1/workflow.pb.go 26 covered LOC · 4 ranges

Open complete file

86 }
87
88 > func (WorkflowExecutionState) Descriptor() protoreflect.EnumDescriptor { workflow.pb.go
89 > return file_temporal_server_api_enums_v1_workflow_proto_enumTypes[0].Descriptor()
90 > }
91
92 func (WorkflowExecutionState) Type() protoreflect.EnumType {
150 }
151
152 > func (WorkflowBackoffType) Descriptor() protoreflect.EnumDescriptor { workflow.pb.go
153 > return file_temporal_server_api_enums_v1_workflow_proto_enumTypes[1].Descriptor()
154 > }
155
156 func (WorkflowBackoffType) Type() protoreflect.EnumType {
275 }
276
277 > func init() { file_temporal_server_api_enums_v1_workflow_proto_init() } workflow.pb.go
278 > func file_temporal_server_api_enums_v1_workflow_proto_init() {
279 > if File_temporal_server_api_enums_v1_workflow_proto != nil {
280 return
281 }
282 > type x struct{} workflow.pb.go
283 > out := protoimpl.TypeBuilder{
284 > File: protoimpl.DescBuilder{
285 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
286 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_workflow_proto_rawDesc), len(file_temporal_server_api_enums_v1_workflow_proto_rawDesc)),
287 > NumEnums: 3,
288 > NumMessages: 0,
289 > NumExtensions: 0,
290 > NumServices: 0,
291 > },
292 > GoTypes: file_temporal_server_api_enums_v1_workflow_proto_goTypes,
293 > DependencyIndexes: file_temporal_server_api_enums_v1_workflow_proto_depIdxs,
294 > EnumInfos: file_temporal_server_api_enums_v1_workflow_proto_enumTypes,
295 > }.Build()
296 > File_temporal_server_api_enums_v1_workflow_proto = out.File
297 > file_temporal_server_api_enums_v1_workflow_proto_goTypes = nil
298 > file_temporal_server_api_enums_v1_workflow_proto_depIdxs = nil
299 }
go.temporal.io/server/chasm/lib/scheduler/gen/schedulerpb/v1/message.pb.go 26 covered LOC · 1 range

Open complete file

843 }
844
845 > func init() { file_temporal_server_chasm_lib_scheduler_proto_v1_message_proto_init() } message.pb.go
846 > func file_temporal_server_chasm_lib_scheduler_proto_v1_message_proto_init() {
847 > if File_temporal_server_chasm_lib_scheduler_proto_v1_message_proto != nil {
848 > return
849 > }
850 > file_temporal_server_chasm_lib_scheduler_proto_v1_message_proto_msgTypes[4].OneofWrappers = []any{
851 > (*BackfillerState_BackfillRequest)(nil),
852 > (*BackfillerState_TriggerRequest)(nil),
853 > }
854 > type x struct{}
855 > out := protoimpl.TypeBuilder{
856 > File: protoimpl.DescBuilder{
857 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
858 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_scheduler_proto_v1_message_proto_rawDesc), len(file_temporal_server_chasm_lib_scheduler_proto_v1_message_proto_rawDesc)),
859 > NumEnums: 0,
860 > NumMessages: 12,
861 > NumExtensions: 0,
862 > NumServices: 0,
863 > },
864 > GoTypes: file_temporal_server_chasm_lib_scheduler_proto_v1_message_proto_goTypes,
865 > DependencyIndexes: file_temporal_server_chasm_lib_scheduler_proto_v1_message_proto_depIdxs,
866 > MessageInfos: file_temporal_server_chasm_lib_scheduler_proto_v1_message_proto_msgTypes,
867 > }.Build()
868 > File_temporal_server_chasm_lib_scheduler_proto_v1_message_proto = out.File
869 > file_temporal_server_chasm_lib_scheduler_proto_v1_message_proto_goTypes = nil
870 > file_temporal_server_chasm_lib_scheduler_proto_v1_message_proto_depIdxs = nil
871 }
go.temporal.io/server/chasm/lib/activity/gen/activitypb/v1/activity_state.pb.go 25 covered LOC · 2 ranges

Open complete file

1382 }
1383
1384 > func init() { file_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto_init() } activity_state.pb.go
1385 > func file_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto_init() {
1386 > if File_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto != nil {
1387 return
1388 }
1389 > file_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto_msgTypes[7].OneofWrappers = []any{ activity_state.pb.go
1390 > (*ActivityOutcome_Successful_)(nil),
1391 > (*ActivityOutcome_Failed_)(nil),
1392 > }
1393 > type x struct{}
1394 > out := protoimpl.TypeBuilder{
1395 > File: protoimpl.DescBuilder{
1396 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1397 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto_rawDesc), len(file_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto_rawDesc)),
1398 > NumEnums: 2,
1399 > NumMessages: 11,
1400 > NumExtensions: 0,
1401 > NumServices: 0,
1402 > },
1403 > GoTypes: file_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto_goTypes,
1404 > DependencyIndexes: file_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto_depIdxs,
1405 > EnumInfos: file_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto_enumTypes,
1406 > MessageInfos: file_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto_msgTypes,
1407 > }.Build()
1408 > File_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto = out.File
1409 > file_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto_goTypes = nil
1410 > file_temporal_server_chasm_lib_activity_proto_v1_activity_state_proto_depIdxs = nil
1411 }
go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1/operation.pb.go 25 covered LOC · 2 ranges

Open complete file

998 }
999
1000 > func init() { file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_init() } operation.pb.go
1001 > func file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_init() {
1002 > if File_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto != nil {
1003 return
1004 }
1005 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_msgTypes[2].OneofWrappers = []any{ operation.pb.go
1006 > (*OperationOutcome_Successful_)(nil),
1007 > (*OperationOutcome_Failed_)(nil),
1008 > }
1009 > type x struct{}
1010 > out := protoimpl.TypeBuilder{
1011 > File: protoimpl.DescBuilder{
1012 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1013 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_rawDesc), len(file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_rawDesc)),
1014 > NumEnums: 2,
1015 > NumMessages: 8,
1016 > NumExtensions: 0,
1017 > NumServices: 0,
1018 > },
1019 > GoTypes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_goTypes,
1020 > DependencyIndexes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_depIdxs,
1021 > EnumInfos: file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_enumTypes,
1022 > MessageInfos: file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_msgTypes,
1023 > }.Build()
1024 > File_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto = out.File
1025 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_goTypes = nil
1026 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_operation_proto_depIdxs = nil
1027 }
go.temporal.io/server/common/primitives/uuid.go 25 covered LOC · 8 ranges

Open complete file

55 // - error if input is malformed
56 // - input if input can be parsed and is valid
57 > func ValidateUUID(s string) (string, error) { uuid.go
58 > if s == "" {
59 return "", nil
60 }
61 > _, err := guuid.Parse(s) uuid.go
62 > if err != nil {
63 return "", err
64 }
65
66 > return s, nil uuid.go
67 }
68
69 // NewUUID generates a new random UUID
70 > func NewUUID() UUID { uuid.go
71 > u, err := guuid.NewV7()
72 > if err != nil {
73 // Should never happen, but this matches the behavior of google/uuid.NewRandom
74 return nil
75 }
76 > return u[:] uuid.go
77 }
78
91 // String returns the 36 byte hexstring representation of this uuid
92 // return empty string if this uuid is nil
93 > func (u UUID) String() string { uuid.go
94 > if len(u) != 16 {
95 return ""
96 }
97 > var buf [36]byte uuid.go
98 > u.encodeHex(buf[:])
99 > return string(buf[:])
100 }
101
140 }
141
142 > func (u UUID) encodeHex(dst []byte) { uuid.go
143 > hex.Encode(dst, u[:4])
144 > dst[8] = '-'
145 > hex.Encode(dst[9:13], u[4:6])
146 > dst[13] = '-'
147 > hex.Encode(dst[14:18], u[6:8])
148 > dst[18] = '-'
149 > hex.Encode(dst[19:23], u[8:10])
150 > dst[23] = '-'
151 > hex.Encode(dst[24:], u[10:])
152 > }
go.temporal.io/server/common/routing/route.go 25 covered LOC · 8 ranges

Open complete file

36
37 // NewRoute returns a new [Route] instance with the given components.
38 > func NewRoute[T any](components ...Component[T]) Route[T] { route.go
39 > return Route[T]{components: components}
40 > }
41
42 // RouteBuilder is a builder for the [Route] interface.
46
47 // NewBuilder creates a new [RouteBuilder] instance, which can be used to define a new [Route] via a fluent API.
48 > func NewBuilder[T any]() *RouteBuilder[T] { route.go
49 > return &RouteBuilder[T]{}
50 > }
51
52 // With adds a series of [Component] instances to the [Route].
53 > func (r *RouteBuilder[T]) With(c ...Component[T]) *RouteBuilder[T] { route.go
54 > r.components = append(r.components, c...)
55 > return r
56 > }
57
58 // Constant adds a [Constant] component to the [Route].
59 > func (r *RouteBuilder[T]) Constant(values ...string) *RouteBuilder[T] { route.go
60 > return r.With(Constant[T](values...))
61 > }
62
63 // StringVariable adds a [StringVariable] component to the [Route].
64 > func (r *RouteBuilder[T]) StringVariable(name string, getter func(*T) *string) *RouteBuilder[T] { route.go
65 > return r.With(StringVariable[T](name, getter))
66 > }
67
68 // Build returns a read-only [Route].
69 > func (r *RouteBuilder[T]) Build() Route[T] { route.go
70 > return NewRoute[T](r.components...)
71 > }
72
73 // Representation returns the [github.com/gorilla/mux] compatible string representation of the route for usage in a
111 // Constant returns a [Component] that represents a series of constant HTTP path components in a Route.
112 // They will be joined via strings when used to construct a path or path representation.
113 > func Constant[T any](values ...string) constant[T] { route.go
114 > return values
115 > }
116
117 type constant[T any] []string
128
129 // StringVariable returns a [Component] that represents a string variable in a Route.
130 > func StringVariable[T any](name string, getter func(*T) *string) stringVariable[T] { route.go
131 > return stringVariable[T]{name, getter}
132 > }
133
134 type stringVariable[T any] struct {
go.temporal.io/server/temporal/environment/env.go 25 covered LOC · 7 ranges

Open complete file

39 )
40
41 > func lookupLocalhostIP(domain string) string { env.go
42 > // lookup localhost and favor the first ipv4 address
43 > // unless there are only ipv6 addresses available
44 > ips, err := net.LookupIP(domain)
45 > if err != nil || len(ips) == 0 {
46 // fallback to default instead of error
47 return localhostIPDefault
48 }
49 > for _, ip := range ips { env.go
50 > if ip4 := ip.To4(); ip4 != nil {
51 > return ip4.String() env.go
52 > }
53 }
54 return ips[len(ips)-1].String()
56
57 // GetLocalhostIP returns the ip address of the localhost domain
58 > func GetLocalhostIP() string { env.go
59 > localhostIP := os.Getenv(localhostIPEnv)
60 > ip := net.ParseIP(localhostIP)
61 > if ip != nil {
62 // if localhost is an ip return it
63 return ip.String()
64 }
65 // otherwise, ignore the value and lookup `localhost`
66 > return lookupLocalhostIP("localhost") env.go
67 }
68
69 // GetCassandraAddress return the cassandra address
70 > func GetCassandraAddress() string { env.go
71 > addr := os.Getenv(cassandraSeedsEnv)
72 > if addr == "" {
73 > addr = GetLocalhostIP()
74 > }
75 > return addr
76 }
77
78 // GetCassandraPort return the cassandra port
79 > func GetCassandraPort() int { env.go
80 > port := os.Getenv(cassandraPortEnv)
81 > if port == "" {
82 > return cassandraDefaultPort
83 > }
84 p, err := strconv.Atoi(port)
85 if err != nil {
go.temporal.io/server/api/persistence/v1/nexus.pb.go 24 covered LOC · 2 ranges

Open complete file

481 }
482
483 > func init() { file_temporal_server_api_persistence_v1_nexus_proto_init() } nexus.pb.go
484 > func file_temporal_server_api_persistence_v1_nexus_proto_init() {
485 > if File_temporal_server_api_persistence_v1_nexus_proto != nil {
486 return
487 }
488 > file_temporal_server_api_persistence_v1_nexus_proto_msgTypes[1].OneofWrappers = []any{ nexus.pb.go
489 > (*NexusEndpointTarget_Worker_)(nil),
490 > (*NexusEndpointTarget_External_)(nil),
491 > }
492 > type x struct{}
493 > out := protoimpl.TypeBuilder{
494 > File: protoimpl.DescBuilder{
495 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
496 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_nexus_proto_rawDesc), len(file_temporal_server_api_persistence_v1_nexus_proto_rawDesc)),
497 > NumEnums: 0,
498 > NumMessages: 6,
499 > NumExtensions: 0,
500 > NumServices: 0,
501 > },
502 > GoTypes: file_temporal_server_api_persistence_v1_nexus_proto_goTypes,
503 > DependencyIndexes: file_temporal_server_api_persistence_v1_nexus_proto_depIdxs,
504 > MessageInfos: file_temporal_server_api_persistence_v1_nexus_proto_msgTypes,
505 > }.Build()
506 > File_temporal_server_api_persistence_v1_nexus_proto = out.File
507 > file_temporal_server_api_persistence_v1_nexus_proto_goTypes = nil
508 > file_temporal_server_api_persistence_v1_nexus_proto_depIdxs = nil
509 }
go.temporal.io/server/api/schedule/v1/message.pb.go 24 covered LOC · 2 ranges

Open complete file

1224 }
1225
1226 > func init() { file_temporal_server_api_schedule_v1_message_proto_init() } message.pb.go
1227 > func file_temporal_server_api_schedule_v1_message_proto_init() {
1228 > if File_temporal_server_api_schedule_v1_message_proto != nil {
1229 return
1230 }
1231 > file_temporal_server_api_schedule_v1_message_proto_msgTypes[7].OneofWrappers = []any{ message.pb.go
1232 > (*WatchWorkflowResponse_Result)(nil),
1233 > (*WatchWorkflowResponse_Failure)(nil),
1234 > }
1235 > type x struct{}
1236 > out := protoimpl.TypeBuilder{
1237 > File: protoimpl.DescBuilder{
1238 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1239 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_schedule_v1_message_proto_rawDesc), len(file_temporal_server_api_schedule_v1_message_proto_rawDesc)),
1240 > NumEnums: 0,
1241 > NumMessages: 13,
1242 > NumExtensions: 0,
1243 > NumServices: 0,
1244 > },
1245 > GoTypes: file_temporal_server_api_schedule_v1_message_proto_goTypes,
1246 > DependencyIndexes: file_temporal_server_api_schedule_v1_message_proto_depIdxs,
1247 > MessageInfos: file_temporal_server_api_schedule_v1_message_proto_msgTypes,
1248 > }.Build()
1249 > File_temporal_server_api_schedule_v1_message_proto = out.File
1250 > file_temporal_server_api_schedule_v1_message_proto_goTypes = nil
1251 > file_temporal_server_api_schedule_v1_message_proto_depIdxs = nil
1252 }
go.temporal.io/server/chasm/lib/callback/gen/callbackpb/v1/message.pb.go 24 covered LOC · 2 ranges

Open complete file

462 }
463
464 > func init() { file_temporal_server_chasm_lib_callback_proto_v1_message_proto_init() } message.pb.go
465 > func file_temporal_server_chasm_lib_callback_proto_v1_message_proto_init() {
466 > if File_temporal_server_chasm_lib_callback_proto_v1_message_proto != nil {
467 return
468 }
469 > file_temporal_server_chasm_lib_callback_proto_v1_message_proto_msgTypes[1].OneofWrappers = []any{ message.pb.go
470 > (*Callback_Nexus_)(nil),
471 > }
472 > type x struct{}
473 > out := protoimpl.TypeBuilder{
474 > File: protoimpl.DescBuilder{
475 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
476 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_callback_proto_v1_message_proto_rawDesc), len(file_temporal_server_chasm_lib_callback_proto_v1_message_proto_rawDesc)),
477 > NumEnums: 1,
478 > NumMessages: 5,
479 > NumExtensions: 0,
480 > NumServices: 0,
481 > },
482 > GoTypes: file_temporal_server_chasm_lib_callback_proto_v1_message_proto_goTypes,
483 > DependencyIndexes: file_temporal_server_chasm_lib_callback_proto_v1_message_proto_depIdxs,
484 > EnumInfos: file_temporal_server_chasm_lib_callback_proto_v1_message_proto_enumTypes,
485 > MessageInfos: file_temporal_server_chasm_lib_callback_proto_v1_message_proto_msgTypes,
486 > }.Build()
487 > File_temporal_server_chasm_lib_callback_proto_v1_message_proto = out.File
488 > file_temporal_server_chasm_lib_callback_proto_v1_message_proto_goTypes = nil
489 > file_temporal_server_chasm_lib_callback_proto_v1_message_proto_depIdxs = nil
490 }
go.temporal.io/server/common/persistence/workflow_state_status_validator.go 24 covered LOC · 14 ranges

Open complete file

32 state enumsspb.WorkflowExecutionState,
33 status enumspb.WorkflowExecutionStatus,
35 >
36 > if err := validateWorkflowState(state); err != nil {
37 return err
38 }
39 > if err := validateWorkflowStatus(status); err != nil { workflow_state_status_validator.go
40 return err
41 }
42
43 // validate workflow state & status
44 > if state == enumsspb.WORKFLOW_EXECUTION_STATE_COMPLETED { workflow_state_status_validator.go
45 if status == enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING || status == enumspb.WORKFLOW_EXECUTION_STATUS_PAUSED {
46 return serviceerror.NewInternalf("Create workflow with invalid state: %v or status: %v", state, status)
47 }
49 > if status != enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING {
50 return serviceerror.NewInternalf("Create workflow with invalid state: %v or status: %v", state, status)
51 }
52 }
54 }
55
58 state enumsspb.WorkflowExecutionState,
59 status enumspb.WorkflowExecutionStatus,
61 >
62 > if err := validateWorkflowState(state); err != nil {
63 return err
64 }
65 > if err := validateWorkflowStatus(status); err != nil { workflow_state_status_validator.go
66 return err
67 }
68
69 // validate workflow state & status
71 case enumsspb.WORKFLOW_EXECUTION_STATE_RUNNING, enumsspb.WORKFLOW_EXECUTION_STATE_ZOMBIE:
72 if status != enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING && status != enumspb.WORKFLOW_EXECUTION_STATUS_PAUSED {
77 return serviceerror.NewInternalf("Update workflow with invalid state: %v or status: %v", state, status)
78 }
80 > if status == enumspb.WORKFLOW_EXECUTION_STATUS_RUNNING || status == enumspb.WORKFLOW_EXECUTION_STATUS_PAUSED {
81 return serviceerror.NewInternalf("Update workflow with invalid state: %v or status: %v", state, status)
82 }
83 }
85 }
86
go.temporal.io/server/api/enums/v1/nexus.pb.go 23 covered LOC · 3 ranges

Open complete file

102 }
103
104 > func (NexusOperationState) Descriptor() protoreflect.EnumDescriptor { nexus.pb.go
105 > return file_temporal_server_api_enums_v1_nexus_proto_enumTypes[0].Descriptor()
106 > }
107
108 func (NexusOperationState) Type() protoreflect.EnumType {
158 }
159
160 > func init() { file_temporal_server_api_enums_v1_nexus_proto_init() } nexus.pb.go
161 > func file_temporal_server_api_enums_v1_nexus_proto_init() {
162 > if File_temporal_server_api_enums_v1_nexus_proto != nil {
163 return
164 }
165 > type x struct{} nexus.pb.go
166 > out := protoimpl.TypeBuilder{
167 > File: protoimpl.DescBuilder{
168 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
169 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_nexus_proto_rawDesc), len(file_temporal_server_api_enums_v1_nexus_proto_rawDesc)),
170 > NumEnums: 1,
171 > NumMessages: 0,
172 > NumExtensions: 0,
173 > NumServices: 0,
174 > },
175 > GoTypes: file_temporal_server_api_enums_v1_nexus_proto_goTypes,
176 > DependencyIndexes: file_temporal_server_api_enums_v1_nexus_proto_depIdxs,
177 > EnumInfos: file_temporal_server_api_enums_v1_nexus_proto_enumTypes,
178 > }.Build()
179 > File_temporal_server_api_enums_v1_nexus_proto = out.File
180 > file_temporal_server_api_enums_v1_nexus_proto_goTypes = nil
181 > file_temporal_server_api_enums_v1_nexus_proto_depIdxs = nil
182 }
go.temporal.io/server/api/enums/v1/predicate.pb.go 23 covered LOC · 3 ranges

Open complete file

111 }
112
113 > func (PredicateType) Descriptor() protoreflect.EnumDescriptor { predicate.pb.go
114 > return file_temporal_server_api_enums_v1_predicate_proto_enumTypes[0].Descriptor()
115 > }
116
117 func (PredicateType) Type() protoreflect.EnumType {
170 }
171
172 > func init() { file_temporal_server_api_enums_v1_predicate_proto_init() } predicate.pb.go
173 > func file_temporal_server_api_enums_v1_predicate_proto_init() {
174 > if File_temporal_server_api_enums_v1_predicate_proto != nil {
175 return
176 }
177 > type x struct{} predicate.pb.go
178 > out := protoimpl.TypeBuilder{
179 > File: protoimpl.DescBuilder{
180 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
181 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_predicate_proto_rawDesc), len(file_temporal_server_api_enums_v1_predicate_proto_rawDesc)),
182 > NumEnums: 1,
183 > NumMessages: 0,
184 > NumExtensions: 0,
185 > NumServices: 0,
186 > },
187 > GoTypes: file_temporal_server_api_enums_v1_predicate_proto_goTypes,
188 > DependencyIndexes: file_temporal_server_api_enums_v1_predicate_proto_depIdxs,
189 > EnumInfos: file_temporal_server_api_enums_v1_predicate_proto_enumTypes,
190 > }.Build()
191 > File_temporal_server_api_enums_v1_predicate_proto = out.File
192 > file_temporal_server_api_enums_v1_predicate_proto_goTypes = nil
193 > file_temporal_server_api_enums_v1_predicate_proto_depIdxs = nil
194 }
go.temporal.io/server/api/enums/v1/workflow_task_type.pb.go 23 covered LOC · 3 ranges

Open complete file

72 }
73
74 > func (WorkflowTaskType) Descriptor() protoreflect.EnumDescriptor { workflow_task_type.pb.go
75 > return file_temporal_server_api_enums_v1_workflow_task_type_proto_enumTypes[0].Descriptor()
76 > }
77
78 func (WorkflowTaskType) Type() protoreflect.EnumType {
124 }
125
126 > func init() { file_temporal_server_api_enums_v1_workflow_task_type_proto_init() } workflow_task_type.pb.go
127 > func file_temporal_server_api_enums_v1_workflow_task_type_proto_init() {
128 > if File_temporal_server_api_enums_v1_workflow_task_type_proto != nil {
129 return
130 }
131 > type x struct{} workflow_task_type.pb.go
132 > out := protoimpl.TypeBuilder{
133 > File: protoimpl.DescBuilder{
134 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
135 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_workflow_task_type_proto_rawDesc), len(file_temporal_server_api_enums_v1_workflow_task_type_proto_rawDesc)),
136 > NumEnums: 1,
137 > NumMessages: 0,
138 > NumExtensions: 0,
139 > NumServices: 0,
140 > },
141 > GoTypes: file_temporal_server_api_enums_v1_workflow_task_type_proto_goTypes,
142 > DependencyIndexes: file_temporal_server_api_enums_v1_workflow_task_type_proto_depIdxs,
143 > EnumInfos: file_temporal_server_api_enums_v1_workflow_task_type_proto_enumTypes,
144 > }.Build()
145 > File_temporal_server_api_enums_v1_workflow_task_type_proto = out.File
146 > file_temporal_server_api_enums_v1_workflow_task_type_proto_goTypes = nil
147 > file_temporal_server_api_enums_v1_workflow_task_type_proto_depIdxs = nil
148 }
go.temporal.io/server/chasm/lib/scheduler/gen/schedulerpb/v1/request_response.pb.go 23 covered LOC · 1 range

Open complete file

1021 }
1022
1023 > func init() { file_temporal_server_chasm_lib_scheduler_proto_v1_request_response_proto_init() } request_response.pb.go
1024 > func file_temporal_server_chasm_lib_scheduler_proto_v1_request_response_proto_init() {
1025 > if File_temporal_server_chasm_lib_scheduler_proto_v1_request_response_proto != nil {
1026 > return
1027 > }
1028 > file_temporal_server_chasm_lib_scheduler_proto_v1_message_proto_init()
1029 > type x struct{}
1030 > out := protoimpl.TypeBuilder{
1031 > File: protoimpl.DescBuilder{
1032 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1033 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_scheduler_proto_v1_request_response_proto_rawDesc), len(file_temporal_server_chasm_lib_scheduler_proto_v1_request_response_proto_rawDesc)),
1034 > NumEnums: 0,
1035 > NumMessages: 18,
1036 > NumExtensions: 0,
1037 > NumServices: 0,
1038 > },
1039 > GoTypes: file_temporal_server_chasm_lib_scheduler_proto_v1_request_response_proto_goTypes,
1040 > DependencyIndexes: file_temporal_server_chasm_lib_scheduler_proto_v1_request_response_proto_depIdxs,
1041 > MessageInfos: file_temporal_server_chasm_lib_scheduler_proto_v1_request_response_proto_msgTypes,
1042 > }.Build()
1043 > File_temporal_server_chasm_lib_scheduler_proto_v1_request_response_proto = out.File
1044 > file_temporal_server_chasm_lib_scheduler_proto_v1_request_response_proto_goTypes = nil
1045 > file_temporal_server_chasm_lib_scheduler_proto_v1_request_response_proto_depIdxs = nil
1046 }
go.temporal.io/server/common/namespace/namespace.go 23 covered LOC · 6 ranges

Open complete file

81 resolver ReplicationResolver,
82 mutations ...Mutation,
83 > ) (*Namespace, error) { namespace.go
84 > if resolver == nil {
85 return nil, serviceerror.NewInvalidArgument("replicationResolver must be provided")
86 }
87 > ns := &Namespace{ namespace.go
88 > info: detail.Info,
89 > config: detail.Config,
90 > configVersion: detail.ConfigVersion,
91 > customSearchAttributesMapper: CustomSearchAttributesMapper{
92 > fieldToAlias: detail.Config.CustomSearchAttributeAliases,
93 > aliasToField: util.InverseMap(detail.Config.CustomSearchAttributeAliases),
94 > },
95 > replicationResolver: resolver,
96 > }
97 >
98 > for _, m := range mutations {
99 > m.apply(ns) namespace.go
100 > }
101
102 > return ns, nil namespace.go
103 }
104
337 }
338
339 > func (id ID) String() string { namespace.go
340 > return string(id)
341 > }
342
343 func (id ID) IsEmpty() bool {
345 }
346
347 > func (n Name) String() string { namespace.go
348 > return string(n)
349 > }
350
351 func (n Name) IsEmpty() bool {
go.temporal.io/server/api/common/v1/api_category.pb.go 22 covered LOC · 2 ranges

Open complete file

204 }
205
206 > func init() { file_temporal_server_api_common_v1_api_category_proto_init() } api_category.pb.go
207 > func file_temporal_server_api_common_v1_api_category_proto_init() {
208 > if File_temporal_server_api_common_v1_api_category_proto != nil {
209 return
210 }
211 > type x struct{} api_category.pb.go
212 > out := protoimpl.TypeBuilder{
213 > File: protoimpl.DescBuilder{
214 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
215 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_common_v1_api_category_proto_rawDesc), len(file_temporal_server_api_common_v1_api_category_proto_rawDesc)),
216 > NumEnums: 1,
217 > NumMessages: 1,
218 > NumExtensions: 1,
219 > NumServices: 0,
220 > },
221 > GoTypes: file_temporal_server_api_common_v1_api_category_proto_goTypes,
222 > DependencyIndexes: file_temporal_server_api_common_v1_api_category_proto_depIdxs,
223 > EnumInfos: file_temporal_server_api_common_v1_api_category_proto_enumTypes,
224 > MessageInfos: file_temporal_server_api_common_v1_api_category_proto_msgTypes,
225 > ExtensionInfos: file_temporal_server_api_common_v1_api_category_proto_extTypes,
226 > }.Build()
227 > File_temporal_server_api_common_v1_api_category_proto = out.File
228 > file_temporal_server_api_common_v1_api_category_proto_goTypes = nil
229 > file_temporal_server_api_common_v1_api_category_proto_depIdxs = nil
230 }
go.temporal.io/server/chasm/lib/activity/gen/activitypb/v1/request_response.pb.go 22 covered LOC · 1 range

Open complete file

1057 }
1058
1059 > func init() { file_temporal_server_chasm_lib_activity_proto_v1_request_response_proto_init() } request_response.pb.go
1060 > func file_temporal_server_chasm_lib_activity_proto_v1_request_response_proto_init() {
1061 > if File_temporal_server_chasm_lib_activity_proto_v1_request_response_proto != nil {
1062 > return
1063 > }
1064 > type x struct{}
1065 > out := protoimpl.TypeBuilder{
1066 > File: protoimpl.DescBuilder{
1067 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
1068 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_activity_proto_v1_request_response_proto_rawDesc), len(file_temporal_server_chasm_lib_activity_proto_v1_request_response_proto_rawDesc)),
1069 > NumEnums: 0,
1070 > NumMessages: 20,
1071 > NumExtensions: 0,
1072 > NumServices: 0,
1073 > },
1074 > GoTypes: file_temporal_server_chasm_lib_activity_proto_v1_request_response_proto_goTypes,
1075 > DependencyIndexes: file_temporal_server_chasm_lib_activity_proto_v1_request_response_proto_depIdxs,
1076 > MessageInfos: file_temporal_server_chasm_lib_activity_proto_v1_request_response_proto_msgTypes,
1077 > }.Build()
1078 > File_temporal_server_chasm_lib_activity_proto_v1_request_response_proto = out.File
1079 > file_temporal_server_chasm_lib_activity_proto_v1_request_response_proto_goTypes = nil
1080 > file_temporal_server_chasm_lib_activity_proto_v1_request_response_proto_depIdxs = nil
1081 }
go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1/request_response.pb.go 22 covered LOC · 1 range

Open complete file

672 }
673
674 > func init() { file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_init() } request_response.pb.go
675 > func file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_init() {
676 > if File_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto != nil {
677 > return
678 > }
679 > type x struct{}
680 > out := protoimpl.TypeBuilder{
681 > File: protoimpl.DescBuilder{
682 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
683 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_rawDesc), len(file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_rawDesc)),
684 > NumEnums: 0,
685 > NumMessages: 12,
686 > NumExtensions: 0,
687 > NumServices: 0,
688 > },
689 > GoTypes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_goTypes,
690 > DependencyIndexes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_depIdxs,
691 > MessageInfos: file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_msgTypes,
692 > }.Build()
693 > File_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto = out.File
694 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_goTypes = nil
695 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_depIdxs = nil
696 }
go.temporal.io/server/chasm/lib/tests/gen/testspb/v1/request_response.pb.go 22 covered LOC · 1 range

Open complete file

157 }
158
159 > func init() { file_temporal_server_chasm_lib_tests_proto_v1_request_response_proto_init() } request_response.pb.go
160 > func file_temporal_server_chasm_lib_tests_proto_v1_request_response_proto_init() {
161 > if File_temporal_server_chasm_lib_tests_proto_v1_request_response_proto != nil {
162 > return
163 > }
164 > type x struct{}
165 > out := protoimpl.TypeBuilder{
166 > File: protoimpl.DescBuilder{
167 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
168 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_tests_proto_v1_request_response_proto_rawDesc), len(file_temporal_server_chasm_lib_tests_proto_v1_request_response_proto_rawDesc)),
169 > NumEnums: 0,
170 > NumMessages: 2,
171 > NumExtensions: 0,
172 > NumServices: 0,
173 > },
174 > GoTypes: file_temporal_server_chasm_lib_tests_proto_v1_request_response_proto_goTypes,
175 > DependencyIndexes: file_temporal_server_chasm_lib_tests_proto_v1_request_response_proto_depIdxs,
176 > MessageInfos: file_temporal_server_chasm_lib_tests_proto_v1_request_response_proto_msgTypes,
177 > }.Build()
178 > File_temporal_server_chasm_lib_tests_proto_v1_request_response_proto = out.File
179 > file_temporal_server_chasm_lib_tests_proto_v1_request_response_proto_goTypes = nil
180 > file_temporal_server_chasm_lib_tests_proto_v1_request_response_proto_depIdxs = nil
181 }
go.temporal.io/server/api/persistence/v1/task_queues.pb.go 21 covered LOC · 2 ranges

Open complete file

899 }
900
901 > func init() { file_temporal_server_api_persistence_v1_task_queues_proto_init() } task_queues.pb.go
902 > func file_temporal_server_api_persistence_v1_task_queues_proto_init() {
903 > if File_temporal_server_api_persistence_v1_task_queues_proto != nil {
904 return
905 }
906 > type x struct{} task_queues.pb.go
907 > out := protoimpl.TypeBuilder{
908 > File: protoimpl.DescBuilder{
909 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
910 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_task_queues_proto_rawDesc), len(file_temporal_server_api_persistence_v1_task_queues_proto_rawDesc)),
911 > NumEnums: 1,
912 > NumMessages: 13,
913 > NumExtensions: 0,
914 > NumServices: 0,
915 > },
916 > GoTypes: file_temporal_server_api_persistence_v1_task_queues_proto_goTypes,
917 > DependencyIndexes: file_temporal_server_api_persistence_v1_task_queues_proto_depIdxs,
918 > EnumInfos: file_temporal_server_api_persistence_v1_task_queues_proto_enumTypes,
919 > MessageInfos: file_temporal_server_api_persistence_v1_task_queues_proto_msgTypes,
920 > }.Build()
921 > File_temporal_server_api_persistence_v1_task_queues_proto = out.File
922 > file_temporal_server_api_persistence_v1_task_queues_proto_goTypes = nil
923 > file_temporal_server_api_persistence_v1_task_queues_proto_depIdxs = nil
924 }
go.temporal.io/server/api/routing/v1/extension.pb.go 21 covered LOC · 2 ranges

Open complete file

144 }
145
146 > func init() { file_temporal_server_api_routing_v1_extension_proto_init() } extension.pb.go
147 > func file_temporal_server_api_routing_v1_extension_proto_init() {
148 > if File_temporal_server_api_routing_v1_extension_proto != nil {
149 return
150 }
151 > type x struct{} extension.pb.go
152 > out := protoimpl.TypeBuilder{
153 > File: protoimpl.DescBuilder{
154 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
155 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_routing_v1_extension_proto_rawDesc), len(file_temporal_server_api_routing_v1_extension_proto_rawDesc)),
156 > NumEnums: 0,
157 > NumMessages: 1,
158 > NumExtensions: 1,
159 > NumServices: 0,
160 > },
161 > GoTypes: file_temporal_server_api_routing_v1_extension_proto_goTypes,
162 > DependencyIndexes: file_temporal_server_api_routing_v1_extension_proto_depIdxs,
163 > MessageInfos: file_temporal_server_api_routing_v1_extension_proto_msgTypes,
164 > ExtensionInfos: file_temporal_server_api_routing_v1_extension_proto_extTypes,
165 > }.Build()
166 > File_temporal_server_api_routing_v1_extension_proto = out.File
167 > file_temporal_server_api_routing_v1_extension_proto_goTypes = nil
168 > file_temporal_server_api_routing_v1_extension_proto_depIdxs = nil
169 }
go.temporal.io/server/chasm/lib/activity/gen/activitypb/v1/tasks.pb.go 21 covered LOC · 2 ranges

Open complete file

495 }
496
497 > func init() { file_temporal_server_chasm_lib_activity_proto_v1_tasks_proto_init() } tasks.pb.go
498 > func file_temporal_server_chasm_lib_activity_proto_v1_tasks_proto_init() {
499 > if File_temporal_server_chasm_lib_activity_proto_v1_tasks_proto != nil {
500 return
501 }
502 > type x struct{} tasks.pb.go
503 > out := protoimpl.TypeBuilder{
504 > File: protoimpl.DescBuilder{
505 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
506 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_activity_proto_v1_tasks_proto_rawDesc), len(file_temporal_server_chasm_lib_activity_proto_v1_tasks_proto_rawDesc)),
507 > NumEnums: 2,
508 > NumMessages: 5,
509 > NumExtensions: 0,
510 > NumServices: 0,
511 > },
512 > GoTypes: file_temporal_server_chasm_lib_activity_proto_v1_tasks_proto_goTypes,
513 > DependencyIndexes: file_temporal_server_chasm_lib_activity_proto_v1_tasks_proto_depIdxs,
514 > EnumInfos: file_temporal_server_chasm_lib_activity_proto_v1_tasks_proto_enumTypes,
515 > MessageInfos: file_temporal_server_chasm_lib_activity_proto_v1_tasks_proto_msgTypes,
516 > }.Build()
517 > File_temporal_server_chasm_lib_activity_proto_v1_tasks_proto = out.File
518 > file_temporal_server_chasm_lib_activity_proto_v1_tasks_proto_goTypes = nil
519 > file_temporal_server_chasm_lib_activity_proto_v1_tasks_proto_depIdxs = nil
520 }
go.temporal.io/server/common/persistence/cassandra/execution_store.go 21 covered LOC · 11 ranges

Open complete file

87 var _ p.ExecutionStore = (*ExecutionStore)(nil)
88
89 > func NewExecutionStore(session gocql.Session, serializer serialization.Serializer, logger log.Logger) *ExecutionStore { execution_store.go
90 > return &ExecutionStore{
91 > HistoryStore: NewHistoryStore(session, serializer),
92 > MutableStateStore: NewMutableStateStore(session, serializer, logger),
93 > MutableStateTaskStore: NewMutableStateTaskStore(session, serializer),
94 > }
95 > }
96
97 func (d *ExecutionStore) CreateWorkflowExecution(
98 ctx context.Context,
99 request *p.InternalCreateWorkflowExecutionRequest,
100 > ) (*p.InternalCreateWorkflowExecutionResponse, error) { execution_store.go
101 > for _, req := range request.NewWorkflowNewEvents {
102 > if err := d.AppendHistoryNodes(ctx, req); err != nil { execution_store.go
103 return nil, err
104 }
105 }
106
107 > return d.MutableStateStore.CreateWorkflowExecution(ctx, request) execution_store.go
108 }
109
129 ctx context.Context,
130 request *p.InternalConflictResolveWorkflowExecutionRequest,
131 > ) error { execution_store.go
132 > for _, req := range request.CurrentWorkflowEventsNewEvents {
133 if err := d.AppendHistoryNodes(ctx, req); err != nil {
134 return err
135 }
136 }
137 > for _, req := range request.ResetWorkflowEventsNewEvents { execution_store.go
138 > if err := d.AppendHistoryNodes(ctx, req); err != nil { execution_store.go
139 return err
140 }
141 }
142 > for _, req := range request.NewWorkflowEventsNewEvents { execution_store.go
143 > if err := d.AppendHistoryNodes(ctx, req); err != nil { execution_store.go
144 return err
145 }
146 }
147
148 > return d.MutableStateStore.ConflictResolveWorkflowExecution(ctx, request) execution_store.go
149 }
150
151 > func (d *ExecutionStore) GetName() string { execution_store.go
152 > return cassandraPersistenceName
153 > }
154
155 func (d *ExecutionStore) Close() {
go.temporal.io/server/common/persistence/history_branch_util.go 21 covered LOC · 7 ranges

Open complete file

41 )
42
43 > func NewHistoryBranchUtil(serializer serialization.Serializer) *HistoryBranchUtilImpl { history_branch_util.go
44 > return &HistoryBranchUtilImpl{
45 > serializer: serializer,
46 > }
47 > }
48
49 func (u *HistoryBranchUtilImpl) NewHistoryBranch(
57 _ time.Duration, // executionTimeout
58 _ time.Duration, // retentionDuration
59 > ) ([]byte, error) { history_branch_util.go
60 > var id string
61 > if branchID == nil {
62 > id = primitives.NewUUID().String() history_branch_util.go
63 > } else { history_branch_util.go
64 id = *branchID
65 }
66 > bi := &persistencespb.HistoryBranch{ history_branch_util.go
67 > TreeId: treeID,
68 > BranchId: id,
69 > Ancestors: ancestors,
70 > }
71 > data, err := u.serializer.HistoryBranchToBlob(bi)
72 > if err != nil {
73 return nil, err
74 }
75 > return data.Data, nil history_branch_util.go
76 }
77
78 func (u *HistoryBranchUtilImpl) ParseHistoryBranchInfo(
79 branchToken []byte,
80 > ) (*persistencespb.HistoryBranch, error) { history_branch_util.go
81 > return u.serializer.HistoryBranchFromBlob(branchToken)
82 > }
83
84 func (u *HistoryBranchUtilImpl) UpdateHistoryBranchInfo(
go.temporal.io/server/api/adminservice/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

273 }
274
275 > func init() { file_temporal_server_api_adminservice_v1_service_proto_init() } service.pb.go
276 > func file_temporal_server_api_adminservice_v1_service_proto_init() {
277 > if File_temporal_server_api_adminservice_v1_service_proto != nil {
278 return
279 }
280 > file_temporal_server_api_adminservice_v1_request_response_proto_init() service.pb.go
281 > type x struct{}
282 > out := protoimpl.TypeBuilder{
283 > File: protoimpl.DescBuilder{
284 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
285 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_adminservice_v1_service_proto_rawDesc), len(file_temporal_server_api_adminservice_v1_service_proto_rawDesc)),
286 > NumEnums: 0,
287 > NumMessages: 0,
288 > NumExtensions: 0,
289 > NumServices: 1,
290 > },
291 > GoTypes: file_temporal_server_api_adminservice_v1_service_proto_goTypes,
292 > DependencyIndexes: file_temporal_server_api_adminservice_v1_service_proto_depIdxs,
293 > }.Build()
294 > File_temporal_server_api_adminservice_v1_service_proto = out.File
295 > file_temporal_server_api_adminservice_v1_service_proto_goTypes = nil
296 > file_temporal_server_api_adminservice_v1_service_proto_depIdxs = nil
297 }
go.temporal.io/server/api/archiver/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

431 }
432
433 > func init() { file_temporal_server_api_archiver_v1_message_proto_init() } message.pb.go
434 > func file_temporal_server_api_archiver_v1_message_proto_init() {
435 > if File_temporal_server_api_archiver_v1_message_proto != nil {
436 return
437 }
438 > type x struct{} message.pb.go
439 > out := protoimpl.TypeBuilder{
440 > File: protoimpl.DescBuilder{
441 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
442 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_archiver_v1_message_proto_rawDesc), len(file_temporal_server_api_archiver_v1_message_proto_rawDesc)),
443 > NumEnums: 0,
444 > NumMessages: 4,
445 > NumExtensions: 0,
446 > NumServices: 0,
447 > },
448 > GoTypes: file_temporal_server_api_archiver_v1_message_proto_goTypes,
449 > DependencyIndexes: file_temporal_server_api_archiver_v1_message_proto_depIdxs,
450 > MessageInfos: file_temporal_server_api_archiver_v1_message_proto_msgTypes,
451 > }.Build()
452 > File_temporal_server_api_archiver_v1_message_proto = out.File
453 > file_temporal_server_api_archiver_v1_message_proto_goTypes = nil
454 > file_temporal_server_api_archiver_v1_message_proto_depIdxs = nil
455 }
go.temporal.io/server/api/chasm/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

206 }
207
208 > func init() { file_temporal_server_api_chasm_v1_message_proto_init() } message.pb.go
209 > func file_temporal_server_api_chasm_v1_message_proto_init() {
210 > if File_temporal_server_api_chasm_v1_message_proto != nil {
211 return
212 }
213 > type x struct{} message.pb.go
214 > out := protoimpl.TypeBuilder{
215 > File: protoimpl.DescBuilder{
216 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
217 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_chasm_v1_message_proto_rawDesc), len(file_temporal_server_api_chasm_v1_message_proto_rawDesc)),
218 > NumEnums: 0,
219 > NumMessages: 1,
220 > NumExtensions: 0,
221 > NumServices: 0,
222 > },
223 > GoTypes: file_temporal_server_api_chasm_v1_message_proto_goTypes,
224 > DependencyIndexes: file_temporal_server_api_chasm_v1_message_proto_depIdxs,
225 > MessageInfos: file_temporal_server_api_chasm_v1_message_proto_msgTypes,
226 > }.Build()
227 > File_temporal_server_api_chasm_v1_message_proto = out.File
228 > file_temporal_server_api_chasm_v1_message_proto_goTypes = nil
229 > file_temporal_server_api_chasm_v1_message_proto_depIdxs = nil
230 }
go.temporal.io/server/api/checksum/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

334 }
335
336 > func init() { file_temporal_server_api_checksum_v1_message_proto_init() } message.pb.go
337 > func file_temporal_server_api_checksum_v1_message_proto_init() {
338 > if File_temporal_server_api_checksum_v1_message_proto != nil {
339 return
340 }
341 > type x struct{} message.pb.go
342 > out := protoimpl.TypeBuilder{
343 > File: protoimpl.DescBuilder{
344 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
345 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_checksum_v1_message_proto_rawDesc), len(file_temporal_server_api_checksum_v1_message_proto_rawDesc)),
346 > NumEnums: 0,
347 > NumMessages: 1,
348 > NumExtensions: 0,
349 > NumServices: 0,
350 > },
351 > GoTypes: file_temporal_server_api_checksum_v1_message_proto_goTypes,
352 > DependencyIndexes: file_temporal_server_api_checksum_v1_message_proto_depIdxs,
353 > MessageInfos: file_temporal_server_api_checksum_v1_message_proto_msgTypes,
354 > }.Build()
355 > File_temporal_server_api_checksum_v1_message_proto = out.File
356 > file_temporal_server_api_checksum_v1_message_proto_goTypes = nil
357 > file_temporal_server_api_checksum_v1_message_proto_depIdxs = nil
358 }
go.temporal.io/server/api/cluster/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

342 }
343
344 > func init() { file_temporal_server_api_cluster_v1_message_proto_init() } message.pb.go
345 > func file_temporal_server_api_cluster_v1_message_proto_init() {
346 > if File_temporal_server_api_cluster_v1_message_proto != nil {
347 return
348 }
349 > type x struct{} message.pb.go
350 > out := protoimpl.TypeBuilder{
351 > File: protoimpl.DescBuilder{
352 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
353 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_cluster_v1_message_proto_rawDesc), len(file_temporal_server_api_cluster_v1_message_proto_rawDesc)),
354 > NumEnums: 0,
355 > NumMessages: 4,
356 > NumExtensions: 0,
357 > NumServices: 0,
358 > },
359 > GoTypes: file_temporal_server_api_cluster_v1_message_proto_goTypes,
360 > DependencyIndexes: file_temporal_server_api_cluster_v1_message_proto_depIdxs,
361 > MessageInfos: file_temporal_server_api_cluster_v1_message_proto_msgTypes,
362 > }.Build()
363 > File_temporal_server_api_cluster_v1_message_proto = out.File
364 > file_temporal_server_api_cluster_v1_message_proto_goTypes = nil
365 > file_temporal_server_api_cluster_v1_message_proto_depIdxs = nil
366 }
go.temporal.io/server/api/common/v1/dlq.pb.go 20 covered LOC · 2 ranges

Open complete file

295 }
296
297 > func init() { file_temporal_server_api_common_v1_dlq_proto_init() } dlq.pb.go
298 > func file_temporal_server_api_common_v1_dlq_proto_init() {
299 > if File_temporal_server_api_common_v1_dlq_proto != nil {
300 return
301 }
302 > type x struct{} dlq.pb.go
303 > out := protoimpl.TypeBuilder{
304 > File: protoimpl.DescBuilder{
305 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
306 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_common_v1_dlq_proto_rawDesc), len(file_temporal_server_api_common_v1_dlq_proto_rawDesc)),
307 > NumEnums: 0,
308 > NumMessages: 4,
309 > NumExtensions: 0,
310 > NumServices: 0,
311 > },
312 > GoTypes: file_temporal_server_api_common_v1_dlq_proto_goTypes,
313 > DependencyIndexes: file_temporal_server_api_common_v1_dlq_proto_depIdxs,
314 > MessageInfos: file_temporal_server_api_common_v1_dlq_proto_msgTypes,
315 > }.Build()
316 > File_temporal_server_api_common_v1_dlq_proto = out.File
317 > file_temporal_server_api_common_v1_dlq_proto_goTypes = nil
318 > file_temporal_server_api_common_v1_dlq_proto_depIdxs = nil
319 }
go.temporal.io/server/api/contextpropagation/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

109 }
110
111 > func init() { file_temporal_server_api_contextpropagation_v1_message_proto_init() } message.pb.go
112 > func file_temporal_server_api_contextpropagation_v1_message_proto_init() {
113 > if File_temporal_server_api_contextpropagation_v1_message_proto != nil {
114 return
115 }
116 > type x struct{} message.pb.go
117 > out := protoimpl.TypeBuilder{
118 > File: protoimpl.DescBuilder{
119 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
120 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_contextpropagation_v1_message_proto_rawDesc), len(file_temporal_server_api_contextpropagation_v1_message_proto_rawDesc)),
121 > NumEnums: 0,
122 > NumMessages: 2,
123 > NumExtensions: 0,
124 > NumServices: 0,
125 > },
126 > GoTypes: file_temporal_server_api_contextpropagation_v1_message_proto_goTypes,
127 > DependencyIndexes: file_temporal_server_api_contextpropagation_v1_message_proto_depIdxs,
128 > MessageInfos: file_temporal_server_api_contextpropagation_v1_message_proto_msgTypes,
129 > }.Build()
130 > File_temporal_server_api_contextpropagation_v1_message_proto = out.File
131 > file_temporal_server_api_contextpropagation_v1_message_proto_goTypes = nil
132 > file_temporal_server_api_contextpropagation_v1_message_proto_depIdxs = nil
133 }
go.temporal.io/server/api/deployment/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

4626 }
4627
4628 > func init() { file_temporal_server_api_deployment_v1_message_proto_init() } message.pb.go
4629 > func file_temporal_server_api_deployment_v1_message_proto_init() {
4630 > if File_temporal_server_api_deployment_v1_message_proto != nil {
4631 return
4632 }
4633 > type x struct{} message.pb.go
4634 > out := protoimpl.TypeBuilder{
4635 > File: protoimpl.DescBuilder{
4636 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
4637 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_deployment_v1_message_proto_rawDesc), len(file_temporal_server_api_deployment_v1_message_proto_rawDesc)),
4638 > NumEnums: 0,
4639 > NumMessages: 75,
4640 > NumExtensions: 0,
4641 > NumServices: 0,
4642 > },
4643 > GoTypes: file_temporal_server_api_deployment_v1_message_proto_goTypes,
4644 > DependencyIndexes: file_temporal_server_api_deployment_v1_message_proto_depIdxs,
4645 > MessageInfos: file_temporal_server_api_deployment_v1_message_proto_msgTypes,
4646 > }.Build()
4647 > File_temporal_server_api_deployment_v1_message_proto = out.File
4648 > file_temporal_server_api_deployment_v1_message_proto_goTypes = nil
4649 > file_temporal_server_api_deployment_v1_message_proto_depIdxs = nil
4650 }
go.temporal.io/server/api/enums/v1/cluster.pb.go 20 covered LOC · 2 ranges

Open complete file

209 }
210
211 > func init() { file_temporal_server_api_enums_v1_cluster_proto_init() } cluster.pb.go
212 > func file_temporal_server_api_enums_v1_cluster_proto_init() {
213 > if File_temporal_server_api_enums_v1_cluster_proto != nil {
214 return
215 }
216 > type x struct{} cluster.pb.go
217 > out := protoimpl.TypeBuilder{
218 > File: protoimpl.DescBuilder{
219 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
220 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_cluster_proto_rawDesc), len(file_temporal_server_api_enums_v1_cluster_proto_rawDesc)),
221 > NumEnums: 2,
222 > NumMessages: 0,
223 > NumExtensions: 0,
224 > NumServices: 0,
225 > },
226 > GoTypes: file_temporal_server_api_enums_v1_cluster_proto_goTypes,
227 > DependencyIndexes: file_temporal_server_api_enums_v1_cluster_proto_depIdxs,
228 > EnumInfos: file_temporal_server_api_enums_v1_cluster_proto_enumTypes,
229 > }.Build()
230 > File_temporal_server_api_enums_v1_cluster_proto = out.File
231 > file_temporal_server_api_enums_v1_cluster_proto_goTypes = nil
232 > file_temporal_server_api_enums_v1_cluster_proto_depIdxs = nil
233 }
go.temporal.io/server/api/enums/v1/dlq.pb.go 20 covered LOC · 2 ranges

Open complete file

187 }
188
189 > func init() { file_temporal_server_api_enums_v1_dlq_proto_init() } dlq.pb.go
190 > func file_temporal_server_api_enums_v1_dlq_proto_init() {
191 > if File_temporal_server_api_enums_v1_dlq_proto != nil {
192 return
193 }
194 > type x struct{} dlq.pb.go
195 > out := protoimpl.TypeBuilder{
196 > File: protoimpl.DescBuilder{
197 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
198 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_dlq_proto_rawDesc), len(file_temporal_server_api_enums_v1_dlq_proto_rawDesc)),
199 > NumEnums: 2,
200 > NumMessages: 0,
201 > NumExtensions: 0,
202 > NumServices: 0,
203 > },
204 > GoTypes: file_temporal_server_api_enums_v1_dlq_proto_goTypes,
205 > DependencyIndexes: file_temporal_server_api_enums_v1_dlq_proto_depIdxs,
206 > EnumInfos: file_temporal_server_api_enums_v1_dlq_proto_enumTypes,
207 > }.Build()
208 > File_temporal_server_api_enums_v1_dlq_proto = out.File
209 > file_temporal_server_api_enums_v1_dlq_proto_goTypes = nil
210 > file_temporal_server_api_enums_v1_dlq_proto_depIdxs = nil
211 }
go.temporal.io/server/api/enums/v1/fairness_state.pb.go 20 covered LOC · 2 ranges

Open complete file

123 }
124
125 > func init() { file_temporal_server_api_enums_v1_fairness_state_proto_init() } fairness_state.pb.go
126 > func file_temporal_server_api_enums_v1_fairness_state_proto_init() {
127 > if File_temporal_server_api_enums_v1_fairness_state_proto != nil {
128 return
129 }
130 > type x struct{} fairness_state.pb.go
131 > out := protoimpl.TypeBuilder{
132 > File: protoimpl.DescBuilder{
133 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
134 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_fairness_state_proto_rawDesc), len(file_temporal_server_api_enums_v1_fairness_state_proto_rawDesc)),
135 > NumEnums: 1,
136 > NumMessages: 0,
137 > NumExtensions: 0,
138 > NumServices: 0,
139 > },
140 > GoTypes: file_temporal_server_api_enums_v1_fairness_state_proto_goTypes,
141 > DependencyIndexes: file_temporal_server_api_enums_v1_fairness_state_proto_depIdxs,
142 > EnumInfos: file_temporal_server_api_enums_v1_fairness_state_proto_enumTypes,
143 > }.Build()
144 > File_temporal_server_api_enums_v1_fairness_state_proto = out.File
145 > file_temporal_server_api_enums_v1_fairness_state_proto_goTypes = nil
146 > file_temporal_server_api_enums_v1_fairness_state_proto_depIdxs = nil
147 }
go.temporal.io/server/api/enums/v1/replication.pb.go 20 covered LOC · 2 ranges

Open complete file

314 }
315
316 > func init() { file_temporal_server_api_enums_v1_replication_proto_init() } replication.pb.go
317 > func file_temporal_server_api_enums_v1_replication_proto_init() {
318 > if File_temporal_server_api_enums_v1_replication_proto != nil {
319 return
320 }
321 > type x struct{} replication.pb.go
322 > out := protoimpl.TypeBuilder{
323 > File: protoimpl.DescBuilder{
324 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
325 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_enums_v1_replication_proto_rawDesc), len(file_temporal_server_api_enums_v1_replication_proto_rawDesc)),
326 > NumEnums: 3,
327 > NumMessages: 0,
328 > NumExtensions: 0,
329 > NumServices: 0,
330 > },
331 > GoTypes: file_temporal_server_api_enums_v1_replication_proto_goTypes,
332 > DependencyIndexes: file_temporal_server_api_enums_v1_replication_proto_depIdxs,
333 > EnumInfos: file_temporal_server_api_enums_v1_replication_proto_enumTypes,
334 > }.Build()
335 > File_temporal_server_api_enums_v1_replication_proto = out.File
336 > file_temporal_server_api_enums_v1_replication_proto_goTypes = nil
337 > file_temporal_server_api_enums_v1_replication_proto_depIdxs = nil
338 }
go.temporal.io/server/api/errordetails/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

625 }
626
627 > func init() { file_temporal_server_api_errordetails_v1_message_proto_init() } message.pb.go
628 > func file_temporal_server_api_errordetails_v1_message_proto_init() {
629 > if File_temporal_server_api_errordetails_v1_message_proto != nil {
630 return
631 }
632 > type x struct{} message.pb.go
633 > out := protoimpl.TypeBuilder{
634 > File: protoimpl.DescBuilder{
635 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
636 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_errordetails_v1_message_proto_rawDesc), len(file_temporal_server_api_errordetails_v1_message_proto_rawDesc)),
637 > NumEnums: 0,
638 > NumMessages: 10,
639 > NumExtensions: 0,
640 > NumServices: 0,
641 > },
642 > GoTypes: file_temporal_server_api_errordetails_v1_message_proto_goTypes,
643 > DependencyIndexes: file_temporal_server_api_errordetails_v1_message_proto_depIdxs,
644 > MessageInfos: file_temporal_server_api_errordetails_v1_message_proto_msgTypes,
645 > }.Build()
646 > File_temporal_server_api_errordetails_v1_message_proto = out.File
647 > file_temporal_server_api_errordetails_v1_message_proto_goTypes = nil
648 > file_temporal_server_api_errordetails_v1_message_proto_depIdxs = nil
649 }
go.temporal.io/server/api/health/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

300 }
301
302 > func init() { file_temporal_server_api_health_v1_message_proto_init() } message.pb.go
303 > func file_temporal_server_api_health_v1_message_proto_init() {
304 > if File_temporal_server_api_health_v1_message_proto != nil {
305 return
306 }
307 > type x struct{} message.pb.go
308 > out := protoimpl.TypeBuilder{
309 > File: protoimpl.DescBuilder{
310 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
311 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_health_v1_message_proto_rawDesc), len(file_temporal_server_api_health_v1_message_proto_rawDesc)),
312 > NumEnums: 0,
313 > NumMessages: 3,
314 > NumExtensions: 0,
315 > NumServices: 0,
316 > },
317 > GoTypes: file_temporal_server_api_health_v1_message_proto_goTypes,
318 > DependencyIndexes: file_temporal_server_api_health_v1_message_proto_depIdxs,
319 > MessageInfos: file_temporal_server_api_health_v1_message_proto_msgTypes,
320 > }.Build()
321 > File_temporal_server_api_health_v1_message_proto = out.File
322 > file_temporal_server_api_health_v1_message_proto_goTypes = nil
323 > file_temporal_server_api_health_v1_message_proto_depIdxs = nil
324 }
go.temporal.io/server/api/historyservice/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

428 }
429
430 > func init() { file_temporal_server_api_historyservice_v1_service_proto_init() } service.pb.go
431 > func file_temporal_server_api_historyservice_v1_service_proto_init() {
432 > if File_temporal_server_api_historyservice_v1_service_proto != nil {
433 return
434 }
435 > file_temporal_server_api_historyservice_v1_request_response_proto_init() service.pb.go
436 > type x struct{}
437 > out := protoimpl.TypeBuilder{
438 > File: protoimpl.DescBuilder{
439 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
440 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_historyservice_v1_service_proto_rawDesc), len(file_temporal_server_api_historyservice_v1_service_proto_rawDesc)),
441 > NumEnums: 0,
442 > NumMessages: 0,
443 > NumExtensions: 0,
444 > NumServices: 1,
445 > },
446 > GoTypes: file_temporal_server_api_historyservice_v1_service_proto_goTypes,
447 > DependencyIndexes: file_temporal_server_api_historyservice_v1_service_proto_depIdxs,
448 > }.Build()
449 > File_temporal_server_api_historyservice_v1_service_proto = out.File
450 > file_temporal_server_api_historyservice_v1_service_proto_goTypes = nil
451 > file_temporal_server_api_historyservice_v1_service_proto_depIdxs = nil
452 }
go.temporal.io/server/api/matchingservice/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

250 }
251
252 > func init() { file_temporal_server_api_matchingservice_v1_service_proto_init() } service.pb.go
253 > func file_temporal_server_api_matchingservice_v1_service_proto_init() {
254 > if File_temporal_server_api_matchingservice_v1_service_proto != nil {
255 return
256 }
257 > file_temporal_server_api_matchingservice_v1_request_response_proto_init() service.pb.go
258 > type x struct{}
259 > out := protoimpl.TypeBuilder{
260 > File: protoimpl.DescBuilder{
261 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
262 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_matchingservice_v1_service_proto_rawDesc), len(file_temporal_server_api_matchingservice_v1_service_proto_rawDesc)),
263 > NumEnums: 0,
264 > NumMessages: 0,
265 > NumExtensions: 0,
266 > NumServices: 1,
267 > },
268 > GoTypes: file_temporal_server_api_matchingservice_v1_service_proto_goTypes,
269 > DependencyIndexes: file_temporal_server_api_matchingservice_v1_service_proto_depIdxs,
270 > }.Build()
271 > File_temporal_server_api_matchingservice_v1_service_proto = out.File
272 > file_temporal_server_api_matchingservice_v1_service_proto_goTypes = nil
273 > file_temporal_server_api_matchingservice_v1_service_proto_depIdxs = nil
274 }
go.temporal.io/server/api/metrics/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

104 }
105
106 > func init() { file_temporal_server_api_metrics_v1_message_proto_init() } message.pb.go
107 > func file_temporal_server_api_metrics_v1_message_proto_init() {
108 > if File_temporal_server_api_metrics_v1_message_proto != nil {
109 return
110 }
111 > type x struct{} message.pb.go
112 > out := protoimpl.TypeBuilder{
113 > File: protoimpl.DescBuilder{
114 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
115 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_metrics_v1_message_proto_rawDesc), len(file_temporal_server_api_metrics_v1_message_proto_rawDesc)),
116 > NumEnums: 0,
117 > NumMessages: 2,
118 > NumExtensions: 0,
119 > NumServices: 0,
120 > },
121 > GoTypes: file_temporal_server_api_metrics_v1_message_proto_goTypes,
122 > DependencyIndexes: file_temporal_server_api_metrics_v1_message_proto_depIdxs,
123 > MessageInfos: file_temporal_server_api_metrics_v1_message_proto_msgTypes,
124 > }.Build()
125 > File_temporal_server_api_metrics_v1_message_proto = out.File
126 > file_temporal_server_api_metrics_v1_message_proto_goTypes = nil
127 > file_temporal_server_api_metrics_v1_message_proto_depIdxs = nil
128 }
go.temporal.io/server/api/namespace/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

114 }
115
116 > func init() { file_temporal_server_api_namespace_v1_message_proto_init() } message.pb.go
117 > func file_temporal_server_api_namespace_v1_message_proto_init() {
118 > if File_temporal_server_api_namespace_v1_message_proto != nil {
119 return
120 }
121 > type x struct{} message.pb.go
122 > out := protoimpl.TypeBuilder{
123 > File: protoimpl.DescBuilder{
124 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
125 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_namespace_v1_message_proto_rawDesc), len(file_temporal_server_api_namespace_v1_message_proto_rawDesc)),
126 > NumEnums: 0,
127 > NumMessages: 1,
128 > NumExtensions: 0,
129 > NumServices: 0,
130 > },
131 > GoTypes: file_temporal_server_api_namespace_v1_message_proto_goTypes,
132 > DependencyIndexes: file_temporal_server_api_namespace_v1_message_proto_depIdxs,
133 > MessageInfos: file_temporal_server_api_namespace_v1_message_proto_msgTypes,
134 > }.Build()
135 > File_temporal_server_api_namespace_v1_message_proto = out.File
136 > file_temporal_server_api_namespace_v1_message_proto_goTypes = nil
137 > file_temporal_server_api_namespace_v1_message_proto_depIdxs = nil
138 }
go.temporal.io/server/api/persistence/v1/chasm_visibility.pb.go 20 covered LOC · 2 ranges

Open complete file

146 }
147
148 > func init() { file_temporal_server_api_persistence_v1_chasm_visibility_proto_init() } chasm_visibility.pb.go
149 > func file_temporal_server_api_persistence_v1_chasm_visibility_proto_init() {
150 > if File_temporal_server_api_persistence_v1_chasm_visibility_proto != nil {
151 return
152 }
153 > type x struct{} chasm_visibility.pb.go
154 > out := protoimpl.TypeBuilder{
155 > File: protoimpl.DescBuilder{
156 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
157 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_chasm_visibility_proto_rawDesc), len(file_temporal_server_api_persistence_v1_chasm_visibility_proto_rawDesc)),
158 > NumEnums: 0,
159 > NumMessages: 2,
160 > NumExtensions: 0,
161 > NumServices: 0,
162 > },
163 > GoTypes: file_temporal_server_api_persistence_v1_chasm_visibility_proto_goTypes,
164 > DependencyIndexes: file_temporal_server_api_persistence_v1_chasm_visibility_proto_depIdxs,
165 > MessageInfos: file_temporal_server_api_persistence_v1_chasm_visibility_proto_msgTypes,
166 > }.Build()
167 > File_temporal_server_api_persistence_v1_chasm_visibility_proto = out.File
168 > file_temporal_server_api_persistence_v1_chasm_visibility_proto_goTypes = nil
169 > file_temporal_server_api_persistence_v1_chasm_visibility_proto_depIdxs = nil
170 }
go.temporal.io/server/api/persistence/v1/cluster_metadata.pb.go 20 covered LOC · 2 ranges

Open complete file

289 }
290
291 > func init() { file_temporal_server_api_persistence_v1_cluster_metadata_proto_init() } cluster_metadata.pb.go
292 > func file_temporal_server_api_persistence_v1_cluster_metadata_proto_init() {
293 > if File_temporal_server_api_persistence_v1_cluster_metadata_proto != nil {
294 return
295 }
296 > type x struct{} cluster_metadata.pb.go
297 > out := protoimpl.TypeBuilder{
298 > File: protoimpl.DescBuilder{
299 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
300 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_cluster_metadata_proto_rawDesc), len(file_temporal_server_api_persistence_v1_cluster_metadata_proto_rawDesc)),
301 > NumEnums: 0,
302 > NumMessages: 5,
303 > NumExtensions: 0,
304 > NumServices: 0,
305 > },
306 > GoTypes: file_temporal_server_api_persistence_v1_cluster_metadata_proto_goTypes,
307 > DependencyIndexes: file_temporal_server_api_persistence_v1_cluster_metadata_proto_depIdxs,
308 > MessageInfos: file_temporal_server_api_persistence_v1_cluster_metadata_proto_msgTypes,
309 > }.Build()
310 > File_temporal_server_api_persistence_v1_cluster_metadata_proto = out.File
311 > file_temporal_server_api_persistence_v1_cluster_metadata_proto_goTypes = nil
312 > file_temporal_server_api_persistence_v1_cluster_metadata_proto_depIdxs = nil
313 }
go.temporal.io/server/api/persistence/v1/namespaces.pb.go 20 covered LOC · 2 ranges

Open complete file

536 }
537
538 > func init() { file_temporal_server_api_persistence_v1_namespaces_proto_init() } namespaces.pb.go
539 > func file_temporal_server_api_persistence_v1_namespaces_proto_init() {
540 > if File_temporal_server_api_persistence_v1_namespaces_proto != nil {
541 return
542 }
543 > type x struct{} namespaces.pb.go
544 > out := protoimpl.TypeBuilder{
545 > File: protoimpl.DescBuilder{
546 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
547 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_namespaces_proto_rawDesc), len(file_temporal_server_api_persistence_v1_namespaces_proto_rawDesc)),
548 > NumEnums: 0,
549 > NumMessages: 8,
550 > NumExtensions: 0,
551 > NumServices: 0,
552 > },
553 > GoTypes: file_temporal_server_api_persistence_v1_namespaces_proto_goTypes,
554 > DependencyIndexes: file_temporal_server_api_persistence_v1_namespaces_proto_depIdxs,
555 > MessageInfos: file_temporal_server_api_persistence_v1_namespaces_proto_msgTypes,
556 > }.Build()
557 > File_temporal_server_api_persistence_v1_namespaces_proto = out.File
558 > file_temporal_server_api_persistence_v1_namespaces_proto_goTypes = nil
559 > file_temporal_server_api_persistence_v1_namespaces_proto_depIdxs = nil
560 }
go.temporal.io/server/api/persistence/v1/queue_metadata.pb.go 20 covered LOC · 2 ranges

Open complete file

105 }
106
107 > func init() { file_temporal_server_api_persistence_v1_queue_metadata_proto_init() } queue_metadata.pb.go
108 > func file_temporal_server_api_persistence_v1_queue_metadata_proto_init() {
109 > if File_temporal_server_api_persistence_v1_queue_metadata_proto != nil {
110 return
111 }
112 > type x struct{} queue_metadata.pb.go
113 > out := protoimpl.TypeBuilder{
114 > File: protoimpl.DescBuilder{
115 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
116 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_queue_metadata_proto_rawDesc), len(file_temporal_server_api_persistence_v1_queue_metadata_proto_rawDesc)),
117 > NumEnums: 0,
118 > NumMessages: 2,
119 > NumExtensions: 0,
120 > NumServices: 0,
121 > },
122 > GoTypes: file_temporal_server_api_persistence_v1_queue_metadata_proto_goTypes,
123 > DependencyIndexes: file_temporal_server_api_persistence_v1_queue_metadata_proto_depIdxs,
124 > MessageInfos: file_temporal_server_api_persistence_v1_queue_metadata_proto_msgTypes,
125 > }.Build()
126 > File_temporal_server_api_persistence_v1_queue_metadata_proto = out.File
127 > file_temporal_server_api_persistence_v1_queue_metadata_proto_goTypes = nil
128 > file_temporal_server_api_persistence_v1_queue_metadata_proto_depIdxs = nil
129 }
go.temporal.io/server/api/persistence/v1/tasks.pb.go 20 covered LOC · 2 ranges

Open complete file

846 }
847
848 > func init() { file_temporal_server_api_persistence_v1_tasks_proto_init() } tasks.pb.go
849 > func file_temporal_server_api_persistence_v1_tasks_proto_init() {
850 > if File_temporal_server_api_persistence_v1_tasks_proto != nil {
851 return
852 }
853 > type x struct{} tasks.pb.go
854 > out := protoimpl.TypeBuilder{
855 > File: protoimpl.DescBuilder{
856 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
857 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_persistence_v1_tasks_proto_rawDesc), len(file_temporal_server_api_persistence_v1_tasks_proto_rawDesc)),
858 > NumEnums: 0,
859 > NumMessages: 8,
860 > NumExtensions: 0,
861 > NumServices: 0,
862 > },
863 > GoTypes: file_temporal_server_api_persistence_v1_tasks_proto_goTypes,
864 > DependencyIndexes: file_temporal_server_api_persistence_v1_tasks_proto_depIdxs,
865 > MessageInfos: file_temporal_server_api_persistence_v1_tasks_proto_msgTypes,
866 > }.Build()
867 > File_temporal_server_api_persistence_v1_tasks_proto = out.File
868 > file_temporal_server_api_persistence_v1_tasks_proto_goTypes = nil
869 > file_temporal_server_api_persistence_v1_tasks_proto_depIdxs = nil
870 }
go.temporal.io/server/api/token/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

785 }
786
787 > func init() { file_temporal_server_api_token_v1_message_proto_init() } message.pb.go
788 > func file_temporal_server_api_token_v1_message_proto_init() {
789 > if File_temporal_server_api_token_v1_message_proto != nil {
790 return
791 }
792 > type x struct{} message.pb.go
793 > out := protoimpl.TypeBuilder{
794 > File: protoimpl.DescBuilder{
795 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
796 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_token_v1_message_proto_rawDesc), len(file_temporal_server_api_token_v1_message_proto_rawDesc)),
797 > NumEnums: 0,
798 > NumMessages: 7,
799 > NumExtensions: 0,
800 > NumServices: 0,
801 > },
802 > GoTypes: file_temporal_server_api_token_v1_message_proto_goTypes,
803 > DependencyIndexes: file_temporal_server_api_token_v1_message_proto_depIdxs,
804 > MessageInfos: file_temporal_server_api_token_v1_message_proto_msgTypes,
805 > }.Build()
806 > File_temporal_server_api_token_v1_message_proto = out.File
807 > file_temporal_server_api_token_v1_message_proto_goTypes = nil
808 > file_temporal_server_api_token_v1_message_proto_depIdxs = nil
809 }
go.temporal.io/server/api/visibilityservice/v1/request_response.pb.go 20 covered LOC · 2 ranges

Open complete file

402 }
403
404 > func init() { file_temporal_server_api_visibilityservice_v1_request_response_proto_init() } request_response.pb.go
405 > func file_temporal_server_api_visibilityservice_v1_request_response_proto_init() {
406 > if File_temporal_server_api_visibilityservice_v1_request_response_proto != nil {
407 return
408 }
409 > type x struct{} request_response.pb.go
410 > out := protoimpl.TypeBuilder{
411 > File: protoimpl.DescBuilder{
412 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
413 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_api_visibilityservice_v1_request_response_proto_rawDesc), len(file_temporal_server_api_visibilityservice_v1_request_response_proto_rawDesc)),
414 > NumEnums: 0,
415 > NumMessages: 5,
416 > NumExtensions: 0,
417 > NumServices: 0,
418 > },
419 > GoTypes: file_temporal_server_api_visibilityservice_v1_request_response_proto_goTypes,
420 > DependencyIndexes: file_temporal_server_api_visibilityservice_v1_request_response_proto_depIdxs,
421 > MessageInfos: file_temporal_server_api_visibilityservice_v1_request_response_proto_msgTypes,
422 > }.Build()
423 > File_temporal_server_api_visibilityservice_v1_request_response_proto = out.File
424 > file_temporal_server_api_visibilityservice_v1_request_response_proto_goTypes = nil
425 > file_temporal_server_api_visibilityservice_v1_request_response_proto_depIdxs = nil
426 }
go.temporal.io/server/chasm/lib/activity/gen/activitypb/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

91 }
92
93 > func init() { file_temporal_server_chasm_lib_activity_proto_v1_service_proto_init() } service.pb.go
94 > func file_temporal_server_chasm_lib_activity_proto_v1_service_proto_init() {
95 > if File_temporal_server_chasm_lib_activity_proto_v1_service_proto != nil {
96 return
97 }
98 > file_temporal_server_chasm_lib_activity_proto_v1_request_response_proto_init() service.pb.go
99 > type x struct{}
100 > out := protoimpl.TypeBuilder{
101 > File: protoimpl.DescBuilder{
102 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
103 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_activity_proto_v1_service_proto_rawDesc), len(file_temporal_server_chasm_lib_activity_proto_v1_service_proto_rawDesc)),
104 > NumEnums: 0,
105 > NumMessages: 0,
106 > NumExtensions: 0,
107 > NumServices: 1,
108 > },
109 > GoTypes: file_temporal_server_chasm_lib_activity_proto_v1_service_proto_goTypes,
110 > DependencyIndexes: file_temporal_server_chasm_lib_activity_proto_v1_service_proto_depIdxs,
111 > }.Build()
112 > File_temporal_server_chasm_lib_activity_proto_v1_service_proto = out.File
113 > file_temporal_server_chasm_lib_activity_proto_v1_service_proto_goTypes = nil
114 > file_temporal_server_chasm_lib_activity_proto_v1_service_proto_depIdxs = nil
115 }
go.temporal.io/server/chasm/lib/callback/gen/callbackpb/v1/tasks.pb.go 20 covered LOC · 2 ranges

Open complete file

148 }
149
150 > func init() { file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_init() } tasks.pb.go
151 > func file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_init() {
152 > if File_temporal_server_chasm_lib_callback_proto_v1_tasks_proto != nil {
153 return
154 }
155 > type x struct{} tasks.pb.go
156 > out := protoimpl.TypeBuilder{
157 > File: protoimpl.DescBuilder{
158 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
159 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_rawDesc), len(file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_rawDesc)),
160 > NumEnums: 0,
161 > NumMessages: 2,
162 > NumExtensions: 0,
163 > NumServices: 0,
164 > },
165 > GoTypes: file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_goTypes,
166 > DependencyIndexes: file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_depIdxs,
167 > MessageInfos: file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_msgTypes,
168 > }.Build()
169 > File_temporal_server_chasm_lib_callback_proto_v1_tasks_proto = out.File
170 > file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_goTypes = nil
171 > file_temporal_server_chasm_lib_callback_proto_v1_tasks_proto_depIdxs = nil
172 }
go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

71 }
72
73 > func init() { file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_init() } service.pb.go
74 > func file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_init() {
75 > if File_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto != nil {
76 return
77 }
78 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_request_response_proto_init() service.pb.go
79 > type x struct{}
80 > out := protoimpl.TypeBuilder{
81 > File: protoimpl.DescBuilder{
82 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
83 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_rawDesc), len(file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_rawDesc)),
84 > NumEnums: 0,
85 > NumMessages: 0,
86 > NumExtensions: 0,
87 > NumServices: 1,
88 > },
89 > GoTypes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_goTypes,
90 > DependencyIndexes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_depIdxs,
91 > }.Build()
92 > File_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto = out.File
93 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_goTypes = nil
94 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_service_proto_depIdxs = nil
95 }
go.temporal.io/server/chasm/lib/nexusoperation/gen/nexusoperationpb/v1/tasks.pb.go 20 covered LOC · 2 ranges

Open complete file

354 }
355
356 > func init() { file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_init() } tasks.pb.go
357 > func file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_init() {
358 > if File_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto != nil {
359 return
360 }
361 > type x struct{} tasks.pb.go
362 > out := protoimpl.TypeBuilder{
363 > File: protoimpl.DescBuilder{
364 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
365 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_rawDesc), len(file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_rawDesc)),
366 > NumEnums: 0,
367 > NumMessages: 7,
368 > NumExtensions: 0,
369 > NumServices: 0,
370 > },
371 > GoTypes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_goTypes,
372 > DependencyIndexes: file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_depIdxs,
373 > MessageInfos: file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_msgTypes,
374 > }.Build()
375 > File_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto = out.File
376 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_goTypes = nil
377 > file_temporal_server_chasm_lib_nexusoperation_proto_v1_tasks_proto_depIdxs = nil
378 }
go.temporal.io/server/chasm/lib/scheduler/gen/schedulerpb/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

86 }
87
88 > func init() { file_temporal_server_chasm_lib_scheduler_proto_v1_service_proto_init() } service.pb.go
89 > func file_temporal_server_chasm_lib_scheduler_proto_v1_service_proto_init() {
90 > if File_temporal_server_chasm_lib_scheduler_proto_v1_service_proto != nil {
91 return
92 }
93 > file_temporal_server_chasm_lib_scheduler_proto_v1_request_response_proto_init() service.pb.go
94 > type x struct{}
95 > out := protoimpl.TypeBuilder{
96 > File: protoimpl.DescBuilder{
97 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
98 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_scheduler_proto_v1_service_proto_rawDesc), len(file_temporal_server_chasm_lib_scheduler_proto_v1_service_proto_rawDesc)),
99 > NumEnums: 0,
100 > NumMessages: 0,
101 > NumExtensions: 0,
102 > NumServices: 1,
103 > },
104 > GoTypes: file_temporal_server_chasm_lib_scheduler_proto_v1_service_proto_goTypes,
105 > DependencyIndexes: file_temporal_server_chasm_lib_scheduler_proto_v1_service_proto_depIdxs,
106 > }.Build()
107 > File_temporal_server_chasm_lib_scheduler_proto_v1_service_proto = out.File
108 > file_temporal_server_chasm_lib_scheduler_proto_v1_service_proto_goTypes = nil
109 > file_temporal_server_chasm_lib_scheduler_proto_v1_service_proto_depIdxs = nil
110 }
go.temporal.io/server/chasm/lib/scheduler/gen/schedulerpb/v1/tasks.pb.go 20 covered LOC · 2 ranges

Open complete file

343 }
344
345 > func init() { file_temporal_server_chasm_lib_scheduler_proto_v1_tasks_proto_init() } tasks.pb.go
346 > func file_temporal_server_chasm_lib_scheduler_proto_v1_tasks_proto_init() {
347 > if File_temporal_server_chasm_lib_scheduler_proto_v1_tasks_proto != nil {
348 return
349 }
350 > type x struct{} tasks.pb.go
351 > out := protoimpl.TypeBuilder{
352 > File: protoimpl.DescBuilder{
353 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
354 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_scheduler_proto_v1_tasks_proto_rawDesc), len(file_temporal_server_chasm_lib_scheduler_proto_v1_tasks_proto_rawDesc)),
355 > NumEnums: 0,
356 > NumMessages: 7,
357 > NumExtensions: 0,
358 > NumServices: 0,
359 > },
360 > GoTypes: file_temporal_server_chasm_lib_scheduler_proto_v1_tasks_proto_goTypes,
361 > DependencyIndexes: file_temporal_server_chasm_lib_scheduler_proto_v1_tasks_proto_depIdxs,
362 > MessageInfos: file_temporal_server_chasm_lib_scheduler_proto_v1_tasks_proto_msgTypes,
363 > }.Build()
364 > File_temporal_server_chasm_lib_scheduler_proto_v1_tasks_proto = out.File
365 > file_temporal_server_chasm_lib_scheduler_proto_v1_tasks_proto_goTypes = nil
366 > file_temporal_server_chasm_lib_scheduler_proto_v1_tasks_proto_depIdxs = nil
367 }
go.temporal.io/server/chasm/lib/tests/gen/testspb/v1/message.pb.go 20 covered LOC · 2 ranges

Open complete file

242 }
243
244 > func init() { file_temporal_server_chasm_lib_tests_proto_v1_message_proto_init() } message.pb.go
245 > func file_temporal_server_chasm_lib_tests_proto_v1_message_proto_init() {
246 > if File_temporal_server_chasm_lib_tests_proto_v1_message_proto != nil {
247 return
248 }
249 > type x struct{} message.pb.go
250 > out := protoimpl.TypeBuilder{
251 > File: protoimpl.DescBuilder{
252 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
253 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_tests_proto_v1_message_proto_rawDesc), len(file_temporal_server_chasm_lib_tests_proto_v1_message_proto_rawDesc)),
254 > NumEnums: 0,
255 > NumMessages: 4,
256 > NumExtensions: 0,
257 > NumServices: 0,
258 > },
259 > GoTypes: file_temporal_server_chasm_lib_tests_proto_v1_message_proto_goTypes,
260 > DependencyIndexes: file_temporal_server_chasm_lib_tests_proto_v1_message_proto_depIdxs,
261 > MessageInfos: file_temporal_server_chasm_lib_tests_proto_v1_message_proto_msgTypes,
262 > }.Build()
263 > File_temporal_server_chasm_lib_tests_proto_v1_message_proto = out.File
264 > file_temporal_server_chasm_lib_tests_proto_v1_message_proto_goTypes = nil
265 > file_temporal_server_chasm_lib_tests_proto_v1_message_proto_depIdxs = nil
266 }
go.temporal.io/server/chasm/lib/tests/gen/testspb/v1/service.pb.go 20 covered LOC · 2 ranges

Open complete file

46 }
47
48 > func init() { file_temporal_server_chasm_lib_tests_proto_v1_service_proto_init() } service.pb.go
49 > func file_temporal_server_chasm_lib_tests_proto_v1_service_proto_init() {
50 > if File_temporal_server_chasm_lib_tests_proto_v1_service_proto != nil {
51 return
52 }
53 > file_temporal_server_chasm_lib_tests_proto_v1_request_response_proto_init() service.pb.go
54 > type x struct{}
55 > out := protoimpl.TypeBuilder{
56 > File: protoimpl.DescBuilder{
57 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
58 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_tests_proto_v1_service_proto_rawDesc), len(file_temporal_server_chasm_lib_tests_proto_v1_service_proto_rawDesc)),
59 > NumEnums: 0,
60 > NumMessages: 0,
61 > NumExtensions: 0,
62 > NumServices: 1,
63 > },
64 > GoTypes: file_temporal_server_chasm_lib_tests_proto_v1_service_proto_goTypes,
65 > DependencyIndexes: file_temporal_server_chasm_lib_tests_proto_v1_service_proto_depIdxs,
66 > }.Build()
67 > File_temporal_server_chasm_lib_tests_proto_v1_service_proto = out.File
68 > file_temporal_server_chasm_lib_tests_proto_v1_service_proto_goTypes = nil
69 > file_temporal_server_chasm_lib_tests_proto_v1_service_proto_depIdxs = nil
70 }
go.temporal.io/server/chasm/lib/workflow/gen/workflowpb/v1/state.pb.go 20 covered LOC · 2 ranges

Open complete file

211 }
212
213 > func init() { file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_init() } state.pb.go
214 > func file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_init() {
215 > if File_temporal_server_chasm_lib_workflow_proto_v1_state_proto != nil {
216 return
217 }
218 > type x struct{} state.pb.go
219 > out := protoimpl.TypeBuilder{
220 > File: protoimpl.DescBuilder{
221 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
222 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_rawDesc), len(file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_rawDesc)),
223 > NumEnums: 0,
224 > NumMessages: 3,
225 > NumExtensions: 0,
226 > NumServices: 0,
227 > },
228 > GoTypes: file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_goTypes,
229 > DependencyIndexes: file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_depIdxs,
230 > MessageInfos: file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_msgTypes,
231 > }.Build()
232 > File_temporal_server_chasm_lib_workflow_proto_v1_state_proto = out.File
233 > file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_goTypes = nil
234 > file_temporal_server_chasm_lib_workflow_proto_v1_state_proto_depIdxs = nil
235 }
go.temporal.io/server/chasm/lib/workflow/gen/workflowpb/v1/update_state.pb.go 20 covered LOC · 2 ranges

Open complete file

113 }
114
115 > func init() { file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_init() } update_state.pb.go
116 > func file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_init() {
117 > if File_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto != nil {
118 return
119 }
120 > type x struct{} update_state.pb.go
121 > out := protoimpl.TypeBuilder{
122 > File: protoimpl.DescBuilder{
123 > GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
124 > RawDescriptor: unsafe.Slice(unsafe.StringData(file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_rawDesc), len(file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_rawDesc)),
125 > NumEnums: 0,
126 > NumMessages: 1,
127 > NumExtensions: 0,
128 > NumServices: 0,
129 > },
130 > GoTypes: file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_goTypes,
131 > DependencyIndexes: file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_depIdxs,
132 > MessageInfos: file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_msgTypes,
133 > }.Build()
134 > File_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto = out.File
135 > file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_goTypes = nil
136 > file_temporal_server_chasm_lib_workflow_proto_v1_update_state_proto_depIdxs = nil
137 }
go.temporal.io/server/common/util/wildcard.go 20 covered LOC · 7 ranges

Open complete file

18 // WildCardStringToRegexps converts a given slices of string patterns to a slice of regular expressions matching
19 // wildcards (*) with any substring.
20 > func WildCardStringsToRegexp(patterns []string) (*regexp.Regexp, error) { wildcard.go
21 > var result strings.Builder
22 > result.WriteRune('^')
23 > for i, pattern := range patterns {
24 > result.WriteRune('(')
25 > first := true
26 > for literal := range strings.SplitSeq(pattern, "*") {
27 > if !first {
28 // Replace * with .*
29 result.WriteString(".*")
30 }
31 > result.WriteString(regexp.QuoteMeta(literal)) wildcard.go
32 > first = false
33 }
34 > result.WriteRune(')') wildcard.go
35 > if i < len(patterns)-1 {
36 > result.WriteRune('|') wildcard.go
37 > }
38 }
39 > result.WriteRune('$') wildcard.go
40 > return regexp.Compile(result.String())
41 }
42
43 // MustWildCardStringsToRegexp is like WildCardStringsToRegexp but panics on error.
44 > func MustWildCardStringsToRegexp(patterns []string) *regexp.Regexp { wildcard.go
45 > re, err := WildCardStringsToRegexp(patterns)
46 > if err != nil {
47 panic(err) //nolint:forbidigo // Must* functions conventionally panic on error.
48 }
49 > return re wildcard.go
50 }
go.temporal.io/server/common/dynamicconfig/collection.go 18 covered LOC · 3 ranges

Open complete file

676 // treat the fields independently), or the zero value of its type (if you want to treat the fields
677 // as a group and default unset fields to zero).
678 > func ConvertStructure[T any](def T) func(v any) (T, error) { collection.go
679 > return func(v any) (T, error) {
680 > // if we already have the right type, no conversion is necessary
681 > if typedV, ok := v.(T); ok {
682 return typedV, nil
683 }
685 // Deep-copy the default and decode over it. This allows using e.g. a struct with some
686 // default fields filled in and a config that only set some fields.
687 > out := deepCopyForMapstructure(def) collection.go
688 >
689 > dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
690 > Result: &out,
691 > DecodeHook: mapstructure.ComposeDecodeHookFunc(
692 > mapstructureHookDuration,
693 > mapstructureHookTimestamp,
694 > mapstructureHookProtoEnum,
695 > mapstructureHookGeneric,
696 > ),
697 > })
698 > if err != nil {
699 return out, err
700 }
701 > err = dec.Decode(v) collection.go
702 > return out, err
703 }
704 }
go.temporal.io/server/common/persistence/cassandra/helpers.go 16 covered LOC · 5 ranges

Open complete file

12
13 // CreateCassandraKeyspace creates the keyspace using this session for given replica count
14 > func CreateCassandraKeyspace(s gocql.Session, keyspace string, replicas int, overwrite bool, logger log.Logger) (err error) { helpers.go
15 > // if overwrite flag is set, drop the keyspace and create a new one
16 > if overwrite {
17 > err = DropCassandraKeyspace(s, keyspace, logger)
18 > if err != nil {
19 logger.Error("drop keyspace error", tag.Error(err))
20 return
21 }
22 }
23 > err = s.Query(fmt.Sprintf(`CREATE KEYSPACE IF NOT EXISTS %s WITH replication = { helpers.go
24 > 'class' : 'SimpleStrategy', 'replication_factor' : %d}`, keyspace, replicas)).Exec()
25 > if err != nil {
26 logger.Error("create keyspace error", tag.Error(err))
27 return
28 }
29 > logger.Debug("created keyspace", tag.Value(keyspace)) helpers.go
30 >
31 > return
32 }
33
34 // DropCassandraKeyspace drops the given keyspace, if it exists
35 > func DropCassandraKeyspace(s gocql.Session, keyspace string, logger log.Logger) (err error) { helpers.go
36 > err = s.Query(fmt.Sprintf("DROP KEYSPACE IF EXISTS %s", keyspace)).Exec()
37 > if err != nil {
38 logger.Error("drop keyspace error", tag.Error(err))
39 return
40 }
41 > logger.Debug("dropped keyspace", tag.Value(keyspace)) helpers.go
42 > return
43 }
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/gocql/batch.go 16 covered LOC · 4 ranges

Open complete file

26 session *session,
27 gocqlBatch *gocql.Batch,
28 > ) *Batch { batch.go
29 > return &Batch{
30 > session: session,
31 > gocqlBatch: gocqlBatch,
32 > }
33 > }
34
35 > func (b *Batch) Query(stmt string, args ...any) { batch.go
36 > b.gocqlBatch.Query(stmt, args...)
37 > }
38
39 > func (b *Batch) WithContext(ctx context.Context) *Batch { batch.go
40 > return newBatch(b.session, b.gocqlBatch.WithContext(ctx))
41 > }
42
43 func (b *Batch) WithTimestamp(timestamp int64) *Batch {
46 }
47
48 > func mustConvertBatchType(batchType BatchType) gocql.BatchType { batch.go
49 > switch batchType {
50 > case LoggedBatch:
51 > return gocql.LoggedBatch
52 case UnloggedBatch:
53 return gocql.UnloggedBatch
go.temporal.io/server/common/testing/protorequire/require.go 16 covered LOC · 8 ranges

Open complete file

38 }
39
40 > func New(t require.TestingT) ProtoAssertions { require.go
41 > return ProtoAssertions{t}
42 > }
43
44 // ProtoEqual compares two proto messages for equality using proto semantics. Options can be passed to customize
45 // comparison behavior, e.g. protorequire.IgnoreFields to exclude specific fields.
46 > func ProtoEqual(t require.TestingT, a proto.Message, b proto.Message, opts ...Option) { require.go
47 > if th, ok := t.(helper); ok {
48 > th.Helper() require.go
49 > }
50 > cfg := &config{} require.go
51 > for _, opt := range opts {
52 opt(a, cfg)
53 }
54 > cmpOpts := append([]cmp.Option{protocmp.Transform()}, cfg.cmpOpts...) require.go
55 > if diff := cmp.Diff(a, b, cmpOpts...); diff != "" {
56 require.Fail(t, fmt.Sprintf("Proto mismatch (-want +got):\n%v", diff))
57 }
129 }
130
131 > func (x ProtoAssertions) ProtoEqual(a proto.Message, b proto.Message, opts ...Option) { require.go
132 > if th, ok := x.t.(helper); ok {
133 > th.Helper() require.go
134 > }
135 > ProtoEqual(x.t, a, b, opts...) require.go
136 }
137
go.temporal.io/server/common/log/tag/zap_tag.go 15 covered LOC · 3 ranges

Open complete file

44 }
45
46 > func NewStringTag(key string, value string) ZapTag { zap_tag.go
47 > return ZapTag{
48 > field: zap.String(key, value),
49 > }
50 > }
51
52 func NewStringsTag(key string, value []string) ZapTag {
118 }
119
120 > func NewBoolTag(key string, value bool) ZapTag { zap_tag.go
121 > return ZapTag{
122 > field: zap.Bool(key, value),
123 > }
124 > }
125
126 func NewErrorTag(key string, value error) ZapTag {
154 }
155
156 > func NewAnyTag(key string, value any) ZapTag { zap_tag.go
157 > return ZapTag{
158 > field: zap.Any(key, value),
159 > }
160 > }
161
162 func NewBinaryTag(key string, value []byte) ZapTag {
go.temporal.io/server/common/namespace/replication_resolver.go 15 covered LOC · 2 ranges

Open complete file

49 }
50
51 > func NewDefaultReplicationResolverFactory() ReplicationResolverFactory { replication_resolver.go
52 > return func(detail *persistencespb.NamespaceDetail) ReplicationResolver {
53 > // By convention, a namespace with non-zero failover version is a global namespace
54 > // This can be overridden by WithGlobalFlag mutation if needed
55 > isGlobal := detail.FailoverVersion != 0
56 > return &defaultReplicationResolver{
57 > replicationConfig: detail.ReplicationConfig,
58 > isGlobalNamespace: isGlobal,
59 > failoverVersion: detail.FailoverVersion,
60 > failoverNotificationVersion: detail.FailoverNotificationVersion,
61 > }
62 > }
63 }
64
112 }
113
114 > func (r *defaultReplicationResolver) SetGlobalFlag(isGlobal bool) { replication_resolver.go
115 > r.isGlobalNamespace = isGlobal
116 > }
117
118 func (r *defaultReplicationResolver) SetActiveCluster(clusterName string) {
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/gocql/iter.go 15 covered LOC · 5 ranges

Open complete file

10 }
11
12 > func newIter(session *session, gocqlIter *gocql.Iter) *iter { iter.go
13 > return &iter{
14 > session: session,
15 > gocqlIter: gocqlIter,
16 > }
17 > }
18
19 func (it *iter) Scan(dest ...any) bool {
21 }
22
23 > func (it *iter) MapScan(m map[string]any) bool { iter.go
24 > return it.gocqlIter.MapScan(m)
25 > }
26
27 > func (it *iter) PageState() []byte { iter.go
28 > return it.gocqlIter.PageState()
29 > }
30
31 > func (it *iter) Close() (retError error) { iter.go
32 > defer func() { it.session.handleError(retError) }()
33
34 > return it.gocqlIter.Close() iter.go
35 }
go.temporal.io/server/common/persistence/visibility/store/sql/query_converter_util_legacy.go 15 covered LOC · 3 ranges

Open complete file

68 }
69
70 > func newColName(name string) *colName { query_converter_util_legacy.go
71 > return &colName{Name: name}
72 > }
73
74 func newSAColName(
77 fieldName string,
78 valueType enumspb.IndexedValueType,
79 > ) *saColName { query_converter_util_legacy.go
80 > return &saColName{
81 > dbColName: newColName(dbColName),
82 > alias: alias,
83 > fieldName: fieldName,
84 > valueType: valueType,
85 > }
86 > }
87
88 func newFuncExpr(name string, exprs ...sqlparser.Expr) *sqlparser.FuncExpr {
105 }
106
107 > func getMaxDatetimeValue() time.Time { query_converter_util_legacy.go
108 > t, _ := time.Parse(time.RFC3339, "9999-12-31T23:59:59Z")
109 > return t
110 > }
111
112 // formatComparisonExprStringForError formats comparison expression after
go.temporal.io/server/common/build/build.go 14 covered LOC · 2 ranges

Open complete file

27 )
28
29 > func init() { build.go
30 > buildInfo, ok := debug.ReadBuildInfo()
31 > if !ok {
32 return
33 }
34
35 > InfoData.Available = true build.go
36 > InfoData.GoVersion = buildInfo.GoVersion
37 >
38 > for _, setting := range buildInfo.Settings {
39 > switch setting.Key {
40 > case "GOARCH":
41 > InfoData.GoArch = setting.Value
42 > case "GOOS":
43 > InfoData.GoOs = setting.Value
44 > case "CGO_ENABLED":
45 > InfoData.CgoEnabled = setting.Value == "1"
46 case "vcs.revision":
47 InfoData.GitRevision = setting.Value
go.temporal.io/server/common/convert/convert.go 14 covered LOC · 6 ranges

Open complete file

60 func StringSetToSlice(
61 inputs map[string]struct{},
62 > ) []string { convert.go
63 > outputs := make([]string, len(inputs))
64 > i := 0
65 > for item := range inputs {
66 > outputs[i] = item convert.go
67 > i++
68 > }
69 > return outputs convert.go
70 }
71 func StringSliceToSet(
72 inputs []string,
73 > ) map[string]struct{} { convert.go
74 > outputs := make(map[string]struct{}, len(inputs))
75 > for _, item := range inputs {
76 > outputs[item] = struct{}{} convert.go
77 > }
78 > return outputs convert.go
79 }
go.temporal.io/server/common/dynamicconfig/gradual_change.go 14 covered LOC · 3 ranges

Open complete file

25 // StaticGradualChange returns a GradualChange whose Value always returns def and whose When
26 // always returns a time in the past.
27 > func StaticGradualChange[T any](def T) GradualChange[T] { gradual_change.go
28 > return GradualChange[T]{New: def}
29 > }
30
31 // Value returns the value for the given key at the given time.
56 // of type GradualChange into a GradualChange.
57 // nolint:revive // cognitive-complexity // this looks complicated but each case is fairly simple
58 > func ConvertGradualChange[T any](def T) func(v any) (GradualChange[T], error) { gradual_change.go
59 > changeConverter := ConvertStructure(StaticGradualChange(def))
60 >
61 > // Call this once so that if it's going to panic, it panics at static init time.
62 > _, _ = changeConverter(nil)
63 >
64 > switch reflect.TypeFor[T]() {
65 > case reflect.TypeFor[bool]():
66 > return func(v any) (GradualChange[T], error) {
67 if b, err := convertBool(v); err == nil {
68 var change GradualChange[T]
72 return changeConverter(v)
73 }
74 > case reflect.TypeFor[int](): gradual_change.go
75 > return func(v any) (GradualChange[T], error) {
76 if i, err := convertInt(v); err == nil {
77 var change GradualChange[T]
go.temporal.io/server/common/persistence/json_history_token_serializer.go 14 covered LOC · 2 ranges

Open complete file

23
24 // newJSONHistoryTokenSerializer creates a new instance of TaskTokenSerializer
25 > func newJSONHistoryTokenSerializer() *jsonHistoryTokenSerializer { json_history_token_serializer.go
26 > return &jsonHistoryTokenSerializer{}
27 > }
28
29 func (t *historyPagingToken) SetRangeIndexes(
49 defaultLastNodeID int64,
50 defaultLastTransactionID int64,
51 > ) (*historyPagingToken, error) { json_history_token_serializer.go
52 >
53 > if len(data) == 0 {
54 > token := historyPagingToken{
55 > LastEventID: defaultLastEventID,
56 > CurrentRangeIndex: notStartedIndex,
57 > LastNodeID: defaultLastNodeID,
58 > LastTransactionID: defaultLastTransactionID,
59 > }
60 > return &token, nil
61 > }
62
63 token := historyPagingToken{}
go.temporal.io/server/common/dynamicconfig/shared_structure.go 13 covered LOC · 5 ranges

Open complete file

17 )
18
19 > func warnDefaultSharedStructure(key string, def any) { shared_structure.go
20 > if path := hasSharedStructure(reflect.ValueOf(def), "root"); path != "" {
21 sharedStructureWarnings.Store(key, path)
22 }
42 }
43
44 > func hasSharedStructure(v reflect.Value, path string) string { shared_structure.go
45 > // nolint:exhaustive // deliberately not exhaustive
46 > switch v.Kind() {
47 > case reflect.Map, reflect.Slice, reflect.Pointer:
48 > if !v.IsNil() {
49 return path
50 }
51 > case reflect.Interface: shared_structure.go
52 > if !v.IsNil() {
53 return hasSharedStructure(v.Elem(), path)
54 }
55 > case reflect.Struct: shared_structure.go
56 > for i := range v.NumField() {
57 > if p := hasSharedStructure(v.Field(i), path+"."+v.Type().Field(i).Name); p != "" {
58 return p
59 }
go.temporal.io/server/service/history/tasks/category.go 13 covered LOC · 3 ranges

Open complete file

88 )
89
90 > func NewCategory(id int, cType CategoryType, name string) Category { category.go
91 > return Category{
92 > id: id,
93 > cType: cType,
94 > name: name,
95 > }
96 > }
97
98 > func (c Category) ID() int { category.go
99 > return c.id
100 > }
101
102 > func (c Category) Name() string { category.go
103 > return c.name
104 > }
105
106 func (c Category) Type() CategoryType {
go.temporal.io/server/common/persistence/visibility/store/elasticsearch/visibility_store.go 12 covered LOC · 3 ranges

Open complete file

101 }
102
103 > defaultSorter = func() []elastic.Sorter { visibility_store.go
104 > ret := make([]elastic.Sorter, 0, len(defaultSorterFields))
105 > for _, item := range defaultSorterFields {
106 > fs := elastic.NewFieldSort(item.name)
107 > if item.desc {
108 > fs.Desc()
109 > }
110 > if item.missing_first {
111 > fs.Missing("_first")
112 > } else {
113 fs.Missing("_last")
114 }
115 > ret = append(ret, fs) visibility_store.go
116 }
117 > return ret visibility_store.go
118 }()
119
go.temporal.io/server/common/persistence/versionhistory/version_histories.go 11 covered LOC · 5 ranges

Open complete file

32
33 // GetVersionHistory gets the VersionHistory according to index provided.
34 > func GetVersionHistory(h *historyspb.VersionHistories, index int32) (*historyspb.VersionHistory, error) { version_histories.go
35 > if index < 0 || index >= int32(len(h.Histories)) {
36 return nil, serviceerror.NewInternal("version histories index is out of range.")
37 }
38
39 > return h.Histories[index], nil version_histories.go
40 }
41
159
160 // FindFirstVersionHistoryIndexByVersionHistoryItem find the first VersionHistory index which contains the given version history item.
161 > func FindFirstVersionHistoryIndexByVersionHistoryItem(h *historyspb.VersionHistories, item *historyspb.VersionHistoryItem) (int32, error) { version_histories.go
162 > for versionHistoryIndex, history := range h.Histories {
163 > if ContainsVersionHistoryItem(history, item) {
164 > return int32(versionHistoryIndex), nil version_histories.go
165 > }
166 }
167 return 0, serviceerror.NewInternalf("version histories does not contains given item: %v, %v", item, h)
179
180 // GetCurrentVersionHistory gets the current VersionHistory.
181 > func GetCurrentVersionHistory(h *historyspb.VersionHistories) (*historyspb.VersionHistory, error) { version_histories.go
182 > return GetVersionHistory(h, h.GetCurrentVersionHistoryIndex())
183 > }
184
185 // IsCurrentVersionHistoryEmpty checks if the current VersionHistory is empty.
go.temporal.io/server/common/shuffle/shuffle.go 11 covered LOC · 2 ranges

Open complete file

5 )
6
7 > func String(str string) string { shuffle.go
8 > return string(Bytes([]byte(str)))
9 > }
10
11 > func Bytes(slice []byte) []byte { shuffle.go
12 > result := make([]byte, len(slice))
13 > copy(result, slice)
14 >
15 > rand.Shuffle(len(result), func(i, j int) {
16 > result[i], result[j] = result[j], result[i]
17 > })
18 > return result
19 }
go.temporal.io/server/common/metrics/defs_base.go 10 covered LOC · 1 range

Open complete file

10 }
11
12 > func newMetricDefinition(name string, opts ...Option) metricDefinition { defs_base.go
13 > d := metricDefinition{
14 > name: name,
15 > description: "",
16 > unit: "",
17 > }
18 > for _, opt := range opts {
19 > opt.apply(&d)
20 > }
21 > return d
22 }
23
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/gocql/uuid.go 10 covered LOC · 2 ranges

Open complete file

10 func UUIDToString(
11 item any,
12 > ) string { uuid.go
13 > return item.(gocql.UUID).String()
14 > }
15
16 func UUIDsToStringSlice(
17 item any,
18 > ) []string { uuid.go
19 > uuids := item.([]gocql.UUID)
20 > results := make([]string, len(uuids))
21 > for i, uuid := range uuids {
22 > results[i] = uuid.String()
23 > }
24 > return results
25 }
26
go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/plugin.go 10 covered LOC · 1 range

Open complete file

36 var _ sqlplugin.Plugin = (*plugin)(nil)
37
38 > func init() { plugin.go
39 > sql.RegisterPlugin(PluginName, &plugin{
40 > driver: &driver.PQDriver{},
41 > queryConverter: &queryConverter{},
42 > })
43 > sql.RegisterPlugin(PluginNamePGX, &plugin{
44 > driver: &driver.PGXDriver{},
45 > queryConverter: &queryConverter{},
46 > })
47 > }
48
49 func (p *plugin) GetVisibilityQueryConverter() sqlplugin.VisibilityQueryConverter {
go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/visibility.go 10 covered LOC · 1 range

Open complete file

40 )
41
42 > func buildOnDuplicateKeyUpdate(fields ...string) string { visibility.go
43 > items := make([]string, len(fields))
44 > for i, field := range fields {
45 > items[i] = fmt.Sprintf("%s = excluded.%s", field, field)
46 > }
47 > return fmt.Sprintf(
48 > // The WHERE clause ensures that no update occurs if the version is behind the saved version.
49 > "ON CONFLICT (namespace_id, run_id) DO UPDATE SET %s WHERE executions_visibility.%s < EXCLUDED.%s",
50 > strings.Join(items, ", "), sqlplugin.VersionColumnName, sqlplugin.VersionColumnName,
51 > )
52 }
53
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/visibility.go 10 covered LOC · 1 range

Open complete file

42 )
43
44 > func buildOnDuplicateKeyUpdate(fields ...string) string { visibility.go
45 > items := make([]string, len(fields))
46 > for i, field := range fields {
47 > items[i] = fmt.Sprintf("%s = excluded.%s", field, field)
48 > }
49 > return fmt.Sprintf(
50 > // The WHERE clause ensures that no update occurs if the version is behind the saved version.
51 > "ON CONFLICT (namespace_id, run_id) DO UPDATE SET %s WHERE executions_visibility.%s < EXCLUDED.%s",
52 > strings.Join(items, ", "), sqlplugin.VersionColumnName, sqlplugin.VersionColumnName,
53 > )
54 }
55
go.temporal.io/server/common/persistence/sql/sqlplugin/visibility.go 10 covered LOC · 2 ranges

Open complete file

219 }
220
221 > func getDbFields() []string { visibility.go
222 > t := reflect.TypeFor[VisibilityRow]()
223 > dbFields := make([]string, t.NumField())
224 > for i := 0; i < t.NumField(); i++ {
225 > f := t.Field(i)
226 > dbFields[i] = f.Tag.Get("db")
227 > if dbFields[i] == "" {
228 > dbFields[i] = strcase.ToSnake(f.Name)
229 > }
230 }
231 > return dbFields visibility.go
232 }
233
go.temporal.io/server/common/persistence/visibility/store/query/util.go 10 covered LOC · 2 ranges

Open complete file

70 }
71
72 > func NewUnsafeSQLString(val string) *UnsafeSQLString { util.go
73 > return &UnsafeSQLString{Val: val}
74 > }
75
76 func NewColName(name string) *ColumnName {
78 }
79
80 > func NewSAColumn(alias string, fieldName string, valueType enumspb.IndexedValueType) *SAColumn { util.go
81 > return &SAColumn{
82 > Alias: alias,
83 > FieldName: fieldName,
84 > ValueType: valueType,
85 > }
86 > }
87
88 func NamespaceDivisionSAColumn() *SAColumn {
go.temporal.io/server/common/testing/fakedata/fakedata.go 10 covered LOC · 2 ranges

Open complete file

9 )
10
11 > func init() { fakedata.go
12 > // We need this option to prevent faker.FakeData from returning an error for any struct that has an interface{} field.
13 > faker.SetIgnoreInterface(true)
14 > // We need this option to prevent faker from taking a long time while generating random data for structs that have
15 > // map or slice fields. This is especially relevant for persistence.ShardInfo, which takes about 1s without this
16 > // option, but only ~100µs with it.
17 > if err := faker.SetRandomMapAndSliceMaxSize(2); err != nil {
18 panic(err)
19 }
24 // var shardInfo persistencespb.ShardInfo
25 // _ = fakedata.FakeStruct(&shardInfo)
26 > func FakeStruct(a any) error { fakedata.go
27 > return faker.FakeData(a)
28 > }
go.temporal.io/server/common/persistence/data_interfaces.go 9 covered LOC · 4 ranges

Open complete file

1408 // UnixMilliseconds returns t as a Unix time, the number of milliseconds elapsed since January 1, 1970 UTC.
1409 // It should be used for all CQL timestamp.
1410 > func UnixMilliseconds(t time.Time) int64 { data_interfaces.go
1411 > // Handling zero time separately because UnixNano is undefined for zero times.
1412 > if t.IsZero() {
1413 return 0
1414 }
1415
1416 > unixNano := t.UnixNano() data_interfaces.go
1417 > if unixNano < 0 {
1418 // Time is before January 1, 1970 UTC
1419 return 0
1420 }
1421 > return unixNano / int64(time.Millisecond) data_interfaces.go
1422 }
1423
1424 // BuildHistoryGarbageCleanupInfo combine the workflow identity information into a string
1425 > func BuildHistoryGarbageCleanupInfo(namespaceID, workflowID, runID string) string { data_interfaces.go
1426 > return fmt.Sprintf("%v:%v:%v", namespaceID, workflowID, runID)
1427 > }
1428
1429 // SplitHistoryGarbageCleanupInfo returns workflow identity information
go.temporal.io/server/common/persistence/sql/sqlplugin/util.go 9 covered LOC · 2 ranges

Open complete file

5 )
6
7 > func appendPrefix(prefix string, fields []string) []string { util.go
8 > out := make([]string, len(fields))
9 > for i, field := range fields {
10 > out[i] = prefix + field
11 > }
12 > return out
13 }
14
15 > func BuildNamedPlaceholder(fields ...string) string { util.go
16 > return strings.Join(appendPrefix(":", fields), ", ")
17 > }
go.temporal.io/server/common/primitives/timestamp/duration.go 9 covered LOC · 3 ranges

Open complete file

26 }
27
28 > func DurationPtr(td time.Duration) *durationpb.Duration { duration.go
29 > return durationpb.New(td)
30 > }
31
32 func MinDurationPtr(d1 *durationpb.Duration, d2 *durationpb.Duration) *durationpb.Duration {
47 }
48
49 > func DurationFromDays(d int32) *durationpb.Duration { duration.go
50 > return durationMultipleOf(int64(d), time.Hour*24)
51 > }
52
53 > func durationMultipleOf(amt int64, mult time.Duration) *durationpb.Duration { duration.go
54 > return DurationPtr(time.Duration(amt) * mult)
55 > }
56
57 // ValidateAndCapProtoDuration validates protobuf durations for two conditions:
go.temporal.io/server/common/testing/testhooks/test_impl.go 9 covered LOC · 2 ranges

Open complete file

89 var keyCounter atomic.Int64
90
91 > func newKey[T any, S any]() Key[T, S] { test_impl.go
92 > var zero S
93 > var s ScopeType
94 > switch any(zero).(type) {
95 > case namespace.ID, namespace.Name:
96 > s = ScopeNamespace
97 > case global:
98 > s = ScopeGlobal
99 default:
100 panic("testhooks: unknown scope type")
101 }
102 > return Key[T, S]{id: keyCounter.Add(1), scopeType: s} test_impl.go
103 }
go.temporal.io/server/common/namespace/mutate.go 8 covered LOC · 2 ranges

Open complete file

8 type mutationFunc func(*Namespace)
9
10 > func (f mutationFunc) apply(ns *Namespace) { mutate.go
11 > f(ns)
12 > }
13
14 // WithActiveCluster assigns the active cluster to a Namespace during a Clone
43
44 // WithGlobalFlag sets whether or not this Namespace is global.
45 > func WithGlobalFlag(b bool) Mutation { mutate.go
46 > return mutationFunc(
47 > func(ns *Namespace) {
48 > ns.replicationResolver.SetGlobalFlag(b)
49 > })
50 }
51
go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/visibility.go 8 covered LOC · 1 range

Open complete file

73 )
74
75 > func buildOnDuplicateKeyUpdate(fields ...string) string { visibility.go
76 > items := make([]string, len(fields))
77 > for i, field := range fields {
78 > // This line is to ensure that no update occurs (for any column) if the version is behind the saved version.
79 > items[i] = fmt.Sprintf("%v = IF(%v < VALUES(%v), VALUES(%v), %v)",
80 > field, sqlplugin.VersionColumnName, sqlplugin.VersionColumnName, field, field)
81 > }
82 > return fmt.Sprintf("ON DUPLICATE KEY UPDATE %s", strings.Join(items, ", "))
83 }
84
go.temporal.io/server/common/tasks/priority.go 8 covered LOC · 2 ranges

Open complete file

59 )
60
61 > func (p Priority) String() string { priority.go
62 > s, ok := PriorityName[p]
63 > if ok {
64 > return s
65 > }
66 return strconv.Itoa(int(p))
67 }
77 func getPriority(
78 class, subClass Priority,
79 > ) Priority { priority.go
80 > return class | subClass
81 > }
go.temporal.io/server/chasm/statemachine.go 7 covered LOC · 1 range

Open complete file

34 // The apply function is called after verifying the transition is possible but before setting the destination state,
35 // so it can inspect the current (source) state.
36 > func NewTransition[S comparable, SM StateMachine[S], E any](src []S, dst S, apply func(SM, MutableContext, E) error) Transition[S, SM, E] { statemachine.go
37 > return Transition[S, SM, E]{
38 > Sources: src,
39 > Destination: dst,
40 > apply: apply,
41 > }
42 > }
43
44 // Possible returns a boolean indicating whether the transition is possible for the current state.
go.temporal.io/server/common/definition/workflow_key.go 7 covered LOC · 1 range

Open complete file

19 workflowID string,
20 runID string,
21 > ) WorkflowKey { workflow_key.go
22 > return WorkflowKey{
23 > NamespaceID: namespaceID,
24 > WorkflowID: workflowID,
25 > RunID: runID,
26 > }
27 > }
28
29 func (k *WorkflowKey) GetNamespaceID() string {
go.temporal.io/server/common/dynamicconfig/registry.go 7 covered LOC · 3 ranges

Open complete file

17 )
18
19 > func register(s GenericSetting) { registry.go
20 > if globalRegistry.queried.Load() {
21 panic("dynamicconfig.New*Setting must only be called from static initializers")
22 }
23 > if globalRegistry.settings == nil { registry.go
24 > globalRegistry.settings = make(map[Key]GenericSetting)
25 > }
26 > if globalRegistry.settings[s.Key()] != nil {
27 // nolint:forbidigo // only called during static initialization
28 panic(fmt.Sprintf("duplicate registration of dynamic config key: %q", s.Key().String()))
29 }
30 > globalRegistry.settings[s.Key()] = s registry.go
31 }
32
go.temporal.io/server/common/log/zap_logger.go 7 covered LOC · 1 range

Open complete file

82
83 // NewZapLogger returns a new zap based logger from zap.Logger
84 > func NewZapLogger(zl *zap.Logger) *zapLogger { zap_logger.go
85 > return &zapLogger{
86 > zl: zl,
87 > skip: skipForZapLogger,
88 > baseZl: zl,
89 > }
90 > }
91
92 // BuildZapLogger builds and returns a new zap.Logger for this logging configuration
go.temporal.io/server/common/membership/grpc_resolver.go 7 covered LOC · 2 ranges

Open complete file

53 )
54
55 > func init() { grpc_resolver.go
56 > // This must be called in init to avoid race conditions.
57 > resolver.Register(&globalGrpcBuilder)
58 > }
59
60 // Most code should not use this, this is only exposed for code that has to recognize and use a
80 }
81
82 > func (m *grpcBuilder) Scheme() string { grpc_resolver.go
83 > return grpcResolverScheme
84 > }
85
86 func (m *grpcBuilder) getServiceResolver(u *url.URL) (ServiceResolver, error) {
go.temporal.io/server/common/persistence/data_blob.go 7 covered LOC · 2 ranges

Open complete file

8 // NewDataBlob returns a new DataBlob.
9 // TODO: return an UnknowEncodingType error with the actual type string when encodingTypeStr is invalid
10 > func NewDataBlob(data []byte, encodingTypeStr string) *commonpb.DataBlob { data_blob.go
11 > encodingType, err := enumspb.EncodingTypeFromString(encodingTypeStr)
12 > if err != nil {
13 // encodingTypeStr not valid, an error will be returned on deserialization
14 encodingType = enumspb.ENCODING_TYPE_UNSPECIFIED
15 }
16
17 > return &commonpb.DataBlob{ data_blob.go
18 > Data: data,
19 > EncodingType: encodingType,
20 > }
21 }
go.temporal.io/server/common/persistence/history_manager_util.go 7 covered LOC · 2 ranges

Open complete file

115
116 // GetBeginNodeID gets node id from last ancestor
117 > func GetBeginNodeID(bi *persistencespb.HistoryBranch) int64 { history_manager_util.go
118 > if len(bi.Ancestors) == 0 {
119 > // root branch
120 > return 1
121 > }
122 idx := len(bi.Ancestors) - 1
123 return bi.Ancestors[idx].GetEndNodeId()
124 }
125
126 > func sortAncestors(ans []*persistencespb.HistoryBranchRange) { history_manager_util.go
127 > if len(ans) > 0 {
128 // sort ans based onf EndNodeID so that we can set BeginNodeID
129 sort.Slice(ans, func(i, j int) bool { return (ans)[i].GetEndNodeId() < (ans)[j].GetEndNodeId() })
go.temporal.io/server/service/history/hsm/sm.go 7 covered LOC · 1 range

Open complete file

41 // NewTransition creates a new [Transition] from the given source states to a destination state for a given event.
42 // The apply function is called after verifying the transition is possible and setting the destination state.
43 > func NewTransition[S comparable, SM StateMachine[S], E any](src []S, dst S, apply func(SM, E) (TransitionOutput, error)) Transition[S, SM, E] { sm.go
44 > return Transition[S, SM, E]{
45 > Sources: src,
46 > Destination: dst,
47 > apply: apply,
48 > }
49 > }
50
51 // Possible returns a boolean indicating whether the transition is possible for the current state.
go.temporal.io/server/service/history/workflow/task_generator_provider.go 7 covered LOC · 2 ranges

Open complete file

23 )
24
25 > func init() { task_generator_provider.go
26 > var defaultProvider TaskGeneratorProvider = new(taskGeneratorProviderImpl)
27 > populateTaskGeneratorProvider(defaultProvider)
28 > }
29
30 > func populateTaskGeneratorProvider(provider TaskGeneratorProvider) { task_generator_provider.go
31 > _taskGeneratorProvider.Store(&provider)
32 > }
33
34 func GetTaskGeneratorProvider() TaskGeneratorProvider {
go.temporal.io/server/common/metrics/option.go 6 covered LOC · 2 ranges

Open complete file

10 type WithDescription string
11
12 > func (h WithDescription) apply(m *metricDefinition) { option.go
13 > m.description = string(h)
14 > }
15
16 // WithUnit sets the unit of a metric. See NewBytesHistogramDef for an example.
17 type WithUnit MetricUnit
18
19 > func (h WithUnit) apply(m *metricDefinition) { option.go
20 > m.unit = MetricUnit(h)
21 > }
go.temporal.io/server/common/persistence/cassandra/errors.go 6 covered LOC · 1 range

Open complete file

39 // We do it only for "type" field which is checked for `nil` value.
40 // All other fields are created automatically by gocql with non-pointer types (i.e. int).
41 > func newConflictRecord() map[string]any { errors.go
42 > t := new(int)
43 > return map[string]any{
44 > "type": &t,
45 > }
46 > }
47
48 func convertErrors(
go.temporal.io/server/common/persistence/cassandra/mutable_state_task_store.go 6 covered LOC · 1 range

Open complete file

168 )
169
170 > func NewMutableStateTaskStore(session gocql.Session, serializer serialization.Serializer) *MutableStateTaskStore { mutable_state_task_store.go
171 > return &MutableStateTaskStore{
172 > Session: session,
173 > serializer: serializer,
174 > }
175 > }
176
177 func (d *MutableStateTaskStore) AddHistoryTasks(
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/translator/fixed_address_translator.go 6 covered LOC · 2 ranges

Open complete file

15 )
16
17 > func init() { fixed_address_translator.go
18 > RegisterTranslator(fixedTranslatorName, NewFixedAddressTranslatorPlugin())
19 > }
20
21 type FixedAddressTranslatorPlugin struct {
22 }
23
24 > func NewFixedAddressTranslatorPlugin() TranslatorPlugin { fixed_address_translator.go
25 > return &FixedAddressTranslatorPlugin{}
26 > }
27
28 // GetTranslator What gocql driver does is that it will connect to the first node in the list in configuration
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/plugin.go 6 covered LOC · 1 range

Open complete file

43 }
44
45 > func init() { plugin.go
46 > sql.RegisterPlugin(PluginName, &plugin{
47 > queryConverter: &queryConverter{},
48 > connPool: newConnPool(),
49 > })
50 > }
51
52 func (p *plugin) GetVisibilityQueryConverter() sqlplugin.VisibilityQueryConverter {
go.temporal.io/server/common/persistence/versionhistory/version_history_item.go 6 covered LOC · 3 ranges

Open complete file

8
9 // NewVersionHistoryItem create a new instance of VersionHistoryItem.
10 > func NewVersionHistoryItem(eventID int64, version int64) *historyspb.VersionHistoryItem { version_history_item.go
11 > if eventID < 0 || version < 0 {
12 panic(fmt.Sprintf("invalid version history item event ID: %v, version: %v", eventID, version))
13 }
14
15 > return &historyspb.VersionHistoryItem{EventId: eventID, Version: version} version_history_item.go
16 }
17
18 // CopyVersionHistoryItem create a new instance of VersionHistoryItem.
19 > func CopyVersionHistoryItem(item *historyspb.VersionHistoryItem) *historyspb.VersionHistoryItem { version_history_item.go
20 > return NewVersionHistoryItem(item.EventId, item.Version)
21 > }
22
23 // IsEqualVersionHistoryItem checks whether version history items are equal
go.temporal.io/server/common/primitives/timestamp/time.go 6 covered LOC · 2 ranges

Open complete file

7 )
8
9 > func TimePtr(t time.Time) *timestamppb.Timestamp { time.go
10 > return timestamppb.New(t)
11 > }
12
13 func TimeValue(t *timestamppb.Timestamp) time.Time {
46 }
47
48 > func TimeNowPtrUtc() *timestamppb.Timestamp { time.go
49 > return TimePtr(time.Now().UTC())
50 > }
go.temporal.io/server/common/resolver/noop_resolver.go 6 covered LOC · 2 ranges

Open complete file

6 )
7
8 > func NewNoopResolver() *NoopResolver { noop_resolver.go
9 > return &NoopResolver{}
10 > }
11
12 > func (c *NoopResolver) Resolve(service string) []string { noop_resolver.go
13 > return []string{service}
14 > }
go.temporal.io/server/service/history/configs/task.go 6 covered LOC · 1 range

Open complete file

26 func ConvertWeightsToDynamicConfigValue(
27 weights map[tasks.Priority]int,
28 > ) map[string]any { task.go
29 > weightsForDC := make(map[string]any)
30 > for priority, weight := range weights {
31 > weightsForDC[priority.String()] = weight
32 > }
33 > return weightsForDC
34 }
35
go.temporal.io/server/service/history/tasks/key.go 6 covered LOC · 1 range

Open complete file

35 }
36
37 > func NewKey(fireTime time.Time, taskID int64) Key { key.go
38 > return Key{
39 > FireTime: fireTime,
40 > TaskID: taskID,
41 > }
42 > }
43
44 func ValidateKey(key Key) error {
go.temporal.io/server/chasm/lib/nexusoperation/config.go 5 covered LOC · 1 range

Open complete file

160 }
161
162 > func (cfg RetryPolicyConfig) build() backoff.RetryPolicy { config.go
163 > return backoff.NewExponentialRetryPolicy(cfg.InitialInterval).
164 > WithMaximumInterval(cfg.MaxInterval).
165 > WithExpirationInterval(backoff.NoInterval)
166 > }
167
168 var defaultRetryPolicyConfig = RetryPolicyConfig{
go.temporal.io/server/chasm/lib/scheduler/util.go 5 covered LOC · 1 range

Open complete file

26
27 // serializeConflictToken serializes a conflict token as a byte slice.
28 > func serializeConflictToken(conflictToken int64) []byte { util.go
29 > token := make([]byte, 8)
30 > binary.LittleEndian.PutUint64(token, uint64(conflictToken))
31 > return token
32 > }
33
34 // newTaggedLogger returns a logger tagged with the Scheduler's attributes.
go.temporal.io/server/common/metrics/noop_impl.go 5 covered LOC · 3 ranges

Open complete file

15 )
16
17 > func newNoopMetricsHandler() *noopMetricsHandler { return &noopMetricsHandler{} } noop_impl.go
18
19 // WithTags creates a new MetricProvder with provided []Tag
34
35 // Timer obtains a timer for the given name.
36 > func (*noopMetricsHandler) Timer(string) TimerIface { noop_impl.go
37 > return NoopTimerMetricFunc
38 > }
39
40 // Histogram obtains a histogram for the given name.
55 var NoopCounterMetricFunc = CounterFunc(func(i int64, t ...Tag) {})
56 var NoopGaugeMetricFunc = GaugeFunc(func(f float64, t ...Tag) {})
57 > var NoopTimerMetricFunc = TimerFunc(func(d time.Duration, t ...Tag) {}) noop_impl.go
58 var NoopHistogramMetricFunc = HistogramFunc(func(i int64, t ...Tag) {})
go.temporal.io/server/common/metrics/registry.go 5 covered LOC · 1 range

Open complete file

43
44 // register adds a metric definition to the list of pending metric definitions. This method is thread-safe.
45 > func (c *registry) register(d metricDefinition) { registry.go
46 > c.Lock()
47 > defer c.Unlock()
48 > c.definitions = append(c.definitions, d)
49 > }
50
51 // buildCatalog builds a catalog from the list of pending metric definitions. It is safe to call this method multiple
go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/plugin.go 5 covered LOC · 1 range

Open complete file

24 var _ sqlplugin.Plugin = (*plugin)(nil)
25
26 > func init() { plugin.go
27 > sql.RegisterPlugin(PluginName, &plugin{
28 > queryConverter: &queryConverter{},
29 > })
30 > }
31
32 func (p *plugin) GetVisibilityQueryConverter() sqlplugin.VisibilityQueryConverter {
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/conn_pool.go 5 covered LOC · 1 range

Open complete file

23 }
24
25 > func newConnPool() *connPool { conn_pool.go
26 > return &connPool{
27 > pool: make(map[string]entry),
28 > }
29 > }
30
31 // Allocate allocates the shared database in the pool or returns already exists instance with the same DSN. If instance
go.temporal.io/server/common/log/noop_logger.go 4 covered LOC · 2 ranges

Open complete file

10
11 // NewNoopLogger return a noopLogger
12 > func NewNoopLogger() *noopLogger { noop_logger.go
13 > return &noopLogger{}
14 > }
15
16 > func (n *noopLogger) Debug(string, ...tag.Tag) {} noop_logger.go
17 func (n *noopLogger) Info(string, ...tag.Tag) {}
18 func (n *noopLogger) Warn(string, ...tag.Tag) {}
go.temporal.io/server/common/persistence/sql/sqlplugin/mysql/typeconv.go 4 covered LOC · 2 ranges

Open complete file

33 }
34
35 > func getMinMySQLDateTime() time.Time { typeconv.go
36 > t, err := time.Parse(time.RFC3339, "1000-01-01T00:00:00Z")
37 > if err != nil {
38 return time.Unix(0, 0).UTC()
39 }
40 > return t.UTC() typeconv.go
41 }
go.temporal.io/server/common/persistence/sql/sqlplugin/postgresql/typeconv.go 4 covered LOC · 2 ranges

Open complete file

35 }
36
37 > func getMinPostgreSQLDateTime() time.Time { typeconv.go
38 > t, err := time.Parse(time.RFC3339, "1000-01-01T00:00:00Z")
39 > if err != nil {
40 return time.Unix(0, 0).UTC()
41 }
42 > return t.UTC() typeconv.go
43 }
go.temporal.io/server/common/persistence/sql/sqlplugin/sqlite/typeconv.go 4 covered LOC · 2 ranges

Open complete file

33 }
34
35 > func getMinSQLiteDateTime() time.Time { typeconv.go
36 > t, err := time.Parse(time.RFC3339, "1000-01-01T00:00:00Z")
37 > if err != nil {
38 return time.Unix(0, 0).UTC()
39 }
40 > return t.UTC() typeconv.go
41 }
go.temporal.io/server/common/util/util.go 4 covered LOC · 1 range

Open complete file

68
69 // InverseMap creates the inverse map, ie., for a key-value map, it builds the value-key map.
70 > func InverseMap[M ~map[K]V, K, V comparable](m M) map[V]K { util.go
71 > if m == nil {
72 > return nil
73 > }
74 invm := make(map[V]K, len(m))
75 for k, v := range m {
go.temporal.io/server/api/persistence/v1/predicates.go-helpers.pb.go 3 covered LOC · 1 range

Open complete file

17
18 // Size returns the size of the object, in bytes, once serialized
19 > func (val *Predicate) Size() int { predicates.go-helpers.pb.go
20 > return proto.Size(val)
21 > }
22
23 // Equal returns whether two Predicate values are equivalent by recursively
go.temporal.io/server/chasm/library.go 3 covered LOC · 1 range

Open complete file

56 // tasks within the CHASM framework.
57 // The format of the returned FQN is: "libName.name"
58 > func FullyQualifiedName(libName, name string) string { library.go
59 > return libName + "." + name
60 > }
go.temporal.io/server/chasm/registrable_component.go 3 covered LOC · 1 range

Open complete file

203 // The generated ID is used to uniquely identify components and tasks within the CHASM framework. The same FQN will
204 // always produce the same ID.
205 > func GenerateTypeID(fqn string) uint32 { registrable_component.go
206 > return farm.Fingerprint32([]byte(fqn))
207 > }
208
209 // hasBusinessIDAlias returns true if the component has a businessID alias configured
go.temporal.io/server/common/dynamicconfig/key.go 3 covered LOC · 1 range

Open complete file

13 )
14
15 > func MakeKey(s string) Key { key.go
16 > return Key{handle: unique.Make(strings.ToLower(s))}
17 > }
18
19 func (k Key) String() string {
go.temporal.io/server/common/membership/hostinfo.go 3 covered LOC · 1 range

Open complete file

12
13 // NewHostInfoFromAddress creates a new HostInfo instance from a socket address.
14 > func NewHostInfoFromAddress(address string) HostInfo { hostinfo.go
15 > return hostAddress(address)
16 > }
17
18 // hostAddress is a HostInfo implementation that uses a string as the address and identity.
go.temporal.io/server/common/payload/payload.go 3 covered LOC · 1 range

Open complete file

30 }
31
32 > func Encode(value any) (*commonpb.Payload, error) { payload.go
33 > return defaultDataConverter.ToPayload(value)
34 > }
35
36 func Decode(p *commonpb.Payload, valuePtr any) error {
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/gocql/errors.go 3 covered LOC · 1 range

Open complete file

64 }
65
66 > func IsNotFoundError(err error) bool { errors.go
67 > return errors.Is(err, gocql.ErrNotFound)
68 > }
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/translator/translator_plugin.go 3 covered LOC · 1 range

Open complete file

22 // RegisterPlugin adds an auth plugin to the plugin registry
23 // it is only safe to use from a package init function
24 > func RegisterTranslator(name string, plugin TranslatorPlugin) { translator_plugin.go
25 > translators[name] = plugin
26 > }
27
28 func LookupTranslator(name string) (TranslatorPlugin, error) {
go.temporal.io/server/common/persistence/persistence_rate_limited_clients.go 3 covered LOC · 1 range

Open complete file

go.temporal.io/server/common/persistence/sql/store.go 3 covered LOC · 2 ranges

Open complete file

19
20 // RegisterPlugin will register a SQL plugin
21 > func RegisterPlugin(pluginName string, plugin sqlplugin.Plugin) { store.go
22 > if _, ok := supportedPlugins[pluginName]; ok {
23 panic("plugin " + pluginName + " already registered")
24 }
25 > supportedPlugins[pluginName] = plugin store.go
26 }
27
go.temporal.io/server/common/softassert/softassert.go 3 covered LOC · 2 ranges

Open complete file

26 // Example:
27 // softassert.That(logger, object.state == "ready", "object is not ready")
28 > func That(logger log.Logger, condition bool, staticMessage string, tags ...tag.Tag) bool { softassert.go
29 > if !condition {
30 // By using the same prefix for all assertions, they can be reliably found in logs.
31 logger.Error("failed assertion: "+staticMessage, append([]tag.Tag{tag.FailedAssertion}, tags...)...)
32 }
33 > return condition softassert.go
34 }
35
go.temporal.io/server/service/history/queues/errors/errors.go 3 covered LOC · 1 range

Open complete file

39
40 // NewUnprocessableTaskError returns a new UnprocessableTaskError from given message.
41 > func NewUnprocessableTaskError(message string) *UnprocessableTaskError { errors.go
42 > return &UnprocessableTaskError{Message: message}
43 > }
44
45 func (e UnprocessableTaskError) Error() string {
go.temporal.io/server/common/log/panic.go 2 covered LOC · 1 range

Open complete file

13 // We have to use pointer is because in golang: "recover return nil if was not called directly by a deferred function."
14 // And we have to set the returned error otherwise our handler will return nil as error which is incorrect
15 > func CapturePanic(logger Logger, retError *error) { panic.go
16 > if panicObj := recover(); panicObj != nil {
17 err, ok := panicObj.(error)
18 if !ok {
go.temporal.io/server/common/persistence/client/fx.go 2 covered LOC · 1 range

Open complete file

224 }
225
226 > func managerProvider[T persistence.Closeable](newManagerFn func(Factory) (T, error)) func(Factory, fx.Lifecycle) (T, error) { fx.go
227 > return func(f Factory, lc fx.Lifecycle) (T, error) {
228 manager, err := newManagerFn(f) // passing receiver (Factory) as first argument.
229 if err != nil {
go.temporal.io/server/common/aggregate/noop_moving_window_average.go 1 covered LOC · 1 range

Open complete file

7 )
8
9 > func newNoopMovingWindowAverage() *noopMovingWindowAverage { return &noopMovingWindowAverage{} } noop_moving_window_average.go
10
11 func (a *noopMovingWindowAverage) Record(_ int64) {}
go.temporal.io/server/common/metrics/metrics.go 1 covered LOC · 1 range

Open complete file

82 func (c CounterFunc) Record(v int64, tags ...Tag) { c(v, tags...) }
83 func (c GaugeFunc) Record(v float64, tags ...Tag) { c(v, tags...) }
84 > func (c TimerFunc) Record(v time.Duration, tags ...Tag) { c(v, tags...) } metrics.go
85 func (c HistogramFunc) Record(v int64, tags ...Tag) { c(v, tags...) }
go.temporal.io/server/common/persistence/noop_health_signal_aggregator.go 1 covered LOC · 1 range

Open complete file

11 )
12
13 > func newNoopSignalAggregator() *noopSignalAggregator { return &noopSignalAggregator{} } noop_health_signal_aggregator.go
14
15 func (a *noopSignalAggregator) Start() {}