MCPcopy
hub / github.com/syncthing/syncthing / Progress

Method Progress

lib/model/sharedpullerstate.go:412–428  ·  view source on GitHub ↗

Progress returns the momentarily progress for the puller

()

Source from the content-addressed store, hash-verified

410
411// Progress returns the momentarily progress for the puller
412func (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.
431func (s *sharedPullerState) Updated() time.Time {

Callers 2

BytesCompletedMethod · 0.80

Calls 2

blocksToSizeFunction · 0.85
BlockSizeMethod · 0.45

Tested by

no test coverage detected