// NewPopulator returns a Populator object to update the PV cache
321357
func NewPopulator(config *common.RuntimeConfig) *Populator {
	p := &Populator{RuntimeConfig: config}
	sharedInformer := config.InformerFactory.Core().V1().PersistentVolumes()
	sharedInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
		AddFunc: func(obj interface{}) {
			pv, ok := obj.(*v1.PersistentVolume)
			if !ok {
				glog.Errorf("Added object is not a v1.PersistentVolume type")
				return
			}
			p.handlePVUpdate(pv)
		},
		UpdateFunc: func(oldObj, newObj interface{}) {
			newPV, ok := newObj.(*v1.PersistentVolume)
			if !ok {
				glog.Errorf("Updated object is not a v1.PersistentVolume type")
				return
			}
			p.handlePVUpdate(newPV)
		},
		DeleteFunc: func(obj interface{}) {
			pv, ok := obj.(*v1.PersistentVolume)
			if !ok {
				glog.Errorf("Added object is not a v1.PersistentVolume type")
				return
			}
			p.handlePVDelete(pv)
		},
	})
	return p
}
1190180
func NewPool(network, addr string, size int) (*Pool, error) {
	return NewCustomPool(network, addr, size, redis.Dial)
}
651501
func NewPoolCache() *poolCache {
	return &poolCache{
		mutex: sync.RWMutex{},
		dirty: true,
		pools: make([]pool.ReadPool, 0),
	}
}
814282
func NewPopulatedDevNonce(r Rand) (nonce *DevNonce) {
	nonce = &DevNonce{}
	if _, err := randRead(r, nonce[:]); err != nil {
		panic(fmt.Errorf("types.NewPopulatedDevNonce: %s", err))
	}
	return
}
1317110
func NewCache(capacity uint64) *Cache {
	return &Cache{
		capacity: capacity,
		ll:       list.New(),
		cache:    make(elementMap),
	}
}
381552
func (db *DB) newBuilder(executor Executor) Builder {
	builderFunc, ok := BuilderFuncMap[db.driverName]
	if !ok {
		builderFunc = NewStandardBuilder
	}
	return builderFunc(db, executor)
}
1346989
func NewCollector(options ...func(*Collector)) *Collector {
	c := &Collector{}
	c.Init()

	for _, f := range options {
		f(c)
	}

	c.parseSettingsFromEnv()

	return c
}
1070560
func NewPopulatedAppKey(r Rand) (key *AppKey) {
	key = &AppKey{}
	if _, err := randRead(r, key[:]); err != nil {
		panic(fmt.Errorf("types.NewPopulatedAppKey: %s", err))
	}
	return
}
779996
func NewCache(maxSize uint64) *Cache {
	c := &Cache{
		maxSize:      maxSize,
		store:        emptyStore{},
		lastSnapshot: time.Now(),
		tracker:      newCacheTracker(newCacheMetrics(nil), nil),
	}
	c.initialize.Store(&sync.Once{})
	return c
}
597548
func NewPool(parentCtx context.Context) *Pool {
	baseCtx, baseCancel := context.WithCancel(parentCtx)
	ctx, cancel := context.WithCancel(baseCtx)
	return &Pool{
		baseCtx:    baseCtx,
		baseCancel: baseCancel,
		ctx:        ctx,
		cancel:     cancel,
	}
}
374074
func NewAllocator(store kv.Storage, dbID int64, isUnsigned bool) Allocator {
	return &allocator{
		store:      store,
		dbID:       dbID,
		isUnsigned: isUnsigned,
	}
}
825239
func NewGenerator(seed int64) *Generator {
	r := rand.New(rand.NewSource(seed))
	return &Generator{
		r:     r,
		zs:    make(map[int]*rand.Zipf),
		times: make(map[time.Time]time.Duration),
		hsh:   sha1.New(),
	}
}
305960
func NewGenerator() (*Generator, error) {
	var g Generator
	_, err := rand.Read(g.seed[:])
	if err != nil {
		return nil, errors.New("cannot generate random seed: " + err.Error())
	}
	return &g, nil
}
565189
func NewUniformGenerator(seed int64) *UniformGenerator {
	return &UniformGenerator{mu: new(sync.Mutex), rd: rand.New(rand.NewSource(seed))}
}
939005
func NewPool(config Config) *ConnectionPool {
	p := &ConnectionPool{
		Config: config,
		pool:   make(chan *Connection, config.Size),
	}
	return p
}
241018
func NewPool(cluster []string) *Pool {
	rand.Seed(time.Now().UTC().UnixNano())
	nodeMap := make(map[string]*Node, len(cluster))

	for _, node := range cluster {
		newNode, err := NewNode(node, NODE_READ_RETRY, NODE_WRITE_RETRY)
		if err == nil {
			nodeMap[node] = newNode
		}
	}

	pool := &Pool{
		nodes: nodeMap,
	}

	return pool
}
728827
func New() *Cache {
	return &Cache{
		Zones:      []string{"."},
		pcap:       defaultCap,
		pcache:     cache.New(defaultCap),
		pttl:       maxTTL,
		minpttl:    minTTL,
		ncap:       defaultCap,
		ncache:     cache.New(defaultCap),
		nttl:       maxNTTL,
		minnttl:    minNTTL,
		prefetch:   0,
		duration:   1 * time.Minute,
		percentage: 10,
		now:        time.Now,
	}
}