// New returns an instance of Limiter.
512562
func New(store Store, rate Rate, options ...Option) *Limiter {
	opt := Options{
		IPv4Mask:           DefaultIPv4Mask,
		IPv6Mask:           DefaultIPv6Mask,
		TrustForwardHeader: false,
	}
	for _, o := range options {
		o(&opt)
	}
	return &Limiter{
		Store:   store,
		Rate:    rate,
		Options: opt,
	}
}
756150
func New(r io.Reader, prefix string) *Prefixer {
	return &Prefixer{
		reader: bufio.NewReader(r),
		prefix: []byte(prefix),
	}
}
664719
func New() *DefaultLoader {
	loader := MultiLoader(
		&TagLoader{},
		&EnvironmentLoader{},
		&FlagLoader{},
	)

	d := &DefaultLoader{}
	d.Loader = loader
	d.Validator = MultiValidator(&RequiredValidator{})
	return d
}
486190
func New(limit int, interval time.Duration) *RateLimiter {
	lim := &RateLimiter{
		limit:    limit,
		interval: interval,
	}
	lim.times.Init()
	return lim
}
1191935
func New(client *consul.Client) *ConsulLocker {
	return &ConsulLocker{
		Client: client,
		locks:  make(map[string]*consul.Lock),
		mutex:  new(sync.RWMutex),
	}
}
289736
func New(dialer httpstream.Dialer, ports []string, stopChan <-chan struct{}) (*PortForwarder, error) {
	if len(ports) == 0 {
		return nil, errors.New("You must specify at least 1 port")
	}
	parsedPorts, err := parsePorts(ports)
	if err != nil {
		return nil, err
	}
	return &PortForwarder{
		dialer:   dialer,
		ports:    parsedPorts,
		stopChan: stopChan,
		Ready:    make(chan struct{}),
	}, nil
}
9449
func New(s store.Store, ctx context.Context) (watcher.Watcher, error) {
	ret := &ContainerWatcher{
		invertsTable: make(map[string]string),
	}
	base, err := watcher.New(s, ctx, KEY, ret.convert, ret.invertKey)
	if err != nil {
		return nil, err
	}
	ret.BaseWatcher = *base
	return ret, nil
}
451977
func NewLimiter(max float64, tbOptions *limiter.ExpirableOptions) *limiter.Limiter {
	return limiter.New(tbOptions).SetMax(max).SetBurst(int(math.Max(1, max)))
}
874015
func New(r *uid.Range, factory allocator.AllocatorFactory) *Allocator {
	return &Allocator{
		r:     r,
		alloc: factory(int(r.Size()), r.String()),
	}
}
115203
func New(total, pagingNum, current, numPages int) *Paginater {
	if pagingNum <= 0 {
		pagingNum = 1
	}
	if current <= 0 {
		current = 1
	}
	p := &Paginater{total, pagingNum, current, numPages}
	if p.current > p.TotalPages() {
		p.current = p.TotalPages()
	}
	return p
}
278510
func New(ctx context.Context, c *isolatedclient.Client, hash isolated.HexDigest,
	outputDir string, options *Options) *Downloader {

	var opt Options
	if options != nil {
		opt = *options
	}
	if opt.MaxConcurrentJobs == 0 {
		opt.MaxConcurrentJobs = 8
	}
	if opt.MaxFileStatsInterval == 0 {
		opt.MaxFileStatsInterval = time.Second * 5
	}

	interval := 100 * time.Millisecond
	if interval > opt.MaxFileStatsInterval {
		interval = opt.MaxFileStatsInterval
	}

	ctx2, cancel := context.WithCancel(ctx)
	ret := &Downloader{
		ctx:       ctx2,
		cancel:    cancel,
		c:         c,
		options:   opt,
		interval:  interval,
		dirCache:  stringset.New(0),
		rootHash:  hash,
		outputDir: normalizePathSeparator(outputDir),
		isoMap:    map[isolated.HexDigest]*isolated.Isolated{},
	}
	return ret
}
1281692
func New() *Writer {
	termWidth, _ = getTermSize()
	if termWidth != 0 {
		overFlowHandled = true
	}

	return &Writer{
		Out:             Out,
		RefreshInterval: RefreshInterval,

		mtx: &sync.Mutex{},
	}
}
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(),
	}
}
85097
func New(client docker.Client, config *api.Config, fs fs.FileSystem, scripts build.ScriptsHandler, overrides build.Overrides) (*Layered, error) {
	excludePattern, err := regexp.Compile(config.ExcludeRegExp)
	if err != nil {
		return nil, err
	}

	d := docker.New(client, config.PullAuthentication)
	tarHandler := tar.New(fs)
	tarHandler.SetExclusionPattern(excludePattern)

	return &Layered{
		docker:  d,
		config:  config,
		fs:      fs,
		tar:     tarHandler,
		scripts: scripts,
	}, nil
}
897677
func (f FileSystemJSONLoaderFactory) New(source string) JSONLoader {
	return &jsonReferenceLoader{
		fs:     f.fs,
		source: source,
	}
}
1185365
func New(settings SettingsManager, registry storage.ProviderRegistry) PoolManager {
	return &poolManager{settings, registry}
}
1002035
func New(config types.Config) (*Potassium, error) {
	return &Potassium{config.Scheduler.MaxShare, config.Scheduler.ShareBase}, nil
}