| 19 | 19 |
priority int // used by heap
|
| 20 | 20 |
index int // used by heap
|
| 21 | 21 |
|
| 22 | |
extendedLines int
|
| 23 | 22 |
toShutdown bool
|
| 24 | 23 |
toDrop bool
|
| 25 | 24 |
noPop bool
|
| 26 | 25 |
hasEwmaDecorators bool
|
| 27 | 26 |
operateState chan func(*bState)
|
| 28 | |
frameCh chan io.Reader
|
|
27 |
frameCh chan *frame
|
| 29 | 28 |
syncTableCh chan [][]chan int
|
| 30 | 29 |
completed chan bool
|
| 31 | 30 |
|
|
| 76 | 75 |
debugOut io.Writer
|
| 77 | 76 |
}
|
| 78 | 77 |
|
|
78 |
type frame struct {
|
|
79 |
reader io.Reader
|
|
80 |
lines int
|
|
81 |
}
|
|
82 |
|
| 79 | 83 |
func newBar(container *Progress, bs *bState) *Bar {
|
| 80 | 84 |
logPrefix := fmt.Sprintf("%sbar#%02d ", container.dlogger.Prefix(), bs.id)
|
| 81 | 85 |
ctx, cancel := context.WithCancel(container.ctx)
|
|
| 86 | 90 |
toDrop: bs.dropOnComplete,
|
| 87 | 91 |
noPop: bs.noPop,
|
| 88 | 92 |
operateState: make(chan func(*bState)),
|
| 89 | |
frameCh: make(chan io.Reader, 1),
|
|
93 |
frameCh: make(chan *frame, 1),
|
| 90 | 94 |
syncTableCh: make(chan [][]chan int, 1),
|
| 91 | 95 |
completed: make(chan bool, 1),
|
| 92 | 96 |
done: make(chan struct{}),
|
|
| 318 | 322 |
b.toShutdown = !b.toShutdown
|
| 319 | 323 |
b.recoveredPanic = p
|
| 320 | 324 |
}
|
| 321 | |
frame, lines := s.extender(nil, s.reqWidth, stat)
|
| 322 | |
b.extendedLines = lines
|
| 323 | |
b.frameCh <- frame
|
|
325 |
reader, lines := s.extender(nil, s.reqWidth, stat)
|
|
326 |
b.frameCh <- &frame{reader, lines}
|
| 324 | 327 |
b.dlogger.Println(p)
|
| 325 | 328 |
}
|
| 326 | 329 |
s.completeFlushed = s.completed
|
| 327 | 330 |
}()
|
| 328 | |
frame, lines := s.extender(s.draw(stat), s.reqWidth, stat)
|
| 329 | |
b.extendedLines = lines
|
|
331 |
reader, lines := s.extender(s.draw(stat), s.reqWidth, stat)
|
| 330 | 332 |
b.toShutdown = s.completed && !s.completeFlushed
|
| 331 | |
b.frameCh <- frame
|
|
333 |
b.frameCh <- &frame{reader, lines + 1}
|
| 332 | 334 |
}:
|
| 333 | 335 |
case <-b.done:
|
| 334 | 336 |
s := b.cacheState
|
|
| 337 | 339 |
if b.recoveredPanic == nil {
|
| 338 | 340 |
r = s.draw(stat)
|
| 339 | 341 |
}
|
| 340 | |
frame, lines := s.extender(r, s.reqWidth, stat)
|
| 341 | |
b.extendedLines = lines
|
| 342 | |
b.frameCh <- frame
|
|
342 |
reader, lines := s.extender(r, s.reqWidth, stat)
|
|
343 |
b.frameCh <- &frame{reader, lines + 1}
|
| 343 | 344 |
}
|
| 344 | 345 |
}
|
| 345 | 346 |
|