mirror of
https://github.com/restic/restic.git
synced 2025-11-15 05:33:03 +00:00
make Lookup() return all blobs
+ simplify syntax
This commit is contained in:
committed by
Michael Eischer
parent
020cab8e08
commit
9d1fb94c6c
@@ -26,19 +26,16 @@ func NewMasterIndex() *MasterIndex {
|
||||
return &MasterIndex{idx: idx, pendingBlobs: restic.NewBlobSet()}
|
||||
}
|
||||
|
||||
// Lookup queries all known Indexes for the ID and returns the first match.
|
||||
func (mi *MasterIndex) Lookup(id restic.ID, tpe restic.BlobType) (blobs []restic.PackedBlob, found bool) {
|
||||
// Lookup queries all known Indexes for the ID and returns all matches.
|
||||
func (mi *MasterIndex) Lookup(id restic.ID, tpe restic.BlobType) (blobs []restic.PackedBlob) {
|
||||
mi.idxMutex.RLock()
|
||||
defer mi.idxMutex.RUnlock()
|
||||
|
||||
for _, idx := range mi.idx {
|
||||
blobs, found = idx.Lookup(id, tpe)
|
||||
if found {
|
||||
return
|
||||
}
|
||||
blobs = idx.Lookup(id, tpe, blobs)
|
||||
}
|
||||
|
||||
return nil, false
|
||||
return blobs
|
||||
}
|
||||
|
||||
// LookupSize queries all known Indexes for the ID and returns the first match.
|
||||
|
||||
Reference in New Issue
Block a user