MCPcopy Index your code
hub / github.com/perkeep/perkeep / loadAllChunksSync

Method loadAllChunksSync

pkg/schema/filereader.go:133–151  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

131}
132
133func (fr *FileReader) loadAllChunksSync(ctx context.Context) {
134 gate := syncutil.NewGate(20) // num readahead chunk loads at a time
135 fr.ForeachChunk(ctx, func(_ []blob.Ref, p BytesPart) error {
136 if !p.BlobRef.Valid() {
137 return nil
138 }
139 gate.Start()
140 go func(br blob.Ref) {
141 defer gate.Done()
142 rc, _, err := fr.fetcher.Fetch(ctx, br)
143 if err == nil {
144 defer rc.Close()
145 var b [1]byte
146 rc.Read(b[:]) // fault in the blob
147 }
148 }(p.BlobRef)
149 return nil
150 })
151}
152
153// UnixMtime returns the file schema's UnixMtime field, or the zero value.
154func (fr *FileReader) UnixMtime() time.Time {

Callers 1

LoadAllChunksMethod · 0.95

Calls 6

ForeachChunkMethod · 0.95
StartMethod · 0.65
FetchMethod · 0.65
CloseMethod · 0.65
ValidMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected