// NewDiscrete creates a Discrete resource
355532
func NewDiscrete(key string, val int64) *api.GenericResource {
	return &api.GenericResource{
		Resource: &api.GenericResource_DiscreteResourceSpec{
			DiscreteResourceSpec: &api.DiscreteGenericResource{
				Kind:  key,
				Value: val,
			},
		},
	}
}
90190
func NewCreate(ctx *Context, stmt *rel.SqlCreate) *Create {
	return &Create{Stmt: stmt, PlanBase: NewPlanBase(false), Ctx: ctx}
}
345395
func New(rate int, per time.Duration) *RateLimiter {
	nano := uint64(per)
	if nano < 1 {
		nano = uint64(time.Second)
	}
	if rate < 1 {
		rate = 1
	}

	return &RateLimiter{
		rate:      uint64(rate),        // store the rate
		allowance: uint64(rate) * nano, // set our allowance to max in the beginning
		max:       uint64(rate) * nano, // remember our maximum allowance
		unit:      nano,                // remember our unit size

		lastCheck: unixNano(),
	}
}
48183
func NewNonCumulativeDistribution(name string, description string, metadata *types.MetricMetadata, bucketer *distribution.Bucketer, fields ...field.Field) NonCumulativeDistribution {
	if metadata == nil {
		metadata = &types.MetricMetadata{}
	}
	m := &nonCumulativeDistributionMetric{
		metric: metric{
			MetricInfo: types.MetricInfo{
				Name:        name,
				Description: description,
				Fields:      fields,
				ValueType:   types.NonCumulativeDistributionType,
			},
			MetricMetadata: *metadata,
		},
		bucketer: bucketer,
	}
	registry.Add(m)
	return m
}
729022
func NewGeoDistanceSort(fieldName string) GeoDistanceSort {
	return GeoDistanceSort{
		fieldName: fieldName,
		points:    make([]*GeoPoint, 0),
		geohashes: make([]string, 0),
		ascending: true,
	}
}
326746
func New(query string, distance int) (*Levenshtein, error) {
	lev := &dynamicLevenshtein{
		query:    query,
		distance: uint(distance),
	}
	dfabuilder := newDfaBuilder(lev)
	dfa, err := dfabuilder.build()
	if err != nil {
		return nil, err
	}
	return &Levenshtein{
		prog: lev,
		dfa:  dfa,
	}, nil
}
267807
func NewDisque(servers []string, cycle int) *Disque {
	return &Disque{
		servers: servers,
		cycle:   cycle,
		nodes:   make(map[string]string),
		stats:   make(map[string]int),
	}
}
38295
func NewResource(bucketName, keyName string) Resource {
	pattern := bucketName
	if keyName != "" {
		if !strings.HasPrefix(keyName, "/") {
			pattern += "/"
		}

		pattern += keyName
	}

	return Resource{
		BucketName: bucketName,
		Pattern:    pattern,
	}
}
1046332
func NewDeque(capacity int) *LinkedBlockingDeque {
	if capacity < 0 {
		panic(errors.New("capacity must > 0"))
	}
	lock := new(sync.Mutex)
	return &LinkedBlockingDeque{capacity: capacity, lock: lock, notEmpty: concurrent.NewTimeoutCond(lock), notFull: concurrent.NewTimeoutCond(lock)}
}
1016350
func New(num int, rate float64, depth uint64) *Filter {
	b := new(Filter)
	if depth <= 0 {
		panic("depth of bucket must be greater than 0")
	}
	b.touchCost = uint64((float64(1*time.Second) / rate))
	b.creditMax = depth * b.touchCost
	b.items = make([]item, num)

	// Not the full range of a uint64, but we can
	// live with 2 bits of entropy missing
	b.key0 = uint64(rand.Int63())
	b.key1 = uint64(rand.Int63())

	return b
}
630663
func New(params *stripe.PlanParams) (*stripe.Plan, error) {
	return getC().New(params)
}
1185229
func NewCreateMultisigCmd(nRequired int, keys []string) *CreateMultisigCmd {
	return &CreateMultisigCmd{
		NRequired: nRequired,
		Keys:      keys,
	}
}
36046
func newDisseminator(n *Node) *disseminator {
	d := &disseminator{
		node:                n,
		changes:             make(map[string]*pChange),
		maxP:                defaultPFactor,
		pFactor:             defaultPFactor,
		logger:              logging.Logger("disseminator").WithField("local", n.Address()),
		reverseFullSyncJobs: make(chan struct{}, n.maxReverseFullSyncJobs),
	}

	return d
}
1244889
func NewDiskIndexWriter(f *os.File) IndexWriter {
	return &directIndex{fd: f, w: bufio.NewWriterSize(f, 1024*1024)}
}
969225
func NewDisjunctionQuery(queries ...FtsQuery) *DisjunctionQuery {
	q := &DisjunctionQuery{newFtsQueryBase()}
	q.options["disjuncts"] = []FtsQuery{}
	return q.Or(queries...)
}
555759
func NewDeterministicGenesis(seed int64) *deterministicGenesis {
	return &deterministicGenesis{
		random: rand.New(rand.NewSource(seed)),
	}
}
521922
func New(size, count int) *Pool {
	return NewEndian(size, count, binary.BigEndian)
}