Merge pull request #3733 from restic/improve-stats

Improve stats
This commit is contained in:
MichaelEischer
2022-07-02 19:07:31 +02:00
committed by GitHub
22 changed files with 140 additions and 110 deletions

View File

@@ -386,7 +386,7 @@ func loadBlobs(ctx context.Context, repo restic.Repository, pack restic.ID, list
}
}
if reuploadBlobs {
_, _, err := repo.SaveBlob(ctx, blob.Type, plaintext, id, true)
_, _, _, err := repo.SaveBlob(ctx, blob.Type, plaintext, id, true)
if err != nil {
return err
}

View File

@@ -130,11 +130,11 @@ func runStats(gopts GlobalOptions, args []string) error {
if statsOptions.countMode == countModeRawData {
// the blob handles have been collected, but not yet counted
for blobHandle := range stats.blobs {
blobSize, found := repo.LookupBlobSize(blobHandle.ID, blobHandle.Type)
if !found {
pbs := repo.Index().Lookup(blobHandle)
if len(pbs) == 0 {
return fmt.Errorf("blob %v not found", blobHandle)
}
stats.TotalSize += uint64(blobSize)
stats.TotalSize += uint64(pbs[0].Length)
stats.TotalBlobCount++
}
}