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

Method String

pkg/task/queue/task_queue.go:1105–1122  ·  view source on GitHub ↗

TODO define mapping method with QueueAction to insert, modify and delete tasks. Dump tasks in queue to one line

()

Source from the content-addressed store, hash-verified

1103
1104// Dump tasks in queue to one line
1105func (q *TaskQueue) String() string {
1106 var buf strings.Builder
1107 var index int
1108
1109 qLen := q.Length()
1110
1111 q.IterateSnapshot(func(t task.Task) {
1112 fmt.Fprintf(&buf, "[%s,id=%10.10s]", t.GetDescription(), t.GetId())
1113 index++
1114 if index == qLen {
1115 return
1116 }
1117
1118 buf.WriteString(", ")
1119 })
1120
1121 return buf.String()
1122}
1123
1124func (q *TaskQueue) withLock(fn func()) {
1125 q.m.Lock()

Callers 15

processOneMethod · 0.95
NewTaskFunction · 0.45
DeepCopyWithNewUUIDMethod · 0.45
AddLastMethod · 0.45
StartMethod · 0.45
waitForTaskMethod · 0.45
IterateSnapshotMethod · 0.45
withLockMethod · 0.45
newBenchmarkTaskFunction · 0.45
DeepCopyWithNewUUIDMethod · 0.45
TestConcurrentOperationsFunction · 0.45
StartMethod · 0.45

Calls 4

LengthMethod · 0.95
IterateSnapshotMethod · 0.95
GetDescriptionMethod · 0.65
GetIdMethod · 0.65

Tested by 4

newBenchmarkTaskFunction · 0.36
DeepCopyWithNewUUIDMethod · 0.36
TestConcurrentOperationsFunction · 0.36
DeepCopyWithNewUUIDMethod · 0.36