Progress returns the momentarily progress for the puller
()
| 410 | |
| 411 | // Progress returns the momentarily progress for the puller |
| 412 | func (s *sharedPullerState) Progress() *PullerProgress { |
| 413 | s.mut.RLock() |
| 414 | defer s.mut.RUnlock() |
| 415 | total := s.reused + s.copyTotal + s.pullTotal |
| 416 | done := total - s.copyNeeded - s.pullNeeded |
| 417 | file := len(s.file.Blocks) |
| 418 | return &PullerProgress{ |
| 419 | Total: total, |
| 420 | Reused: s.reused, |
| 421 | CopiedFromOrigin: s.copyOrigin, |
| 422 | CopiedFromElsewhere: s.copyTotal - s.copyNeeded - s.copyOrigin, |
| 423 | Pulled: s.pullTotal - s.pullNeeded, |
| 424 | Pulling: s.pullNeeded, |
| 425 | BytesTotal: blocksToSize(total, file, s.file.BlockSize(), s.file.Size), |
| 426 | BytesDone: blocksToSize(done, file, s.file.BlockSize(), s.file.Size), |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | // Updated returns the time when any of the progress related counters was last updated. |
| 431 | func (s *sharedPullerState) Updated() time.Time { |
no test coverage detected