MCPcopy
hub / github.com/docker/compose / update

Method update

cmd/display/tty.go:106–138  ·  cmd/display/tty.go::task.update

update adjusts task state based on last received event

(e api.Resource)

Source from the content-addressed store, hash-verified

104
105// update adjusts task state based on last received event
106func (t *task) update(e api.Resource) {
107 if e.ParentID != "" {
108 t.parents.Add(e.ParentID)
109 // we may receive same event from distinct parents (typically: images sharing layers)
110 // to avoid status to flicker, only accept updates from our first declared parent
111 if t.parent != e.ParentID {
112 return
113 }
114 }
115
116 // update task based on received event
117 switch e.Status {
118 case api.Done, api.Error, api.Warning:
119 if t.status != e.Status {
120 t.stop()
121 }
122 case api.Working:
123 t.hasMore()
124 }
125 t.status = e.Status
126 t.text = e.Text
127 t.details = e.Details
128 // progress can only go up
129 if e.Total > t.total {
130 t.total = e.Total
131 }
132 if e.Current > t.current {
133 t.current = e.Current
134 }
135 if e.Percent > t.percent {
136 t.percent = e.Percent
137 }
138}
139
140func (t *task) stop() {
141 t.endTime = time.Now()

Callers 1

eventMethod · 0.80

Calls 3

stopMethod · 0.95
hasMoreMethod · 0.95
AddMethod · 0.45

Tested by

no test coverage detected