repository: implement pack compression

This commit is contained in:
Michael Eischer
2022-02-13 17:24:09 +01:00
parent 362ab06023
commit 6fb408d90e
10 changed files with 184 additions and 84 deletions

View File

@@ -117,7 +117,7 @@ func (r *fileRestorer) restoreFiles(ctx context.Context) error {
err := r.forEachBlob(fileBlobs, func(packID restic.ID, blob restic.Blob) {
if largeFile {
packsMap[packID] = append(packsMap[packID], fileBlobInfo{id: blob.ID, offset: fileOffset})
fileOffset += int64(restic.PlaintextLength(int(blob.Length)))
fileOffset += int64(blob.DataLength())
}
pack, ok := packs[packID]
if !ok {
@@ -195,7 +195,7 @@ func (r *fileRestorer) downloadPack(ctx context.Context, pack *packInfo) error {
if packID.Equal(pack.id) {
addBlob(blob, fileOffset)
}
fileOffset += int64(restic.PlaintextLength(int(blob.Length)))
fileOffset += int64(blob.DataLength())
})
if err != nil {
// restoreFiles should have caught this error before