// New creates a new scheduler.
975458
func New(store *store.MemoryStore) *Scheduler {
	return &Scheduler{
		store:                   store,
		unassignedTasks:         make(map[string]*api.Task),
		pendingPreassignedTasks: make(map[string]*api.Task),
		preassignedTasks:        make(map[string]struct{}),
		allTasks:                make(map[string]*api.Task),
		stopChan:                make(chan struct{}),
		doneChan:                make(chan struct{}),
		pipeline:                NewPipeline(),
	}
}
251452
func New(apiKey string) *Handler {
	return NewFromNotifier(bugsnag.New(bugsnag.Configuration{
		APIKey: apiKey,
	}))
}
1147550
func New(w io.Writer, opts *BuilderOpts) (*Builder, error) {
	return newBuilder(w, opts)
}
443150
func New() *Consumer {
	return &Consumer{
		Logger:   nsqlog.Logger,
		LogLevel: nsqlog.LogLevel,
		handlers: make(map[topicChan]*queue),
	}
}
1161277
func New() *Logger {
	return &Logger{
		Level:      InfoLevel,
		TimeFormat: "2006/01/02 15:04",
		NewLine:    true,
		Printer:    pio.NewPrinter("", os.Stdout).EnableDirectOutput().Hijack(logHijacker),
		children:   newLoggerMap(),
	}
}
41027
func New(out io.Writer, level Level) train.Interceptor {
	return &loggingInterceptor{
		out:   out,
		level: level,
	}
}
392424
func New(out io.Writer, threshold log.Level) *Logger {
	return &Logger{
		out:       out,
		threshold: threshold,
		Formatter: defaultFormater,
		Writer:    defaultWriter,
	}
}
164987
func New(interval time.Duration) (*Batcher, error) {
	watcher, err := fsnotify.NewWatcher()

	batcher := &Batcher{}
	batcher.Watcher = watcher
	batcher.interval = interval
	batcher.done = make(chan struct{}, 1)
	batcher.Events = make(chan []fsnotify.Event, 1)

	if err == nil {
		go batcher.run()
	}

	return batcher, err
}
6130
func New(lsnCfg engine.Listener, router http.Handler, stapler stapler.Stapler,
	connTck conntracker.ConnectionTracker, autoCertCache autocert.Cache, wg *sync.WaitGroup,
) (*T, error) {
	scopedRouter, err := newScopeRouter(lsnCfg.Scope, router)
	if err != nil {
		return nil, err
	}
	return &T{
		lsnCfg: lsnCfg,
		router: router,

		stapler:       stapler,
		connTck:       connTck,
		autoCertCache: autoCertCache,
		serveWg:       wg,
		scopedRouter:  scopedRouter,
		state:         srvStateInit,
	}, nil
}
1175107
func (l *Logger) New(ctx *gear.Context) (interface{}, error) {
	log := Log{}
	l.init(log, ctx)
	return log, nil
}
256477
func New(config *Config) (*Service, error) {
	return NewWithProviders(
		config,
		&timetools.RealTime{},
		&random.CSPRNG{},
	)
}
1100889
func New() (FileWatcher, error) {
	if watcher, err := NewEventWatcher(); err == nil {
		return watcher, nil
	}
	return NewPollingWatcher(), nil
}
1164967
func New(transport runtime.ClientTransport, formats strfmt.Registry) *TodoList {
	// ensure nullable parameters have default
	if formats == nil {
		formats = strfmt.Default
	}

	cli := new(TodoList)
	cli.Transport = transport

	cli.Todos = todos.New(transport, formats)

	return cli
}
109756
func New(fw ChoriaProvider) (n *Notifier, err error) {
	n = &Notifier{
		fw:     fw,
		logger: fw.Logger("machine"),
	}

	return n, nil
}
597436
func New(lockerConfig config.Locker) error {
	var err error
	switch handlerName(lockerConfig.Handler) {
	case zookeeperHandler:
		handler, err = zookeeper.NewLocker(lockerConfig)
		return err
	case redisHandler:
		handler, err = redis.NewLocker(lockerConfig)
		return err
	default:
		handler = memlock.NewLocker()
	}
	return nil
}
1358195
func New(config Config) (*lock, error) {
	if err := config.Validate(); err != nil {
		return nil, errors.Trace(err)
	}
	lock := &lock{
		agent:       config.AgentName,
		clock:       config.Clock,
		logger:      config.Logger,
		logFilename: config.LogFilename,
		acquire:     mutex.Acquire,
		spec: mutex.Spec{
			Name:  "machine-lock",
			Clock: config.Clock,
			Delay: 250 * time.Millisecond,
			// Cancel is added in Acquire.
		},
		waiting: make(map[int]*info),
		history: deque.NewWithMaxLen(1000),
	}
	lock.setStartMessage()
	return lock, nil
}
972342
func New(tp TransactionPruner, interval time.Duration, clock clock.Clock) worker.Worker {
	return jworker.NewSimpleWorker(func(stopCh <-chan struct{}) error {
		for {
			select {
			case <-clock.After(interval):
				err := tp.MaybePruneTransactions()
				if err != nil {
					return errors.Annotate(err, "pruning failed, txnpruner stopping")
				}
			case <-stopCh:
				return nil
			}
		}
	})
}