mirror of
https://github.com/restic/restic.git
synced 2025-04-21 22:31:28 +00:00
Add backend.ReaderAt
This commit is contained in:
parent
9f752b8306
commit
3fd1e4a992
19
src/restic/backend/readerat.go
Normal file
19
src/restic/backend/readerat.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package backend
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
type backendReaderAt struct {
|
||||||
|
be Backend
|
||||||
|
h Handle
|
||||||
|
}
|
||||||
|
|
||||||
|
func (brd backendReaderAt) ReadAt(p []byte, off int64) (n int, err error) {
|
||||||
|
return brd.be.Load(brd.h, p, off)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReaderAt returns an io.ReaderAt for a file in the backend.
|
||||||
|
func ReaderAt(be Backend, h Handle) io.ReaderAt {
|
||||||
|
return backendReaderAt{be: be, h: h}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user