mirror of
https://github.com/octoleo/restic.git
synced 2025-01-03 07:12:28 +00:00
index: implement indexmap.grow() without random access
This commit is contained in:
parent
fc05e35a08
commit
9a7056a479
@ -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 New Issue
Block a user