MCPcopy
hub / github.com/perkeep/perkeep / enumerateQueuedBlobs

Method enumerateQueuedBlobs

pkg/server/sync.go:543–560  ·  view source on GitHub ↗

enumerateQueuedBlobs yields blobs from the on-disk sorted.KeyValue store. This differs from enumeratePendingBlobs, which sends from the in-memory pending list.

(dst chan<- blob.SizedRef, intr <-chan struct{})

Source from the content-addressed store, hash-verified

541// enumerateQueuedBlobs yields blobs from the on-disk sorted.KeyValue store.
542// This differs from enumeratePendingBlobs, which sends from the in-memory pending list.
543func (sh *SyncHandler) enumerateQueuedBlobs(dst chan<- blob.SizedRef, intr <-chan struct{}) error {
544 defer close(dst)
545 it := sh.queue.Find("", "")
546 for it.Next() {
547 br, ok := blob.Parse(it.Key())
548 size, err := strconv.ParseUint(it.Value(), 10, 32)
549 if !ok || err != nil {
550 sh.logf("ERROR: bogus sync queue entry: %q => %q", it.Key(), it.Value())
551 continue
552 }
553 select {
554 case dst <- blob.SizedRef{Ref: br, Size: uint32(size)}:
555 case <-intr:
556 return it.Close()
557 }
558 }
559 return it.Close()
560}
561
562func (sh *SyncHandler) runSync(syncType string, enumSrc func(chan<- blob.SizedRef, <-chan struct{}) error) int {
563 enumch := make(chan blob.SizedRef, 8)

Callers 1

readQueueToMemoryMethod · 0.95

Calls 7

logfMethod · 0.95
ParseFunction · 0.92
FindMethod · 0.65
NextMethod · 0.65
KeyMethod · 0.65
ValueMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected