| 227 | } |
| 228 | |
| 229 | func (s *ObjectStorage) packfileFromCache(hash plumbing.Hash) *packfile.Packfile { |
| 230 | if s.packfiles == nil { |
| 231 | if s.options.KeepDescriptors { |
| 232 | s.packfiles = make(map[plumbing.Hash]*packfile.Packfile) |
| 233 | } else if s.options.MaxOpenDescriptors > 0 { |
| 234 | s.packList = make([]plumbing.Hash, s.options.MaxOpenDescriptors) |
| 235 | s.packfiles = make(map[plumbing.Hash]*packfile.Packfile, s.options.MaxOpenDescriptors) |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | return s.packfiles[hash] |
| 240 | } |
| 241 | |
| 242 | func (s *ObjectStorage) storePackfileInCache(hash plumbing.Hash, p *packfile.Packfile) error { |
| 243 | if s.options.KeepDescriptors { |