repository: remove further usages of repo.Backend()
This commit is contained in:
parent
8a425c2f0a
commit
d2c26e33f3
2 changed files with 5 additions and 5 deletions
|
@ -51,7 +51,7 @@ func CheckPack(ctx context.Context, r *Repository, id restic.ID, blobs []restic.
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkPackInner(ctx context.Context, r restic.Repository, id restic.ID, blobs []restic.Blob, size int64, bufRd *bufio.Reader, dec *zstd.Decoder) error {
|
func checkPackInner(ctx context.Context, r *Repository, id restic.ID, blobs []restic.Blob, size int64, bufRd *bufio.Reader, dec *zstd.Decoder) error {
|
||||||
|
|
||||||
debug.Log("checking pack %v", id.String())
|
debug.Log("checking pack %v", id.String())
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ func checkPackInner(ctx context.Context, r restic.Repository, id restic.ID, blob
|
||||||
var hash restic.ID
|
var hash restic.ID
|
||||||
var hdrBuf []byte
|
var hdrBuf []byte
|
||||||
h := backend.Handle{Type: backend.PackFile, Name: id.String()}
|
h := backend.Handle{Type: backend.PackFile, Name: id.String()}
|
||||||
err := r.Backend().Load(ctx, h, int(size), 0, func(rd io.Reader) error {
|
err := r.be.Load(ctx, h, int(size), 0, func(rd io.Reader) error {
|
||||||
hrd := hashing.NewReader(rd, sha256.New())
|
hrd := hashing.NewReader(rd, sha256.New())
|
||||||
bufRd.Reset(hrd)
|
bufRd.Reset(hrd)
|
||||||
|
|
||||||
|
|
|
@ -874,7 +874,7 @@ func (r *Repository) List(ctx context.Context, t restic.FileType, fn func(restic
|
||||||
func (r *Repository) ListPack(ctx context.Context, id restic.ID, size int64) ([]restic.Blob, uint32, error) {
|
func (r *Repository) ListPack(ctx context.Context, id restic.ID, size int64) ([]restic.Blob, uint32, error) {
|
||||||
h := backend.Handle{Type: restic.PackFile, Name: id.String()}
|
h := backend.Handle{Type: restic.PackFile, Name: id.String()}
|
||||||
|
|
||||||
entries, hdrSize, err := pack.List(r.Key(), backend.ReaderAt(ctx, r.Backend(), h), size)
|
entries, hdrSize, err := pack.List(r.Key(), backend.ReaderAt(ctx, r.be, h), size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if r.Cache != nil {
|
if r.Cache != nil {
|
||||||
// ignore error as there is not much we can do here
|
// ignore error as there is not much we can do here
|
||||||
|
@ -882,7 +882,7 @@ func (r *Repository) ListPack(ctx context.Context, id restic.ID, size int64) ([]
|
||||||
}
|
}
|
||||||
|
|
||||||
// retry on error
|
// retry on error
|
||||||
entries, hdrSize, err = pack.List(r.Key(), backend.ReaderAt(ctx, r.Backend(), h), size)
|
entries, hdrSize, err = pack.List(r.Key(), backend.ReaderAt(ctx, r.be, h), size)
|
||||||
}
|
}
|
||||||
return entries, hdrSize, err
|
return entries, hdrSize, err
|
||||||
}
|
}
|
||||||
|
@ -948,7 +948,7 @@ const maxUnusedRange = 1 * 1024 * 1024
|
||||||
// then LoadBlobsFromPack will abort and not retry it. The buf passed to the callback is only valid within
|
// then LoadBlobsFromPack will abort and not retry it. The buf passed to the callback is only valid within
|
||||||
// this specific call. The callback must not keep a reference to buf.
|
// this specific call. The callback must not keep a reference to buf.
|
||||||
func (r *Repository) LoadBlobsFromPack(ctx context.Context, packID restic.ID, blobs []restic.Blob, handleBlobFn func(blob restic.BlobHandle, buf []byte, err error) error) error {
|
func (r *Repository) LoadBlobsFromPack(ctx context.Context, packID restic.ID, blobs []restic.Blob, handleBlobFn func(blob restic.BlobHandle, buf []byte, err error) error) error {
|
||||||
return streamPack(ctx, r.Backend().Load, r.LoadBlob, r.getZstdDecoder(), r.key, packID, blobs, handleBlobFn)
|
return streamPack(ctx, r.be.Load, r.LoadBlob, r.getZstdDecoder(), r.key, packID, blobs, handleBlobFn)
|
||||||
}
|
}
|
||||||
|
|
||||||
func streamPack(ctx context.Context, beLoad backendLoadFn, loadBlobFn loadBlobFn, dec *zstd.Decoder, key *crypto.Key, packID restic.ID, blobs []restic.Blob, handleBlobFn func(blob restic.BlobHandle, buf []byte, err error) error) error {
|
func streamPack(ctx context.Context, beLoad backendLoadFn, loadBlobFn loadBlobFn, dec *zstd.Decoder, key *crypto.Key, packID restic.ID, blobs []restic.Blob, handleBlobFn func(blob restic.BlobHandle, buf []byte, err error) error) error {
|
||||||
|
|
Loading…
Reference in a new issue