Codebase list golang-github-vbauerster-mpb / a7f7b8d
some godoc update Vladimir Bauer 2 years ago
1 changed file(s) with 14 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
8080 return bar
8181 }
8282
83 // ProxyReader wraps io.Reader with metrics required for progress tracking.
84 // If `r` is 'unknown total/size' reader it's mandatory to call
85 // (*Bar).SetTotal(-1, true) method after (io.Reader).Read returns io.EOF.
86 // If bar is already completed or aborted, returns nil.
83 // ProxyReader wraps io.Reader with metrics required for progress
84 // tracking. If `r` is 'unknown total/size' reader it's mandatory
85 // to call `(*Bar).SetTotal(-1, true)` after the wrapper returns
86 // `io.EOF`. If bar is already completed or aborted, returns nil.
8787 // Panics if `r` is nil.
8888 func (b *Bar) ProxyReader(r io.Reader) io.ReadCloser {
8989 if r == nil {
175175 }
176176 }
177177
178 // EnableTriggerComplete enables triggering complete event. It's
179 // effective only for bars which were constructed with `total <= 0` and
180 // after total has been set with (*Bar).SetTotal(int64, false). If bar
181 // has been incremented to the total, complete event is triggered right
182 // away.
178 // EnableTriggerComplete enables triggering complete event. It's effective
179 // only for bars which were constructed with `total <= 0` and after total
180 // has been set with `(*Bar).SetTotal(int64, false)`. If `curren >= total`
181 // at the moment of call, complete event is triggered right away.
183182 func (b *Bar) EnableTriggerComplete() {
184183 select {
185184 case b.operateState <- func(s *bState) {
198197 }
199198 }
200199
201 // SetTotal sets total to an arbitrary value. It's effective only for
202 // bar which was constructed with `total <= 0`. Setting total to negative
203 // value is equivalent to (*Bar).SetTotal((*Bar).Current(), bool) but faster.
204 // If triggerCompletion is true, total value is set to current and
205 // complete event is triggered right away.
200 // SetTotal sets total to an arbitrary value. It's effective only for bar
201 // which was constructed with `total <= 0`. Setting total to negative value
202 // is equivalent to `(*Bar).SetTotal((*Bar).Current(), bool)` but faster. If
203 // triggerCompletion is true, total value is set to current and complete
204 // event is triggered right away.
206205 func (b *Bar) SetTotal(total int64, triggerCompletion bool) {
207206 select {
208207 case b.operateState <- func(s *bState) {
342341 // Abort interrupts bar's running goroutine. Abort won't be engaged
343342 // if bar is already in complete state. If drop is true bar will be
344343 // removed as well. To make sure that bar has been removed call
345 // (*Bar).Wait method.
344 // `(*Bar).Wait()` method.
346345 func (b *Bar) Abort(drop bool) {
347346 select {
348347 case b.operateState <- func(s *bState) {