Skip to content

Commit 678f944

Browse files
cpuguy83k8s-infra-cherrypick-robot
authored andcommitted
Revert "Implement io.ReaderAt on docker fetch reader"
This reverts commit 4bf1705. This caused issues for downstream clients who were wrapping the type contingent on it implementing io.ReaderAt. Consequently this is causing headaches due to increased round trips with the remote. Meanwhile I only added this as a convenience for implementing content.Provider in the remote which can done even without the original change, just... less conveniently. In hindsight, this was just a bad change as it has a rather wide impact and the actual implementation isn't an optimized ReaderAt. Signed-off-by: Brian Goff <[email protected]>
1 parent efd86f2 commit 678f944

1 file changed

Lines changed: 0 additions & 30 deletions

File tree

core/remotes/docker/httpreadseeker.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -103,36 +103,6 @@ func (hrs *httpReadSeeker) Close() error {
103103
return nil
104104
}
105105

106-
func (hrs *httpReadSeeker) ReadAt(p []byte, offset int64) (n int, err error) {
107-
if hrs.closed {
108-
return 0, fmt.Errorf("httpReadSeeker.ReadAt: closed: %w", errdefs.ErrUnavailable)
109-
}
110-
111-
if offset < 0 {
112-
return 0, fmt.Errorf("httpReadSeeker.ReadAt: negative offset: %w", errdefs.ErrInvalidArgument)
113-
}
114-
115-
if hrs.size != -1 && offset >= hrs.size {
116-
return 0, io.EOF
117-
}
118-
119-
if hrs.open == nil {
120-
return 0, fmt.Errorf("httpReadSeeker.ReadAt: cannot open: %w", errdefs.ErrNotImplemented)
121-
}
122-
123-
rc, err := hrs.open(offset)
124-
if err != nil {
125-
return 0, fmt.Errorf("httpReadSeeker.ReadAt: failed to open at offset %d: %w", offset, err)
126-
}
127-
defer func() {
128-
if closeErr := rc.Close(); closeErr != nil {
129-
log.L.WithError(closeErr).Error("httpReadSeeker.ReadAt: failed to close ReadCloser")
130-
}
131-
}()
132-
133-
return io.ReadFull(rc, p)
134-
}
135-
136106
func (hrs *httpReadSeeker) Seek(offset int64, whence int) (int64, error) {
137107
if hrs.closed {
138108
return 0, fmt.Errorf("Fetcher.Seek: closed: %w", errdefs.ErrUnavailable)

0 commit comments

Comments
 (0)