mirror of https://github.com/restic/restic.git
prune: move code
This commit is contained in:
parent
623770eebb
commit
e85a21eda2
|
@ -521,9 +521,6 @@ func decidePackAction(ctx context.Context, opts PruneOptions, gopts GlobalOption
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate limit for number of unused bytes in the repo after repacking
|
|
||||||
maxUnusedSizeAfter := opts.maxUnusedBytes(stats.size.used)
|
|
||||||
|
|
||||||
// Sort repackCandidates such that packs with highest ratio unused/used space are picked first.
|
// Sort repackCandidates such that packs with highest ratio unused/used space are picked first.
|
||||||
// This is equivalent to sorting by unused / total space.
|
// This is equivalent to sorting by unused / total space.
|
||||||
// Instead of unused[i] / used[i] > unused[j] / used[j] we use
|
// Instead of unused[i] / used[i] > unused[j] / used[j] we use
|
||||||
|
@ -549,6 +546,9 @@ func decidePackAction(ctx context.Context, opts PruneOptions, gopts GlobalOption
|
||||||
stats.size.repackrm += p.unusedSize
|
stats.size.repackrm += p.unusedSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// calculate limit for number of unused bytes in the repo after repacking
|
||||||
|
maxUnusedSizeAfter := opts.maxUnusedBytes(stats.size.used)
|
||||||
|
|
||||||
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 := stats.size.repack+p.unusedSize+p.usedSize >= opts.MaxRepackBytes
|
reachedRepackSize := stats.size.repack+p.unusedSize+p.usedSize >= opts.MaxRepackBytes
|
||||||
|
|
Loading…
Reference in New Issue