forked from TrueCloudLab/restic
index: implement indexmap.grow() without random access
This commit is contained in:
parent
fc05e35a08
commit
9a7056a479
1 changed files with 7 additions and 10 deletions
|
@ -99,18 +99,15 @@ func (m *indexMap) get(id restic.ID) *indexEntry {
|
|||
}
|
||||
|
||||
func (m *indexMap) grow() {
|
||||
old := m.buckets
|
||||
m.buckets = make([]uint, growthFactor*len(m.buckets))
|
||||
|
||||
for _, ei := range old {
|
||||
for ei != 0 {
|
||||
e := m.resolve(ei)
|
||||
h := m.hash(e.id)
|
||||
next := e.next
|
||||
e.next = m.buckets[h]
|
||||
m.buckets[h] = ei
|
||||
ei = next
|
||||
}
|
||||
blockCount := m.blockList.Size()
|
||||
for i := uint(1); i < blockCount; i++ {
|
||||
e := m.resolve(i)
|
||||
|
||||
h := m.hash(e.id)
|
||||
e.next = m.buckets[h]
|
||||
m.buckets[h] = i
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue