mark100PercentComplete marks the progress bars as 100% complete; it may do so by possibly advancing the current state if it is below the known total.
()
| 129 | // mark100PercentComplete marks the progress bars as 100% complete; |
| 130 | // it may do so by possibly advancing the current state if it is below the known total. |
| 131 | func (bar *progressBar) mark100PercentComplete() { |
| 132 | if bar.originalSize > 0 { |
| 133 | // We can't call bar.SetTotal even if we wanted to; the total can not be changed |
| 134 | // after a progress bar is created with a definite total. |
| 135 | bar.SetCurrent(bar.originalSize) // This triggers the completion condition. |
| 136 | } else { |
| 137 | // -1 = unknown size |
| 138 | // 0 is somewhat of a special case: Unlike c/image, where 0 is a definite known |
| 139 | // size (possible at least in theory), in mpb, zero-sized progress bars are treated |
| 140 | // as unknown size, in particular they are not configured to be marked as |
| 141 | // complete on bar.Current() reaching bar.total (because that would happen already |
| 142 | // when creating the progress bar). |
| 143 | // That means that we are both _allowed_ to call SetTotal, and we _have to_. |
| 144 | bar.SetTotal(-1, true) // total < 0 = set it to bar.Current(), report it; and mark the bar as complete. |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | // blobChunkAccessorProxy wraps a BlobChunkAccessor and updates a *progressBar |
| 149 | // with the number of received bytes. |
no outgoing calls
no test coverage detected