MCPcopy Create free account
hub / github.com/plexdrive/plexdrive / checkChunk

Method checkChunk

chunk/manager.go:225–248  ·  view source on GitHub ↗
(req *Request, response chan Response)

Source from the content-addressed store, hash-verified

223}
224
225func (m *Manager) checkChunk(req *Request, response chan Response) {
226 if nil == response {
227 if nil == m.storage.Load(req.id) {
228 m.downloader.Download(req, nil)
229 }
230 return
231 }
232
233 if bytes := m.storage.Load(req.id); nil != bytes {
234 response <- Response{
235 Sequence: req.sequence,
236 Bytes: adjustResponseChunk(req, bytes),
237 }
238 return
239 }
240
241 m.downloader.Download(req, func(err error, bytes []byte) {
242 response <- Response{
243 Sequence: req.sequence,
244 Error: err,
245 Bytes: adjustResponseChunk(req, bytes),
246 }
247 })
248}
249
250func adjustResponseChunk(req *Request, bytes []byte) []byte {
251 if nil == bytes {

Callers 1

threadMethod · 0.95

Calls 3

adjustResponseChunkFunction · 0.85
LoadMethod · 0.80
DownloadMethod · 0.80

Tested by

no test coverage detected