-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
getContents function:
if index < len(availableChunks) {
chunkFile, _ := getSliceChunkFile(c, availableChunks[index])
if chunkFile != nil {
if err := checkChunkSize(c, chunkFile, idx); err != nil {
_ = chunkFile.Close()
_ = c.bucket.Discard(context.Background(), c.id)
return nil, 0, err
}
// Identify an anchor block and synchronize any missing blocks prior to the current index.
toByte := min(c.md.Size-1, uint64(availableChunks[index]*uint32(partSize))-1)
// Request is automatically cloned by getUpstreamReader
reader, err := c.getUpstreamReader(fromByte, toByte, true)
if err != nil {
_ = chunkFile.Close()
return nil, 0, err
}
return iobuf.PartsReadCloser(reader, chunkFile), int(availableChunks[index]-reqChunks[from]) + 1, nil
}
}
at
return iobuf.PartsReadCloser(reader, chunkFile), int(availableChunks[index]-reqChunks[from]) + 1, nil
the reader is passed to closer, so when first file chunk is removed, the resp body cannot read from uptream reader, then chunk file 。But only read from chunkfile .
iobuf.PartsReadCloser(reader, chunkFile), int(availableChunks[index]-reqChunks[from]) + 1, nil
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels