mirror of
https://github.com/restic/restic.git
synced 2025-08-12 17:07:40 +00:00
Embed context into ReaderAt
The io.Reader interface does not support contexts, such that it is necessary to embed the context into the backendReaderAt struct. This has the problem that a reader might suddenly stop working when it's contained context is canceled. However, this is now problem here as the reader instances never escape the calling function.
This commit is contained in:
@@ -128,7 +128,7 @@ func TestUnpackReadSeeker(t *testing.T) {
|
||||
|
||||
handle := restic.Handle{Type: restic.PackFile, Name: id.String()}
|
||||
rtest.OK(t, b.Save(context.TODO(), handle, restic.NewByteReader(packData)))
|
||||
verifyBlobs(t, bufs, k, restic.ReaderAt(b, handle), packSize)
|
||||
verifyBlobs(t, bufs, k, restic.ReaderAt(context.TODO(), b, handle), packSize)
|
||||
}
|
||||
|
||||
func TestShortPack(t *testing.T) {
|
||||
@@ -141,5 +141,5 @@ func TestShortPack(t *testing.T) {
|
||||
|
||||
handle := restic.Handle{Type: restic.PackFile, Name: id.String()}
|
||||
rtest.OK(t, b.Save(context.TODO(), handle, restic.NewByteReader(packData)))
|
||||
verifyBlobs(t, bufs, k, restic.ReaderAt(b, handle), packSize)
|
||||
verifyBlobs(t, bufs, k, restic.ReaderAt(context.TODO(), b, handle), packSize)
|
||||
}
|
||||
|
Reference in New Issue
Block a user