globalJobProgressUpdater is the progressUpdater for GlobalJob-mode services. Because GlobalJob services are so much simpler than ReplicatedJob services, this updater is in turn simpler as well.
| 710 | // Because GlobalJob services are so much simpler than ReplicatedJob services, |
| 711 | // this updater is in turn simpler as well. |
| 712 | type globalJobProgressUpdater struct { |
| 713 | progressOut progress.Output |
| 714 | |
| 715 | // initialized is used to detect the first pass of update, and to perform |
| 716 | // first time initialization logic at that time. |
| 717 | initialized bool |
| 718 | |
| 719 | // total is the total number of tasks expected for this job |
| 720 | total int |
| 721 | |
| 722 | // progressDigits is the number of spaces to pad the numerator of the job |
| 723 | // progress field |
| 724 | progressDigits int |
| 725 | |
| 726 | taskNodes map[string]struct{} |
| 727 | } |
| 728 | |
| 729 | func (u *globalJobProgressUpdater) update(service swarm.Service, tasks []swarm.Task, activeNodes map[string]struct{}, _ bool) (bool, error) { |
| 730 | if !u.initialized { |
nothing calls this directly
no outgoing calls
no test coverage detected