MCPcopy
hub / github.com/perkeep/perkeep / subscribeToNewBlobs

Method subscribeToNewBlobs

pkg/search/handler.go:116–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114}
115
116func (h *Handler) subscribeToNewBlobs() {
117 ch := make(chan blob.Ref, buffered)
118 blobserver.GetHub(h.index).RegisterListener(ch)
119 go func() {
120 ctx := context.Background()
121 for br := range ch {
122 h.index.RLock()
123 bm, err := h.index.GetBlobMeta(ctx, br)
124 if err == nil {
125 h.wsHub.newBlobRecv <- bm.CamliType
126 }
127 h.index.RUnlock()
128 }
129 }()
130}
131
132func (h *Handler) SetCorpus(c *index.Corpus) {
133 h.corpus = c

Callers 1

NewHandlerFunction · 0.95

Calls 5

GetHubFunction · 0.92
RegisterListenerMethod · 0.65
RLockMethod · 0.65
GetBlobMetaMethod · 0.65
RUnlockMethod · 0.65

Tested by

no test coverage detected