remotes/docker: implement seekable http requests
To support resumable download, the fetcher for a remote must implement `io.Seeker`. If implemented the `content.Copy` function will detect the seeker and begin from where the download was terminated by a previous attempt. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:

committed by
Michael Crosby

parent
a9308e174d
commit
682151b166
@@ -2,7 +2,6 @@ package content
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"sync"
|
||||
|
||||
@@ -119,7 +118,7 @@ func seekReader(r io.Reader, offset, size int64) (io.Reader, error) {
|
||||
if ok {
|
||||
nn, err := seeker.Seek(offset, io.SeekStart)
|
||||
if nn != offset {
|
||||
return nil, fmt.Errorf("failed to seek to offset %v", offset)
|
||||
return nil, errors.Wrapf(err, "failed to seek to offset %v", offset)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user