mirror of
https://github.com/restic/restic.git
synced 2025-12-04 01:11:56 +00:00
Count packs directly in RebuildIndexFiles
This commit is contained in:
committed by
Michael Eischer
parent
69f9d269eb
commit
68b74e359e
@@ -100,13 +100,19 @@ func (mi *MasterIndex) Has(bh restic.BlobHandle) bool {
|
||||
}
|
||||
|
||||
// Packs returns all packs that are covered by the index.
|
||||
func (mi *MasterIndex) Packs() restic.IDSet {
|
||||
// If packBlacklist ist given, those packs are only contained in the
|
||||
// resulting IDSet if they are contained in a non-final index.
|
||||
func (mi *MasterIndex) Packs(packBlacklist restic.IDSet) restic.IDSet {
|
||||
mi.idxMutex.RLock()
|
||||
defer mi.idxMutex.RUnlock()
|
||||
|
||||
packs := restic.NewIDSet()
|
||||
for _, idx := range mi.idx {
|
||||
packs.Merge(idx.Packs())
|
||||
idxPacks := idx.Packs()
|
||||
if idx.final {
|
||||
idxPacks = idxPacks.Sub(packBlacklist)
|
||||
}
|
||||
packs.Merge(idxPacks)
|
||||
}
|
||||
|
||||
return packs
|
||||
|
||||
@@ -65,7 +65,6 @@ type MasterIndex interface {
|
||||
Has(BlobHandle) bool
|
||||
Lookup(BlobHandle) []PackedBlob
|
||||
Count(BlobType) uint
|
||||
Packs() IDSet
|
||||
PackSize(ctx context.Context, onlyHdr bool) map[ID]int64
|
||||
|
||||
// Each returns a channel that yields all blobs known to the index. When
|
||||
|
||||
Reference in New Issue
Block a user