// New returns a new instance of Allocator for use during allocation
// stage of the manager.
964196
func New(store *store.MemoryStore, pg plugingetter.PluginGetter, netConfig *cnmallocator.NetworkConfig) (*Allocator, error) {
	a := &Allocator{
		store: store,
		taskBallot: &taskBallot{
			votes: make(map[string][]string),
		},
		stopChan:      make(chan struct{}),
		doneChan:      make(chan struct{}),
		pluginGetter:  pg,
		networkConfig: netConfig,
	}

	return a, nil
}
1142137
func New(processor func(Job), jobBufsize int, maxIdle, maxActive uint64) *Pool {
	p := &Pool{
		processor: processor,
		jobs:      make(chan Job, jobBufsize),
		maxIdle:   maxIdle,
		maxActive: maxActive,
	}
	return p
}
1147550
func New(w io.Writer, opts *BuilderOpts) (*Builder, error) {
	return newBuilder(w, opts)
}
60403
func New(initializer Initializer) *Value {
	f := &Value{
		initializer: initializer,
	}
	f.Lock()
	return f
}
1129070
func New(workers int, jobQueue ...int) *WorkerPool {
	q := 0
	if len(jobQueue) > 0 && jobQueue[0] > 0 {
		q = jobQueue[0]
	}
	if workers < 0 {
		workers = runtime.NumCPU()
	}
	pool := WorkerPool{
		pool: make(chan chan func(), workers),
		jobs: make(chan func(), q),
		quit: make(chan struct{}),
		wg:   sync.WaitGroup{},
	}
	for i := 0; i < workers; i++ {
		initWorker(pool.pool, 0, nil, pool.quit, &pool.wg)
	}
	go pool.dispatch()
	return &pool
}
164709
func New(c *Config) *manager {
	ctx, cancel := context.WithCancel(context.Background())
	return &manager{
		logger:           c.Logger.Named("device_mgr"),
		state:            c.State,
		ctx:              ctx,
		cancel:           cancel,
		loader:           c.Loader,
		pluginConfig:     c.PluginConfig,
		updater:          c.Updater,
		instances:        make(map[loader.PluginID]*instanceManager),
		reattachConfigs:  make(map[loader.PluginID]*pstructs.ReattachConfig),
		fingerprintResCh: make(chan struct{}, 1),
	}
}
616717
func New(state state.State, config *config.BalancerConfig) (Allocator, error) {
	var rangeCursor *ipaddr.Cursor
	var err error

	ranges := strings.Join(config.Ipam.Ranges, ",")
	if ranges != "" {
		rangeCursor, err = ipaddr.Parse(ranges)
		if err != nil {
			return nil, errors.Wrap(err, "error parsing IPAM ranges")
		}
	}

	return &Ipam{rangeCursor, state, config}, nil
}
55835
func New(parsedConfig *Config, manager *plugins.Manager) *Plugin {

	plugin := &Plugin{
		manager:  manager,
		config:   *parsedConfig,
		stop:     make(chan chan struct{}),
		buffer:   newLogBuffer(*parsedConfig.Reporting.BufferSizeLimitBytes),
		enc:      newChunkEncoder(*parsedConfig.Reporting.UploadSizeLimitBytes),
		reconfig: make(chan interface{}),
	}

	return plugin
}
933700
func NewAllocatorForGC(basePath string) *Allocator {
	return &Allocator{
		idPrefix:    path.Join(basePath, "id"),
		valuePrefix: path.Join(basePath, "value"),
		lockPrefix:  path.Join(basePath, "locks"),
	}
}
1175107
func (l *Logger) New(ctx *gear.Context) (interface{}, error) {
	log := Log{}
	l.init(log, ctx)
	return log, nil
}
172227
func New() Definition {
	var q Definition
	q.Where = make(map[string]interface{})
	q.Sort = make(map[string]interface{})
	return q
}
888268
func New(id string) *ResourcePool {
	pool := &ResourcePool{}
	pool.ID = id

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

	return n, nil
}
1358873
func New(framework *choria.Framework, logger *logrus.Entry) *Manager {
	return &Manager{
		fw:  framework,
		cfg: framework.Config,
		log: logger.WithFields(logrus.Fields{"subsystem": "discovery"}),
	}
}
177915
func New(logger *log.Logger, shutdownCh chan struct{}, clusterInfo ManagerSerfCluster, connPoolPinger Pinger) (m *Manager) {
	m = new(Manager)
	m.logger = logger
	m.clusterInfo = clusterInfo       // can't pass *consul.Client: import cycle
	m.connPoolPinger = connPoolPinger // can't pass *consul.ConnPool: import cycle
	m.rebalanceTimer = time.NewTimer(clientRPCMinReuseDuration)
	m.shutdownCh = shutdownCh
	atomic.StoreInt32(&m.offline, 1)

	l := serverList{}
	l.servers = make([]*metadata.Server, 0)
	m.saveServerList(l)
	return m
}
35722
func New() *Digester {
	d := _digesterPool.Get().(*Digester)
	d.bs = d.bs[:0]
	return d
}
374074
func NewAllocator(store kv.Storage, dbID int64, isUnsigned bool) Allocator {
	return &allocator{
		store:      store,
		dbID:       dbID,
		isUnsigned: isUnsigned,
	}
}