mirror of
https://github.com/restic/restic.git
synced 2024-12-25 17:27:25 +00:00
Move helper function
This commit is contained in:
parent
c1a3de4a6e
commit
7f86eb4ec0
1 changed files with 8 additions and 8 deletions
|
@ -290,14 +290,6 @@ func prune(opts PruneOptions, gopts GlobalOptions, repo restic.Repository, usedB
|
||||||
|
|
||||||
var repackCandidates []packInfoWithID
|
var repackCandidates []packInfoWithID
|
||||||
|
|
||||||
repack := func(id restic.ID, p packInfo) {
|
|
||||||
repackPacks.Insert(id)
|
|
||||||
stats.blobs.repack += p.unusedBlobs + p.duplicateBlobs + p.usedBlobs
|
|
||||||
stats.size.repack += p.unusedSize + p.usedSize
|
|
||||||
stats.blobs.repackrm += p.unusedBlobs
|
|
||||||
stats.size.repackrm += p.unusedSize
|
|
||||||
}
|
|
||||||
|
|
||||||
// loop over all packs and decide what to do
|
// loop over all packs and decide what to do
|
||||||
bar := newProgressMax(!gopts.Quiet, uint64(len(indexPack)), "packs processed")
|
bar := newProgressMax(!gopts.Quiet, uint64(len(indexPack)), "packs processed")
|
||||||
bar.Start()
|
bar.Start()
|
||||||
|
@ -388,6 +380,14 @@ func prune(opts PruneOptions, gopts GlobalOptions, repo restic.Repository, usedB
|
||||||
return pi.unusedSize*pj.usedSize > pj.unusedSize*pi.usedSize
|
return pi.unusedSize*pj.usedSize > pj.unusedSize*pi.usedSize
|
||||||
})
|
})
|
||||||
|
|
||||||
|
repack := func(id restic.ID, p packInfo) {
|
||||||
|
repackPacks.Insert(id)
|
||||||
|
stats.blobs.repack += p.unusedBlobs + p.duplicateBlobs + p.usedBlobs
|
||||||
|
stats.size.repack += p.unusedSize + p.usedSize
|
||||||
|
stats.blobs.repackrm += p.unusedBlobs
|
||||||
|
stats.size.repackrm += p.unusedSize
|
||||||
|
}
|
||||||
|
|
||||||
for _, p := range repackCandidates {
|
for _, p := range repackCandidates {
|
||||||
reachedUnusedSizeAfter := (stats.size.unused-stats.size.remove-stats.size.repackrm < maxUnusedSizeAfter)
|
reachedUnusedSizeAfter := (stats.size.unused-stats.size.remove-stats.size.repackrm < maxUnusedSizeAfter)
|
||||||
reachedRepackSize := (len(opts.MaxRepackSize) > 0 && stats.size.repack+p.unusedSize+p.usedSize > opts.MaxRepackBytes)
|
reachedRepackSize := (len(opts.MaxRepackSize) > 0 && stats.size.repack+p.unusedSize+p.usedSize > opts.MaxRepackBytes)
|
||||||
|
|
Loading…
Reference in a new issue