Harmonize naming
This commit is contained in:
parent
92bd448691
commit
e3013271a6
2 changed files with 31 additions and 31 deletions
|
@ -29,24 +29,24 @@ func NewMasterIndex() *MasterIndex {
|
|||
}
|
||||
|
||||
// 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) {
|
||||
func (mi *MasterIndex) Lookup(id restic.ID, t restic.BlobType) (pbs []restic.PackedBlob) {
|
||||
mi.idxMutex.RLock()
|
||||
defer mi.idxMutex.RUnlock()
|
||||
|
||||
for _, idx := range mi.idx {
|
||||
blobs = idx.Lookup(id, tpe, blobs)
|
||||
pbs = idx.Lookup(id, t, pbs)
|
||||
}
|
||||
|
||||
return blobs
|
||||
return pbs
|
||||
}
|
||||
|
||||
// LookupSize queries all known Indexes for the ID and returns the first match.
|
||||
func (mi *MasterIndex) LookupSize(id restic.ID, tpe restic.BlobType) (uint, bool) {
|
||||
func (mi *MasterIndex) LookupSize(id restic.ID, t restic.BlobType) (uint, bool) {
|
||||
mi.idxMutex.RLock()
|
||||
defer mi.idxMutex.RUnlock()
|
||||
|
||||
for _, idx := range mi.idx {
|
||||
if size, found := idx.LookupSize(id, tpe); found {
|
||||
if size, found := idx.LookupSize(id, t); found {
|
||||
return size, found
|
||||
}
|
||||
}
|
||||
|
@ -58,40 +58,40 @@ func (mi *MasterIndex) LookupSize(id restic.ID, tpe restic.BlobType) (uint, bool
|
|||
// Before doing so it checks if this blob is already known.
|
||||
// Returns true if adding was successful and false if the blob
|
||||
// was already known
|
||||
func (mi *MasterIndex) addPending(id restic.ID, tpe restic.BlobType) bool {
|
||||
func (mi *MasterIndex) addPending(id restic.ID, t restic.BlobType) bool {
|
||||
|
||||
mi.idxMutex.Lock()
|
||||
defer mi.idxMutex.Unlock()
|
||||
|
||||
// Check if blob is pending or in index
|
||||
if mi.pendingBlobs.Has(restic.BlobHandle{ID: id, Type: tpe}) {
|
||||
if mi.pendingBlobs.Has(restic.BlobHandle{ID: id, Type: t}) {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, idx := range mi.idx {
|
||||
if idx.Has(id, tpe) {
|
||||
if idx.Has(id, t) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// really not known -> insert
|
||||
mi.pendingBlobs.Insert(restic.BlobHandle{ID: id, Type: tpe})
|
||||
mi.pendingBlobs.Insert(restic.BlobHandle{ID: id, Type: t})
|
||||
return true
|
||||
}
|
||||
|
||||
// Has queries all known Indexes for the ID and returns the first match.
|
||||
// Also returns true if the ID is pending.
|
||||
func (mi *MasterIndex) Has(id restic.ID, tpe restic.BlobType) bool {
|
||||
func (mi *MasterIndex) Has(id restic.ID, t restic.BlobType) bool {
|
||||
mi.idxMutex.RLock()
|
||||
defer mi.idxMutex.RUnlock()
|
||||
|
||||
// also return true if blob is pending
|
||||
if mi.pendingBlobs.Has(restic.BlobHandle{ID: id, Type: tpe}) {
|
||||
if mi.pendingBlobs.Has(restic.BlobHandle{ID: id, Type: t}) {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, idx := range mi.idx {
|
||||
if idx.Has(id, tpe) {
|
||||
if idx.Has(id, t) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue