MCPcopy
hub / github.com/perkeep/perkeep / loggingBlobRefChannel

Function loggingBlobRefChannel

cmd/pk/sync.go:478–497  ·  view source on GitHub ↗
(ch <-chan blob.SizedRef)

Source from the content-addressed store, hash-verified

476}
477
478func loggingBlobRefChannel(ch <-chan blob.SizedRef) chan blob.SizedRef {
479 ch2 := make(chan blob.SizedRef)
480 go func() {
481 defer close(ch2)
482 var last time.Time
483 var nblob, nbyte int64
484 for v := range ch {
485 ch2 <- v
486 nblob++
487 nbyte += int64(v.Size)
488 now := time.Now()
489 if last.IsZero() || now.After(last.Add(1*time.Second)) {
490 last = now
491 log.Printf("At source blob %v (%d blobs, %d bytes)", v.Ref, nblob, nbyte)
492 }
493 }
494 log.Printf("Total blobs: %d, %d bytes", nblob, nbyte)
495 }()
496 return ch2
497}

Callers 1

doPassMethod · 0.85

Calls 2

PrintfMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected