IterEncodedObjects returns an iterator for all the objects in the packfile with the given type.
(t plumbing.ObjectType)
| 602 | // IterEncodedObjects returns an iterator for all the objects in the packfile |
| 603 | // with the given type. |
| 604 | func (s *ObjectStorage) IterEncodedObjects(t plumbing.ObjectType) (storer.EncodedObjectIter, error) { |
| 605 | objects, err := s.dir.Objects() |
| 606 | if err != nil { |
| 607 | return nil, err |
| 608 | } |
| 609 | |
| 610 | seen := make(map[plumbing.Hash]struct{}) |
| 611 | var iters []storer.EncodedObjectIter |
| 612 | if len(objects) != 0 { |
| 613 | iters = append(iters, &objectsIter{s: s, t: t, h: objects}) |
| 614 | seen = hashListAsMap(objects) |
| 615 | } |
| 616 | |
| 617 | packi, err := s.buildPackfileIters(t, seen) |
| 618 | if err != nil { |
| 619 | return nil, err |
| 620 | } |
| 621 | |
| 622 | iters = append(iters, packi) |
| 623 | return storer.NewMultiEncodedObjectIter(iters), nil |
| 624 | } |
| 625 | |
| 626 | func (s *ObjectStorage) buildPackfileIters( |
| 627 | t plumbing.ObjectType, |