restorer: Remove dead code
This commit is contained in:
parent
bba8ba7a5b
commit
27524979e8
1 changed files with 2 additions and 10 deletions
|
@ -2,7 +2,6 @@ package restorer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"math"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
@ -118,7 +117,7 @@ func (r *fileRestorer) restoreFiles(ctx context.Context) error {
|
||||||
err := r.forEachBlob(fileBlobs, func(packID restic.ID, blob restic.Blob) {
|
err := r.forEachBlob(fileBlobs, func(packID restic.ID, blob restic.Blob) {
|
||||||
if largeFile {
|
if largeFile {
|
||||||
packsMap[packID] = append(packsMap[packID], fileBlobInfo{id: blob.ID, offset: fileOffset})
|
packsMap[packID] = append(packsMap[packID], fileBlobInfo{id: blob.ID, offset: fileOffset})
|
||||||
fileOffset += int64(blob.Length) - crypto.Extension
|
fileOffset += int64(restic.PlaintextLength(int(blob.Length)))
|
||||||
}
|
}
|
||||||
pack, ok := packs[packID]
|
pack, ok := packs[packID]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -175,20 +174,13 @@ func (r *fileRestorer) restoreFiles(ctx context.Context) error {
|
||||||
|
|
||||||
func (r *fileRestorer) downloadPack(ctx context.Context, pack *packInfo) error {
|
func (r *fileRestorer) downloadPack(ctx context.Context, pack *packInfo) error {
|
||||||
|
|
||||||
// calculate pack byte range and blob->[]files->[]offsets mappings
|
// calculate blob->[]files->[]offsets mappings
|
||||||
start, end := int64(math.MaxInt64), int64(0)
|
|
||||||
blobs := make(map[restic.ID]struct {
|
blobs := make(map[restic.ID]struct {
|
||||||
files map[*fileInfo][]int64 // file -> offsets (plural!) of the blob in the file
|
files map[*fileInfo][]int64 // file -> offsets (plural!) of the blob in the file
|
||||||
})
|
})
|
||||||
var blobList []restic.Blob
|
var blobList []restic.Blob
|
||||||
for file := range pack.files {
|
for file := range pack.files {
|
||||||
addBlob := func(blob restic.Blob, fileOffset int64) {
|
addBlob := func(blob restic.Blob, fileOffset int64) {
|
||||||
if start > int64(blob.Offset) {
|
|
||||||
start = int64(blob.Offset)
|
|
||||||
}
|
|
||||||
if end < int64(blob.Offset+blob.Length) {
|
|
||||||
end = int64(blob.Offset + blob.Length)
|
|
||||||
}
|
|
||||||
blobInfo, ok := blobs[blob.ID]
|
blobInfo, ok := blobs[blob.ID]
|
||||||
if !ok {
|
if !ok {
|
||||||
blobInfo.files = make(map[*fileInfo][]int64)
|
blobInfo.files = make(map[*fileInfo][]int64)
|
||||||
|
|
Loading…
Add table
Reference in a new issue