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