mirror of
https://github.com/octoleo/restic.git
synced 2024-12-26 12:27:33 +00:00
Merge pull request #717 from restic/fix-367
Only add entries to indexes inside PackerManager
This commit is contained in:
commit
04846b10bc
@ -119,16 +119,14 @@ func (mi *MasterIndex) Remove(index *Index) {
|
||||
}
|
||||
}
|
||||
|
||||
// Current returns an index that is not yet finalized, so that new entries can
|
||||
// still be added. If all indexes are finalized, a new index is created and
|
||||
// returned.
|
||||
func (mi *MasterIndex) Current() *Index {
|
||||
// Store remembers the id and pack in the index.
|
||||
func (mi *MasterIndex) Store(pb restic.PackedBlob) {
|
||||
mi.idxMutex.RLock()
|
||||
|
||||
for _, idx := range mi.idx {
|
||||
if !idx.Final() {
|
||||
mi.idxMutex.RUnlock()
|
||||
return idx
|
||||
idx.Store(pb)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,9 +135,8 @@ func (mi *MasterIndex) Current() *Index {
|
||||
defer mi.idxMutex.Unlock()
|
||||
|
||||
newIdx := NewIndex()
|
||||
newIdx.Store(pb)
|
||||
mi.idx = append(mi.idx, newIdx)
|
||||
|
||||
return newIdx
|
||||
}
|
||||
|
||||
// NotFinalIndexes returns all indexes that have not yet been saved.
|
||||
|
@ -133,7 +133,7 @@ func (r *Repository) savePacker(p *pack.Packer) error {
|
||||
// update blobs in the index
|
||||
for _, b := range p.Blobs() {
|
||||
debug.Log(" updating blob %v to pack %v", b.ID.Str(), id.Str())
|
||||
r.idx.Current().Store(restic.PackedBlob{
|
||||
r.idx.Store(restic.PackedBlob{
|
||||
Blob: restic.Blob{
|
||||
Type: b.Type,
|
||||
ID: b.ID,
|
||||
|
Loading…
Reference in New Issue
Block a user