MCPcopy Index your code
hub / github.com/flant/shell-operator / deepCopy

Method deepCopy

pkg/task/task.go:70–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68}
69
70func (t *BaseTask) deepCopy() *BaseTask {
71 t.lock.RLock()
72 defer t.lock.RUnlock()
73
74 newTask := &BaseTask{
75 Id: t.Id,
76 Type: t.Type,
77 FailureCount: t.FailureCount,
78 FailureMessage: t.FailureMessage,
79 QueueName: t.QueueName,
80 QueuedAt: t.QueuedAt,
81 Metadata: t.Metadata,
82 }
83
84 // Deep copy LogLabels
85 newTask.LogLabels = make(map[string]string)
86 for k, v := range t.LogLabels {
87 newTask.LogLabels[k] = v
88 }
89
90 // Deep copy Props
91 newTask.Props = make(map[string]interface{})
92 for k, v := range t.Props {
93 newTask.Props[k] = v
94 }
95
96 // Copy atomic bool value
97 newTask.processing.Store(t.processing.Load())
98
99 return newTask
100}
101
102func (t *BaseTask) DeepCopyWithNewUUID() Task {
103 newTask := t.deepCopy()

Callers 1

DeepCopyWithNewUUIDMethod · 0.95

Calls 2

StoreMethod · 0.45
LoadMethod · 0.45

Tested by

no test coverage detected