// NewNoteIterator creates a new iterator for notes
965976
func (repo *Repository) NewNoteIterator(ref string) (*NoteIterator, error) {
	var cref *C.char
	if ref == "" {
		cref = nil
	} else {
		cref = C.CString(ref)
		defer C.free(unsafe.Pointer(cref))
	}

	var ptr *C.git_note_iterator

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_note_iterator_new(&ptr, repo.ptr, cref)
	runtime.KeepAlive(repo)
	if ret < 0 {
		return nil, MakeGitError(ret)
	}

	iter := &NoteIterator{ptr: ptr, r: repo}
	runtime.SetFinalizer(iter, (*NoteIterator).Free)
	return iter, nil
}
18226
func NewDebugIterator(label string, itr Iterator) debugIterator {
	return debugIterator{
		label: label,
		itr:   itr,
	}
}
72769
func NewUnionIterator(iters []NodeIterator) (NodeIterator, *int) {
	h := make(nodeIteratorHeap, len(iters))
	copy(h, iters)
	heap.Init(&h)

	ui := &unionIterator{items: &h}
	return ui, &ui.count
}
374674
func NewBinPackIterator(ctx Context, source RankIterator, evict bool, priority int) *BinPackIterator {
	iter := &BinPackIterator{
		ctx:      ctx,
		source:   source,
		evict:    evict,
		priority: priority,
	}
	return iter
}
152463
func NewObjectIterator(s Slice, allowRandomIteration ...bool) (*ObjectIterator, error) {
	if !s.IsObject() {
		return nil, InvalidTypeError{"Expected Object slice"}
	}
	size, err := s.Length()
	if err != nil {
		return nil, WithStack(err)
	}
	i := &ObjectIterator{
		s:        s,
		position: 0,
		size:     size,
	}
	if size > 0 {
		if h := s.head(); h == 0x14 {
			i.current, err = s.KeyAt(0, false)
		} else if optionalBool(allowRandomIteration, false) {
			i.current = s[s.findDataOffset(h):]
		}
	}
	return i, nil
}
18533
func (c *Config) NewIterator() (*ConfigIterator, error) {
	iter := &ConfigIterator{cfg: c}

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_config_iterator_new(&iter.ptr, c.ptr)
	if ret < 0 {
		return nil, MakeGitError(ret)
	}

	return iter, nil
}
963116
func (cl FileChangelist) NewIterator() (ChangeIterator, error) {
	fileInfos, err := getFileNames(cl.dir)
	if err != nil {
		return &FileChangeListIterator{}, err
	}
	return &FileChangeListIterator{dirname: cl.dir, collection: fileInfos}, nil
}
1228354
func (db *CLevelDB) Iterator(start, end []byte) Iterator {
	itr := db.db.NewIterator(db.ro)
	return newCLevelDBIterator(itr, start, end, false)
}
512088
func (t *tOps) newIterator(f *tFile, slice *util.Range, ro *opt.ReadOptions) iterator.Iterator {
	ch, err := t.open(f)
	if err != nil {
		return iterator.NewEmptyIterator(err)
	}
	iter := ch.Value().(*table.Reader).NewIterator(slice, ro)
	iter.SetReleaser(ch)
	return iter
}
200663
func NewEvaluator(
	scanner scanner.Scanner,
	interpreters Interpreters) Evaluator {
	return NewEvaluatorWithOptions(scanner, interpreters, Options{})
}
896531
func NewObjectPageIterator(ctx context.Context, s Store, q Query) ObjectIterator {

	cancelCtx, cancel := context.WithCancel(ctx)
	return &ObjectPageIterator{
		s:      s,
		ctx:    cancelCtx,
		cancel: cancel,
		q:      q,
	}
}
1227687
func (p *PostingsList) Iterator(includeFreq, includeNorm, includeLocs bool,
	prealloc segment.PostingsIterator) segment.PostingsIterator {
	if p.normBits1Hit == 0 && p.postings == nil {
		return emptyPostingsIterator
	}

	var preallocPI *PostingsIterator
	pi, ok := prealloc.(*PostingsIterator)
	if ok && pi != nil {
		preallocPI = pi
	}
	if preallocPI == emptyPostingsIterator {
		preallocPI = nil
	}

	return p.iterator(includeFreq, includeNorm, includeLocs, preallocPI)
}
275903
func NewGenerator(genfunc string, imports []*codegen.ImportSpec, flags map[string]string, customflags []string) (*Generator, error) {
	var (
		outDir, designPkgPath string
		debug                 bool
	)

	if o, ok := flags["out"]; ok {
		outDir = o
	}
	if d, ok := flags["design"]; ok {
		designPkgPath = d
	}
	if d, ok := flags["debug"]; ok {
		var err error
		debug, err = strconv.ParseBool(d)
		if err != nil {
			return nil, fmt.Errorf("failed to parse debug flag: %s", err)
		}
	}

	return &Generator{
		Genfunc:       genfunc,
		Imports:       imports,
		Flags:         flags,
		CustomFlags:   customflags,
		OutDir:        outDir,
		DesignPkgPath: designPkgPath,
		debug:         debug,
	}, nil
}
785746
func NewLimitIterator(ctx Context, source RankIterator, limit int, scoreThreshold float64, maxSkip int) *LimitIterator {
	iter := &LimitIterator{
		ctx:            ctx,
		source:         source,
		limit:          limit,
		maxSkip:        maxSkip,
		scoreThreshold: scoreThreshold,
		skippedNodes:   make([]*RankedNode, 0, maxSkip),
	}
	return iter
}
1300201
func NewGenerator(strength int, useMac, shuffleMac bool) Generator {
	return Generator{
		Strength:   strength,
		UseMac:     useMac,
		ShuffleMac: shuffleMac,
	}
}
1312358
func (db *MemDB) Iterator(start, end []byte) Iterator {
	db.mtx.Lock()
	defer db.mtx.Unlock()

	keys := db.getSortedKeys(start, end, false)
	return newMemDBIterator(db, keys, start, end)
}
1320533
func NewMergeIterator(itrs []Iterator, f MergeFunc) (*MergeIterator, error) {
	rv := &MergeIterator{
		itrs:    itrs,
		f:       f,
		currKs:  make([][]byte, len(itrs)),
		currVs:  make([]uint64, len(itrs)),
		lowIdxs: make([]int, 0, len(itrs)),
		mergeV:  make([]uint64, 0, len(itrs)),
	}
	rv.init()
	if rv.lowK == nil {
		return rv, ErrIteratorDone
	}
	return rv, nil
}