// NewIterator creates an iterator over each entry in the
// configuration
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
}
367859
func NewReader(config ReaderConfig) (*Reader, error) {
	if err := config.validate(); err != nil {
		return nil, errors.Trace(err)
	}
	r := &Reader{config: config}
	return r, nil
}
281412
func (fs *FileSorter) NewReduceIterator(part int) (ReduceIterator, error) {
	mo := fs.mapOuts[part]
	// Request for a sort token
	<-fs.sortToken
	defer func() {
		// Return the sort token back
		fs.sortToken <- true
	}()

	// read
	var os offsSorter
	var err error
	os.Buffer, os.KeyOffs, os.KeyEnds, os.ValOffs, os.ValEnds, err =
		kv.ReadAsByteOffs(mo.rawPath)
	if err != nil {
		return nil, err
	}
	// sort
	sort.Sort(&os)
	// save
	fldSorted := fs.TmpFolder.Join(pathSorted)
	fldSorted.Mkdir(0755)
	redIn := fldSorted.Join(fmt.Sprintf(fmtPart, part))
	if err := kv.WriteByteOffs(redIn, os.Buffer, os.KeyOffs, os.KeyEnds,
		os.ValOffs, os.ValEnds); err != nil {
		return nil, err
	}

	mo.reader, err = kv.NewReader(redIn)
	if err != nil {
		return nil, err
	}

	return mo, nil
}
1302239
func NewIDSliceIterator(ids []ID) Iterator {
	iter := &idSliceIter{
		backingSlice: ids,
		currentIdx:   -1,
	}
	return iter
}
1226292
func (ms *MemSorters) NewReduceIterator(part int) (ReduceIterator, error) {
	sorter := ms.sorters[part]
	sort.Sort(sorter)
	return sorter, nil
}
469534
func NewFeasibleRankIterator(ctx Context, source FeasibleIterator) *FeasibleRankIterator {
	iter := &FeasibleRankIterator{
		ctx:    ctx,
		source: source,
	}
	return iter
}
170413
func NewNodeAffinityIterator(ctx Context, source RankIterator) *NodeAffinityIterator {
	return &NodeAffinityIterator{
		ctx:    ctx,
		source: source,
	}
}
753898
func NewDifferenceIterator(a, b NodeIterator) (NodeIterator, *int) {
	a.Next(true)
	it := &differenceIterator{
		a: a,
		b: b,
	}
	return it, &it.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
}
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)
}
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
}
354902
func (c *Config) NewIteratorGlob(regexp string) (*ConfigIterator, error) {
	iter := &ConfigIterator{cfg: c}
	cregexp := C.CString(regexp)
	defer C.free(unsafe.Pointer(cregexp))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

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

	return iter, nil
}
161090
func (kv *KV) Iterator(f func([]byte, []byte) bool) error {
	return kv.db.View(func(txn *badger.Txn) error {
		opts := badger.DefaultIteratorOptions
		opts.PrefetchSize = 10
		it := txn.NewIterator(opts)
		defer it.Close()
		for it.Rewind(); it.Valid(); it.Next() {
			item := it.Item()
			if k := item.Key(); k != nil {
				v, err := item.Value()
				if err != nil {
					return err
				}
				if !f(k, v) {
					break
				}
			}
		}
		return nil
	})
}
1332052
func (db *GoLevelDB) Iterator(start, end []byte) Iterator {
	itr := db.db.NewIterator(nil, nil)
	return newGoLevelDBIterator(itr, start, end, false)
}
932476
func (n *Node) rawIterator() *rawIterator {
	iter := &rawIterator{node: n}
	iter.Next()
	return iter
}
678169
func (w *SnapshotWrapper) StartIterator(
	startKeyInclusive, endKeyExclusive []byte,
	iteratorOptions IteratorOptions,
) (Iterator, error) {
	return w.ss.StartIterator(startKeyInclusive, endKeyExclusive,
		iteratorOptions)
}
872216
func NewArrayIndexer(array ArrayIndexer) IteratorIndexer {
	return &arrayIteratorIndexer{
		basicArrayIterator: basicArrayIterator{array: array, pos: -1},
		array:              array,
	}
}