func (iter *referenceFilteredIter) Close() {
	iter.iter.Close()
}
Close releases any resources used by the iterator.
package storer
import (
	"errors"
	"io"
	"gopkg.in/src-d/go-git.v4/plumbing"
)
const MaxResolveRecursion = 1024
var ErrMaxResolveRecursion = errors.New("max. recursion level reached")
type ReferenceStorer interface {
	SetReference(*plumbing.Reference) error
	CheckAndSetReference(new, old *plumbing.Reference) error
	Reference(plumbing.ReferenceName) (*plumbing.Reference, error)
	IterReferences() (ReferenceIter, error)
	RemoveReference(plumbing.ReferenceName) error
	CountLooseRefs() (int, error)
	PackRefs() error
}
type ReferenceIter interface {
	Next() (*plumbing.Reference, error)
	ForEach(func(*plumbing.Reference) error) error
	Close()
}
type referenceFilteredIter struct {
	ff   func(r *plumbing.Reference) bool
	iter ReferenceIter
}
func NewReferenceFilteredIter(
	ff func(r *plumbing.Reference) bool, iter ReferenceIter) ReferenceIter {
	return &referenceFilteredIter{ff, iter}
}
func (iter *referenceFilteredIter) Next() (*plumbing.Reference, error) {
	for {
		r, err := iter.iter.Next()
		if err != nil {
			return nil, err
		}
		if iter.ff(r) {
			return r, nil
		}
		continue
	}
}
func (iter *referenceFilteredIter) ForEach(cb func(*plumbing.Reference) error) error {
	defer iter.Close()
	for {
		r, err := iter.Next()
		if err == io.EOF {
			break
		}
		if err != nil {
			return err
		}
		if err := cb(r); err != nil {
			if err == ErrStop {
				break
			}
			return err
		}
	}
	return nil
}