// NewRateSet crates an empty `RateSet` instance.
514360
func NewRateSet() *RateSet {
	rs := new(RateSet)
	rs.m = make(map[time.Duration]*rate)
	return rs
}
323957
func (s *CreateRateBasedRuleInput) SetRateLimit(v int64) *CreateRateBasedRuleInput {
	s.RateLimit = &v
	return s
}
695634
func newDistanceSet() *distanceSet {
	return &distanceSet{
		MinDistance: math.MaxFloat64,
		Distances:   make(map[int]float64, 500), // adding 500 was a 20% performance win
	}
}
1346730
func NewRateLimitedTimedQueue(limiter flowcontrol.RateLimiter) *RateLimitedTimedQueue {
	return &RateLimitedTimedQueue{
		queue: UniqueQueue{
			queue: TimedQueue{},
			set:   sets.NewString(),
		},
		limiter: limiter,
	}
}
753688
func NewCoinSet(coins []Coin) *CoinSet {
	newCoinSet := &CoinSet{
		coinList:      list.New(),
		totalValue:    0,
		totalValueAge: 0,
	}
	for _, coin := range coins {
		newCoinSet.PushCoin(coin)
	}
	return newCoinSet
}
65755
func (tl *TokenLimiter) DefaultRates() *RateSet {
	defaultRates := NewRateSet()
	for _, r := range tl.defaultRates.m {
		defaultRates.Add(r.period, r.average, r.burst)
	}
	return defaultRates
}
917059
func New() *Pget {
	return &Pget{
		Trace:   false,
		Utils:   &Data{},
		Procs:   runtime.NumCPU(), // default
		timeout: 10,
	}
}
513216
func NewLimiter(defaultRates *RateSet, capacity int, mapper limit.MapperFn, configMapper ConfigMapperFn, clock timetools.TimeProvider) (*TokenLimiter, error) {
	if defaultRates == nil || len(defaultRates.m) == 0 {
		return nil, fmt.Errorf("Provide default rates")
	}
	if mapper == nil {
		return nil, fmt.Errorf("Provide mapper function")
	}

	// Set default values for optional fields.
	if capacity <= 0 {
		capacity = DefaultCapacity
	}
	if clock == nil {
		clock = &timetools.RealTime{}
	}

	bucketSets, err := ttlmap.NewMapWithProvider(DefaultCapacity, clock)
	if err != nil {
		return nil, err
	}

	return &TokenLimiter{
		defaultRates: defaultRates,
		mapper:       mapper,
		configMapper: configMapper,
		clock:        clock,
		bucketSets:   bucketSets,
	}, nil
}
639398
func NewRateScale(d time.Duration) *Rate {
	return &Rate{
		time:  time.Now().UnixNano(),
		unit:  d,
		count: NewCounter(),
	}
}
363648
func New(params *stripe.TaxRateParams) (*stripe.TaxRate, error) {
	return getC().New(params)
}
212114
func NewCustomSet(lessThan func(l, r interface{}) bool) *Set {
	return &Set{skiplist: SkipList{
		lessThan: lessThan,
		header: &node{
			forward: []*node{nil},
		},
		MaxLevel: DefaultMaxLevel,
	}}
}
192276
func newKeysets(c *KopsClient, namespace string) *keysets {
	return &keysets{
		client: c.RESTClient(),
		ns:     namespace,
	}
}
1121695
func newDaemonSets(c *AppsV1beta2Client, namespace string) *daemonSets {
	return &daemonSets{
		client: c.RESTClient(),
		ns:     namespace,
	}
}
910252
func NewFileSet() *FileSet {
	s := new(FileSet)
	s.base = 1 // 0 == NoPos
	s.index = make(map[*File]int)
	return s
}
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(),
	}
}
287380
func NewVersionSet(apiVersions ...string) VersionSet {
	vs := VersionSet{}
	for _, v := range apiVersions {
		vs[v] = struct{}{}
	}
	return vs
}
1132503
func NewFlagSet() *pflag.FlagSet {
	flags := &pflag.FlagSet{}

	flags.AddFlagSet(NewRootFlagSet())
	flags.AddFlagSet(NewServerFlagSet())
	flags.AddFlagSet(NewDBFlagSet())

	return flags
}