// NewFIFO returns a Store which can be used to queue up items to
// process.
540206
func NewFIFO(keyFunc KeyFunc) *FIFO {
	f := &FIFO{
		items:   map[string]interface{}{},
		queue:   []string{},
		keyFunc: keyFunc,
	}
	f.cond.L = &f.lock
	return f
}
23621
func NewFS(config libkbfs.Config, conn *fuse.Conn, debug bool,
	platformParams PlatformParams) *FS {
	log := config.MakeLogger("kbfsfuse")
	// We need extra depth for errors, so that we can report the line
	// number for the caller of processError, not processError itself.
	errLog := log.CloneWithAddedDepth(1)
	if debug {
		// Turn on debugging.  TODO: allow a proper log file and
		// style to be specified.
		log.Configure("", true, "")
		errLog.Configure("", true, "")
	}

	serveMux := http.NewServeMux()

	// Replicate the default endpoints from pprof's init function.
	serveMux.HandleFunc("/debug/pprof/", pprof.Index)
	serveMux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
	serveMux.HandleFunc("/debug/pprof/profile", pprof.Profile)
	serveMux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
	serveMux.HandleFunc("/debug/pprof/trace", pprof.Trace)

	// Replicate the default endpoints from net/trace's init function.
	serveMux.HandleFunc("/debug/requests", makeTraceHandler(func(w http.ResponseWriter, req *http.Request, sensitive bool) {
		trace.Render(w, req, sensitive)
	}))
	serveMux.HandleFunc("/debug/events", makeTraceHandler(trace.RenderEvents))

	// Leave Addr blank to be set in enableDebugServer() and
	// disableDebugServer().
	debugServer := &http.Server{
		Handler:      serveMux,
		ReadTimeout:  10 * time.Second,
		WriteTimeout: 10 * time.Second,
	}

	quLog := config.MakeLogger(libkbfs.QuotaUsageLogModule("FS"))
	fs := &FS{
		config:         config,
		conn:           conn,
		log:            log,
		errLog:         errLog,
		vlog:           config.MakeVLogger(log),
		errVlog:        config.MakeVLogger(errLog),
		debugServer:    debugServer,
		notifications:  libfs.NewFSNotifications(log),
		platformParams: platformParams,
		quotaUsage: libkbfs.NewEventuallyConsistentQuotaUsage(
			config, quLog, config.MakeVLogger(quLog)),
		nextInode: 2, // root is 1
	}
	fs.root.private = &FolderList{
		fs:      fs,
		tlfType: tlf.Private,
		folders: make(map[string]*TLF),
		inode:   fs.assignInode(),
	}
	fs.root.public = &FolderList{
		fs:      fs,
		tlfType: tlf.Public,
		folders: make(map[string]*TLF),
		inode:   fs.assignInode(),
	}
	fs.root.team = &FolderList{
		fs:      fs,
		tlfType: tlf.SingleTeam,
		folders: make(map[string]*TLF),
		inode:   fs.assignInode(),
	}
	fs.execAfterDelay = func(d time.Duration, f func()) {
		time.AfterFunc(d, f)
	}
	return fs
}
388552
func NewFsStore(fs utilfs.Filesystem, dir string) Store {
	return &fsStore{
		fs:  fs,
		dir: dir,
	}
}
617926
func NewProcessor(from io.Reader) (Processor, error) {
	proc := newMemoryProcessor()
	return proc, proc.fastForward(from)
}
331588
func New(name string) (*Store, error) {
	home, err := homedir.Dir()
	if err != nil {
		return nil, err
	}
	base := filepath.Join(home, ".config", name)

	// create directory
	err = os.MkdirAll(base, os.ModePerm)
	if err != nil {
		return nil, err
	}

	return &Store{Base: base}, nil
}
783157
func NewFrom(from interface{}, opts ...Option) (*Config, error) {
	c := New()
	if err := c.Merge(from, opts...); err != nil {
		return nil, err
	}
	return c, nil
}
1171353
func NewFileInfo(name string, size int64, mode os.FileMode, modTime, accessTime time.Time) *FileInfo {
	return &FileInfo{
		name:       filepath.Base(name),
		size:       size,
		mode:       mode & (os.ModePerm | os.ModeDir),
		modTime:    modTime,
		accessTime: accessTime,
	}
}
1300274
func New(o Options) (storage.Storage, error) {
	s := storageImpl{
		Options: &o,
	}

	if !s.Stream.IsFullPath() {
		return nil, fmt.Errorf("invalid stream URL: %q", s.Stream)
	}
	if s.Index != "" && !s.Index.IsFullPath() {
		return nil, fmt.Errorf("invalid index URL: %v", s.Index)
	}

	return &s, nil
}
702719
func NewProcess() *Process {
	p := &Process{
		Port:        DefaultPort,
		BinDir:      DefaultBinDir,
		SbinDir:     DefaultSbinDir,
		DataDir:     DefaultDataDir,
		Password:    DefaultPassword,
		OpTimeout:   DefaultOpTimeout,
		ReplTimeout: DefaultReplTimeout,
		Logger:      log15.New("app", "mariadb"),

		events:         make(chan state.DatabaseEvent, 1),
		cancelSyncWait: func() {},
	}
	p.runningValue.Store(false)
	p.configValue.Store((*state.Config)(nil))
	p.events <- state.DatabaseEvent{}
	return p
}
1239554
func NewFromReader(f io.Reader) (ret *IPList, err error) {
	var ranges []Range
	// There's a lot of similar descriptions, so we maintain a pool and reuse
	// them to reduce memory overhead.
	uniqStrs := make(map[string]string)
	scanner := bufio.NewScanner(f)
	lineNum := 1
	for scanner.Scan() {
		r, ok, lineErr := ParseBlocklistP2PLine(scanner.Bytes())
		if lineErr != nil {
			err = fmt.Errorf("error parsing line %d: %s", lineNum, lineErr)
			return
		}
		lineNum++
		if !ok {
			continue
		}
		if s, ok := uniqStrs[r.Description]; ok {
			r.Description = s
		} else {
			uniqStrs[r.Description] = r.Description
		}
		ranges = append(ranges, r)
	}
	err = scanner.Err()
	if err != nil {
		return
	}
	ret = New(ranges)
	return
}
13940
func NewBufferStore(r Retriever, cap int) *BufferStore {
	if cap <= 0 {
		cap = DefaultTxnMembufCap
	}
	return &BufferStore{
		r:         r,
		MemBuffer: &lazyMemBuffer{cap: cap},
	}
}
327073
func NewFieldTypeFrom(ref *FieldType) *FieldType {
	ft := newFieldType()
	ft.indexed = ref.indexed
	ft.stored = ref.stored
	ft._tokenized = ref._tokenized
	ft.storeTermVectors = ref.storeTermVectors
	ft.storeTermVectorOffsets = ref.storeTermVectorOffsets
	ft.storeTermVectorPositions = ref.storeTermVectorPositions
	ft.storeTermVectorPayloads = ref.storeTermVectorPayloads
	ft._omitNorms = ref._omitNorms
	ft._indexOptions = ref._indexOptions
	ft._docValueType = ref._docValueType
	ft.numericType = ref.numericType
	// Do not copy frozen!
	return ft
}
195701
func NewInfo(link string) Info {
	var info Info
	info.Links.Login = link
	info.Links.UAA = link
	return info
}
1116796
func NewLIFO(ts ...T) *LIFO {
	s := &LIFO{}
	for i := range ts {
		s.Push(ts[i])
	}
	return s
}
209532
func New(store Store, rate *Rate) *Limiter {
	return &Limiter{
		Store: store,
		Rate:  rate,
	}
}
755533
func NewCCInfoCache(cs CCCacheSupport) *ccInfoCacheImpl {
	return &ccInfoCacheImpl{
		cache:        make(map[string]*ChaincodeData),
		cacheSupport: cs,
	}
}
975072
func NewFileStore(directory string) *FileStore {
	store := &FileStore{
		directory: directory,
		opened:    false,
	}
	return store
}