mirror of
https://github.com/restic/restic.git
synced 2026-10-17 15:08:12 +00:00
Use BlobHandle in index methods
This commit is contained in:
1 parent
e3013271a6
commit
aa7a5f19c2
17 files changed
+167
-239
No files matched your search
@@ -52,7 +52,7 @@ type packInfo struct {
|
||||
// fileRestorer restores set of files
|
||||
type fileRestorer struct {
|
||||
key *crypto.Key
|
||||
idx func(restic.ID, restic.BlobType) []restic.PackedBlob
|
||||
idx func(restic.BlobHandle) []restic.PackedBlob
|
||||
packLoader func(ctx context.Context, h restic.Handle, length int, offset int64, fn func(rd io.Reader) error) error
|
||||
|
||||
filesWriter *filesWriter
|
||||
@@ -64,7 +64,7 @@ type fileRestorer struct {
|
||||
func newFileRestorer(dst string,
|
||||
packLoader func(ctx context.Context, h restic.Handle, length int, offset int64, fn func(rd io.Reader) error) error,
|
||||
key *crypto.Key,
|
||||
idx func(restic.ID, restic.BlobType) []restic.PackedBlob) *fileRestorer {
|
||||
idx func(restic.BlobHandle) []restic.PackedBlob) *fileRestorer {
|
||||
|
||||
return &fileRestorer{
|
||||
key: key,
|
||||
@@ -89,7 +89,7 @@ func (r *fileRestorer) forEachBlob(blobIDs []restic.ID, fn func(packID restic.ID
|
||||
}
|
||||
|
||||
for _, blobID := range blobIDs {
|
||||
packs := r.idx(blobID, restic.DataBlob)
|
||||
packs := r.idx(restic.BlobHandle{ID: blobID, Type: restic.DataBlob})
|
||||
if len(packs) == 0 {
|
||||
return errors.Errorf("Unknown blob %s", blobID.String())
|
||||
}
|
||||
@@ -215,7 +215,7 @@ func (r *fileRestorer) downloadPack(ctx context.Context, pack *packInfo) {
|
||||
})
|
||||
} else if packsMap, ok := file.blobs.(map[restic.ID][]fileBlobInfo); ok {
|
||||
for _, blob := range packsMap[pack.id] {
|
||||
idxPacks := r.idx(blob.id, restic.DataBlob)
|
||||
idxPacks := r.idx(restic.BlobHandle{ID: blob.id, Type: restic.DataBlob})
|
||||
for _, idxPack := range idxPacks {
|
||||
if idxPack.PackID.Equal(pack.id) {
|
||||
addBlob(idxPack.Blob, blob.offset)
|
||||
|
||||
@@ -39,8 +39,8 @@ type TestRepo struct {
|
||||
loader func(ctx context.Context, h restic.Handle, length int, offset int64, fn func(rd io.Reader) error) error
|
||||
}
|
||||
|
||||
func (i *TestRepo) Lookup(blobID restic.ID, _ restic.BlobType) []restic.PackedBlob {
|
||||
packs := i.blobs[blobID]
|
||||
func (i *TestRepo) Lookup(bh restic.BlobHandle) []restic.PackedBlob {
|
||||
packs := i.blobs[bh.ID]
|
||||
return packs
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user