// New returns a new CopyPropagator that optimizes queries while preserving vars
// in the livevars set.
482101
func New(livevars ast.VarSet) *CopyPropagator {

	sorted := make([]ast.Var, 0, len(livevars))
	for v := range livevars {
		sorted = append(sorted, v)
	}

	sort.Slice(sorted, func(i, j int) bool {
		return sorted[i].Compare(sorted[j]) < 0
	})

	return &CopyPropagator{livevars: livevars, sorted: sorted}
}
11830
func New() (clone *Clone) {
	clone = &Clone{}
	clone.pipe, _ = zmq.NewSocket(zmq.PAIR)
	pipename := fmt.Sprint("inproc://pipe", pipe_nmb)
	pipe_nmb++
	clone.pipe.Bind(pipename)
	go clone_agent(pipename)
	return
}
763518
func New(c Config) (*Globber, error) {
	hasmeta, err := c.metaRegexp()
	if err != nil {
		return nil, err
	}
	return &Globber{c, hasmeta}, nil
}
1364426
func New(opt Opt) (exporter.Exporter, error) {
	im := &imageExporter{opt: opt}
	return im, nil
}
183414
func New(ctx context.Context, store storage.Store, stm *semantic.Statement, chanSize, bulkSize int, w io.Writer) (Executor, error) {
	switch stm.Type() {
	case semantic.Query:
		return newQueryPlan(ctx, store, stm, chanSize, w)
	case semantic.Insert:
		return &insertPlan{
			stm:    stm,
			store:  store,
			tracer: w,
		}, nil
	case semantic.Delete:
		return &deletePlan{
			stm:    stm,
			store:  store,
			tracer: w,
		}, nil
	case semantic.Create:
		return &createPlan{
			stm:    stm,
			store:  store,
			tracer: w,
		}, nil
	case semantic.Drop:
		return &dropPlan{
			stm:    stm,
			store:  store,
			tracer: w,
		}, nil
	case semantic.Construct:
		qp, _ := newQueryPlan(ctx, store, stm, chanSize, w)
		return &constructPlan{
			stm:       stm,
			store:     store,
			tracer:    w,
			bulkSize:  bulkSize,
			queryPlan: qp,
			construct: true,
		}, nil
	case semantic.Deconstruct:
		qp, _ := newQueryPlan(ctx, store, stm, chanSize, w)
		return &constructPlan{
			stm:       stm,
			store:     store,
			tracer:    w,
			bulkSize:  bulkSize,
			queryPlan: qp,
			construct: false,
		}, nil
	case semantic.Show:
		return &showPlan{
			stm:    stm,
			store:  store,
			tracer: w,
		}, nil
	default:
		return nil, fmt.Errorf("planner.New: unknown statement type in statement %v", stm)
	}
}
191485
func New(constructorsAndValues ...interface{}) *Psyringe {
	p := newPsyringe()
	if err := p.addErr(constructorsAndValues...); err != nil {
		panic(err)
	}
	return p
}
400004
func New() (*DisallowFlunder, error) {
	return &DisallowFlunder{
		Handler: admission.NewHandler(admission.Create),
	}, nil
}
475486
func New(exec utilexec.Interface) Interface {
	handle, err := libipvs.New("")
	if err != nil {
		klog.Errorf("IPVS interface can't be initialized, error: %v", err)
		return nil
	}
	return &runner{
		exec:       exec,
		ipvsHandle: handle,
	}
}
714000
func New(config Config) *Producer {
	config.defaults()
	return &Producer{
		Config:  config,
		records: make(chan *k.PutRecordsRequestEntry, config.BacklogSize),
		done:    make(chan struct{}),
	}
}
487826
func (c completedConfig) New() (*WardleServer, error) {
	genericServer, err := c.GenericConfig.New("sample-apiserver", genericapiserver.NewEmptyDelegate())
	if err != nil {
		return nil, err
	}

	s := &WardleServer{
		GenericAPIServer: genericServer,
	}

	apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(wardle.GroupName, Scheme, metav1.ParameterCodec, Codecs)

	v1alpha1storage := map[string]rest.Storage{}
	v1alpha1storage["flunders"] = wardleregistry.RESTInPeace(flunderstorage.NewREST(Scheme, c.GenericConfig.RESTOptionsGetter))
	v1alpha1storage["fischers"] = wardleregistry.RESTInPeace(fischerstorage.NewREST(Scheme, c.GenericConfig.RESTOptionsGetter))
	apiGroupInfo.VersionedResourcesStorageMap["v1alpha1"] = v1alpha1storage

	v1beta1storage := map[string]rest.Storage{}
	v1beta1storage["flunders"] = wardleregistry.RESTInPeace(flunderstorage.NewREST(Scheme, c.GenericConfig.RESTOptionsGetter))
	apiGroupInfo.VersionedResourcesStorageMap["v1beta1"] = v1beta1storage

	if err := s.GenericAPIServer.InstallAPIGroup(&apiGroupInfo); err != nil {
		return nil, err
	}

	return s, nil
}
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
}
1219735
func New(destinations *consistent.Consistent, opts ...Option) (*Server, error) {
	res := &Server{
		Server: grpc.NewServer(),
		opts: &options{
			forwardTimeout: defaultForwardTimeout,
			statsInterval:  defaultReportStatsInterval,
		},
		conns:               newClientConnMap(grpc.WithInsecure()),
		activeProxyHandlers: new(int64),
	}

	for _, opt := range opts {
		opt(res.opts)
	}

	if res.opts.log == nil {
		log := logrus.New()
		log.Out = ioutil.Discard
		res.opts.log = logrus.NewEntry(log)
	}

	if err := res.SetDestinations(destinations); err != nil {
		return nil, fmt.Errorf("failed to set the destinations: %v", err)
	}

	forwardrpc.RegisterForwardServer(res.Server, res)

	return res, nil
}
553718
func New(org, project string, envs, services, identities, instances []string) (*PathExp, error) {
	return newPathexp(org, project, envs, services, identities, instances, true)
}
573991
func New(db *xorm.Engine, options *Options, migrations []*Migration) *Migrate {
	return &Migrate{
		db:         db,
		options:    options,
		migrations: migrations,
	}
}
53534
func (s *DB) New() *DB {
	clone := s.clone()
	clone.search = nil
	clone.Value = nil
	return clone
}
1077416
func New(port string, baud int) *serialRecorder {
	return &serialRecorder{
		port:        port,
		baud:        baud,
		Logger:      os.Stdout,
		writeBuffer: make(chan *Row, 100),
	}
}
813412
func New(c *client.Client, prefix string) *Record {
	return &Record{c, prefix}
}