go.temporal.io/server/common/activityoptions/merge.go
129 LOC · 90 covered · 39 uncovered · 66 ranges · 55 concepts · 36 introducers · 27 tests
File neighbourhood
The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.
Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.
JavaScript is disabled; use the related-file, concept, and source links on this page to explore the same evidence.
Files with a broader (ancestor) concept 6
These files introduce code for a direct ancestor — a broader, larger-extent concept — of a concept that introduces code here.
Files with a narrower (descendant) concept 9
These files introduce code for a direct descendant — a narrower, larger-intent concept — of a concept that introduces code here.
1
package activityoptions
2
3
import (
4
activitypb "go.temporal.io/api/activity/v1"
5
commonpb "go.temporal.io/api/common/v1"
6
"go.temporal.io/api/serviceerror"
7
)
8
9
// MergeActivityOptions applies the fields specified in updateFields from mergeFrom into mergeInto in-place.
10
// updateFields is a map of camelCase JSON field paths, as returned by util.ParseFieldMask
11
// Returns an error if a required parent field (TaskQueue, Priority, RetryPolicy) is nil in mergeFrom
12
// when a sub-field of that parent is listed in updateFields.
13
//
14
//nolint:revive // cyclomatic: field-mask application requires explicit handling of each supported field
15
>
func MergeActivityOptions ( mergeInto , mergeFrom * activitypb . ActivityOptions , updateFields map [ string ] struct {}) error {
merge.go ×14
16
>
if _ , ok := updateFields [ "taskQueue.name" ]; ok {
18
>
return serviceerror . NewInvalidArgument ( "TaskQueue is not provided" )
merge.go ×9
19
>
}
21
>
mergeInto . TaskQueue = mergeFrom . GetTaskQueue ()
merge.go ×1
23
>
mergeInto . TaskQueue . Name = mergeFrom . GetTaskQueue (). GetName ()
merge.go ×1
24
>
}
25
}
26
27
>
if _ , ok := updateFields [ "scheduleToCloseTimeout" ]; ok {
merge.go ×14
28
>
mergeInto . ScheduleToCloseTimeout = mergeFrom . GetScheduleToCloseTimeout ()
merge.go ×1
29
>
}
30
31
>
if _ , ok := updateFields [ "scheduleToStartTimeout" ]; ok {
merge.go ×14
32
>
mergeInto . ScheduleToStartTimeout = mergeFrom . GetScheduleToStartTimeout ()
merge.go ×1
33
>
}
34
35
>
if _ , ok := updateFields [ "startToCloseTimeout" ]; ok {
merge.go ×14
36
>
mergeInto . StartToCloseTimeout = mergeFrom . GetStartToCloseTimeout ()
merge.go ×1
37
>
}
38
39
>
if _ , ok := updateFields [ "heartbeatTimeout" ]; ok {
merge.go ×14
40
>
mergeInto . HeartbeatTimeout = mergeFrom . GetHeartbeatTimeout ()
merge.go ×1
41
>
}
42
43
>
if _ , ok := updateFields [ "priority" ]; ok {
merge.go ×14
44
>
mergeInto . Priority = mergeFrom . GetPriority ()
merge.go ×1
45
>
}
46
47
>
if _ , ok := updateFields [ "priority.priorityKey" ]; ok {
merge.go ×14
49
>
return serviceerror . NewInvalidArgument ( "Priority is not provided" )
merge.go ×9
50
>
}
52
>
mergeInto . Priority = & commonpb . Priority {}
merge.go ×1
53
>
}
54
>
mergeInto . Priority . PriorityKey = mergeFrom . GetPriority (). GetPriorityKey ()
merge.go ×2
55
}
56
57
>
if _ , ok := updateFields [ "priority.fairnessKey" ]; ok {
merge.go ×14
59
>
return serviceerror . NewInvalidArgument ( "Priority is not provided" )
merge.go ×9
60
>
}
62
>
mergeInto . Priority = & commonpb . Priority {}
merge.go ×1
63
>
}
64
>
mergeInto . Priority . FairnessKey = mergeFrom . GetPriority (). GetFairnessKey ()
merge.go ×2
65
}
66
67
>
if _ , ok := updateFields [ "priority.fairnessWeight" ]; ok {
merge.go ×14
69
>
return serviceerror . NewInvalidArgument ( "Priority is not provided" )
merge.go ×9
70
>
}
72
>
mergeInto . Priority = & commonpb . Priority {}
merge.go ×1
73
>
}
74
>
mergeInto . Priority . FairnessWeight = mergeFrom . GetPriority (). GetFairnessWeight ()
merge.go ×2
75
}
76
77
>
if _ , ok := updateFields [ "retryPolicy" ]; ok {
merge.go ×14
78
>
if mergeFrom . GetRetryPolicy () == nil {
merge.go ×1
79
>
return serviceerror . NewInvalidArgument ( "RetryPolicy is not provided" )
merge.go ×9
80
>
}
81
>
mergeInto . RetryPolicy = mergeFrom . GetRetryPolicy ()
merge.go ×1
82
}
83
84
>
if _ , ok := updateFields [ "retryPolicy.initialInterval" ]; ok {
merge.go ×14
85
>
if mergeFrom . GetRetryPolicy () == nil {
merge.go ×1
86
>
return serviceerror . NewInvalidArgument ( "RetryPolicy is not provided" )
merge.go ×9
87
>
}
89
>
mergeInto . RetryPolicy = & commonpb . RetryPolicy {}
merge.go ×1
90
>
}
91
>
mergeInto . RetryPolicy . InitialInterval = mergeFrom . GetRetryPolicy (). GetInitialInterval ()
merge.go ×2
92
}
93
94
>
if _ , ok := updateFields [ "retryPolicy.backoffCoefficient" ]; ok {
merge.go ×14
95
>
if mergeFrom . GetRetryPolicy () == nil {
merge.go ×1
96
>
return serviceerror . NewInvalidArgument ( "RetryPolicy is not provided" )
merge.go ×9
97
>
}
99
>
mergeInto . RetryPolicy = & commonpb . RetryPolicy {}
merge.go ×1
100
>
}
101
>
mergeInto . RetryPolicy . BackoffCoefficient = mergeFrom . GetRetryPolicy (). GetBackoffCoefficient ()
merge.go ×2
102
}
103
104
>
if _ , ok := updateFields [ "retryPolicy.maximumInterval" ]; ok {
merge.go ×14
105
>
if mergeFrom . GetRetryPolicy () == nil {
merge.go ×1
106
>
return serviceerror . NewInvalidArgument ( "RetryPolicy is not provided" )
merge.go ×9
107
>
}
109
>
mergeInto . RetryPolicy = & commonpb . RetryPolicy {}
merge.go ×1
110
>
}
111
>
mergeInto . RetryPolicy . MaximumInterval = mergeFrom . GetRetryPolicy (). GetMaximumInterval ()
merge.go ×2
112
}
113
114
>
if _ , ok := updateFields [ "retryPolicy.maximumAttempts" ]; ok {
merge.go ×14
115
>
if mergeFrom . GetRetryPolicy () == nil {
merge.go ×1
116
>
return serviceerror . NewInvalidArgument ( "RetryPolicy is not provided" )
merge.go ×9
117
>
}
119
>
mergeInto . RetryPolicy = & commonpb . RetryPolicy {}
merge.go ×1
120
>
}
121
>
mergeInto . RetryPolicy . MaximumAttempts = mergeFrom . GetRetryPolicy (). GetMaximumAttempts ()
merge.go ×2
122
}
123
124
>
if _ , ok := updateFields [ "startDelay" ]; ok {
merge.go ×2
125
>
mergeInto . StartDelay = mergeFrom . GetStartDelay ()
merge.go ×1
126
>
}
127
129
}