(url string, event zsync.FetchEvent, err error)
| 385 | } |
| 386 | |
| 387 | func (p *progressReporter) progress(url string, event zsync.FetchEvent, err error) { |
| 388 | p.mu.Lock() |
| 389 | defer p.mu.Unlock() |
| 390 | if err != nil { |
| 391 | fmt.Fprintf(os.Stderr, "failed to complete download from %s: %v\n", url, err) |
| 392 | return |
| 393 | } |
| 394 | switch event { |
| 395 | case zsync.FetchStarted: |
| 396 | p.startTime = time.Now() |
| 397 | p.startBytes, _ = p.zs.Progress() |
| 398 | fmt.Fprintf(os.Stderr, "downloading new blocks from %s:\n", url) |
| 399 | case zsync.FetchEnded: |
| 400 | p.showProgress() |
| 401 | fmt.Fprintf(os.Stderr, "\n") |
| 402 | } |
| 403 | } |
no test coverage detected