Add reader option to local content reader at#7414
Merged
estesp merged 1 commit intocontainerd:mainfrom Sep 22, 2022
Merged
Conversation
Allows optimized copying from a local content file into another file. Signed-off-by: Derek McGowan <[email protected]>
|
Skipping CI for Draft Pull Request. |
AkihiroSuda
reviewed
Sep 21, 2022
| func NewReader(ra ReaderAt) io.Reader { | ||
| rd := io.NewSectionReader(ra, 0, ra.Size()) | ||
| return rd | ||
| if rd, ok := ra.(reader); ok { |
Member
There was a problem hiding this comment.
Suggested change
| if rd, ok := ra.(reader); ok { | |
| if rd, ok := ra.(io.Reader); ok { |
Member
Author
There was a problem hiding this comment.
io.Reader doesn't help here since the instance cannot be type asserted to *os.File. It needs a new reader instance and ideally carrying the size data, which *LimitedReader does.
AkihiroSuda
approved these changes
Sep 21, 2022
kzys
approved these changes
Sep 22, 2022
This was referenced Feb 25, 2023
This was referenced Mar 7, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows optimized copying from a local content file into another file.
Using a
*LimitedReaderallows for an optimized copy file range to be performed when copying into a*os.Fileon Linux. Currently our custom type or use of section reader hide the source*os.File.See https://cs.opensource.google/go/go/+/refs/tags/go1.19.1:src/os/readfrom_linux.go;drc=f1b7b2fc52947711b8e78f7078c9e0bda35320d3;l=14