// New creates a new PubSub and starts a goroutine for handling operations.
// The capacity of the channels created by Sub and SubOnce will be as specified.
492181
func New(capacity int) *PubSub {
	ps := &PubSub{make(chan cmd), capacity}
	go ps.start()
	return ps
}
553407
func (r *TasksService) New(swarmingrpcsnewtaskrequest *SwarmingRpcsNewTaskRequest) *TasksNewCall {
	c := &TasksNewCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.swarmingrpcsnewtaskrequest = swarmingrpcsnewtaskrequest
	return c
}
1350944
func New() (m *MultipartStreamer) {
	m = &MultipartStreamer{bodyBuffer: new(bytes.Buffer)}

	m.bodyWriter = multipart.NewWriter(m.bodyBuffer)
	boundary := m.bodyWriter.Boundary()
	m.ContentType = "multipart/form-data; boundary=" + boundary

	closeBoundary := fmt.Sprintf("\r\n--%s--\r\n", boundary)
	m.closeBuffer = bytes.NewBufferString(closeBoundary)

	return
}
365350
func New(transport peer.Transport, opts ...HeapOption) *List {
	cfg := defaultHeapConfig
	for _, o := range opts {
		o(&cfg)
	}

	return &List{
		once:               lifecycle.NewOnce(),
		transport:          transport,
		byIdentifier:       make(map[string]*peerScore),
		peerAvailableEvent: make(chan struct{}, 1),
		startupWait:        cfg.startupWait,
	}
}
1077026
func New(requests chan *choria.ConnectorMessage, fw *choria.Framework, conn choria.ConnectorInfo, srv ServerInfoSource, log *logrus.Entry) *Manager {
	return &Manager{
		agents:     make(map[string]Agent),
		subs:       make(map[string][]string),
		fw:         fw,
		log:        log.WithFields(logrus.Fields{"subsystem": "agents"}),
		mu:         &sync.Mutex{},
		requests:   requests,
		conn:       conn,
		serverInfo: srv,
	}
}
400004
func New() (*DisallowFlunder, error) {
	return &DisallowFlunder{
		Handler: admission.NewHandler(admission.Create),
	}, nil
}
447155
func New(config *genesisconfig.Profile) *Bootstrapper {
	channelGroup, err := NewChannelGroup(config)
	if err != nil {
		logger.Panicf("Error creating channel group: %s", err)
	}
	return &Bootstrapper{
		channelGroup: channelGroup,
	}
}
1186849
func New(dsn string, options ...Option) (*Rabbus, error) {
	r := &Rabbus{
		emit:       make(chan Message),
		emitErr:    make(chan error),
		emitOk:     make(chan struct{}),
		reconn:     make(chan struct{}),
		exDeclared: make(map[string]struct{}),
	}

	for _, o := range options {
		if err := o(r); err != nil {
			return nil, err
		}
	}

	if r.Amqp == nil {
		amqpWrapper, err := amqpWrap.New(dsn, r.config.isExchangePassive)
		if err != nil {
			return nil, err
		}
		r.Amqp = amqpWrapper
	}

	if err := r.WithQos(
		r.config.qos.prefetchCount,
		r.config.qos.prefetchSize,
		r.config.qos.global,
	); err != nil {
		return nil, err
	}

	r.config.dsn = dsn
	r.breaker = gobreaker.NewCircuitBreaker(newBreakerSettings(r.config))

	return r, nil
}
251120
func New(name string, transport peer.Transport, availableChooser peer.ListImplementation, opts ...ListOption) *List {
	options := defaultListOptions
	for _, o := range opts {
		o.apply(&options)
	}

	return &List{
		once:               lifecycle.NewOnce(),
		name:               name,
		uninitializedPeers: make(map[string]peer.Identifier, options.capacity),
		unavailablePeers:   make(map[string]*peerThunk, options.capacity),
		availablePeers:     make(map[string]*peerThunk, options.capacity),
		availableChooser:   availableChooser,
		transport:          transport,
		noShuffle:          options.noShuffle,
		randSrc:            rand.NewSource(options.seed),
		peerAvailableEvent: make(chan struct{}, 1),
	}
}
324336
func New(params *stripe.SubscriptionScheduleParams) (*stripe.SubscriptionSchedule, error) {
	return getC().New(params)
}
1367486
func New(msg string, args ...interface{}) *Error {
	return &Error{
		msg:   fmt.Sprintf(msg, args...),
		stack: debug.Stack(),
		level: 0,
	}
}
960487
func New(queueID uint16, maxPacketsInQueue uint32, packetSize uint32) (nfq *Queue, err error) {
	nfq = &Queue{
		ID: queueID,
		// TODO: what should the chan size be?
		packets: make(chan *RawPacket, 1024),
	}
	var ret C.int

	defer func() {
		if err != nil && nfq != nil {
			if nfq.qh != nil {
				C.nfq_destroy_queue(nfq.qh)
			}

			if nfq.h != nil {
				C.nfq_close(nfq.h)
			}
		}
	}()

	if nfq.h, err = C.nfq_open(); err != nil {
		err = errors.Wrap(err, "netfilter: unable to open nfq queue handle.")
		return
	}

	if ret, err = C.nfq_unbind_pf(nfq.h, AF_INET); err != nil || ret < 0 {
		err = errors.Wrap(err, "netfilter: unable to unbind existing nfq handler.")
		return
	}

	if ret, err = C.nfq_bind_pf(nfq.h, AF_INET); err != nil || ret < 0 {
		err = errors.Wrap(err, "netfilter: unable to bind to AF_INET protocol family.")
		return
	}

	if nfq.qh, err = C.CreateQueue(nfq.h, C.u_int16_t(queueID)); err != nil || nfq.qh == nil {
		err = errors.Wrap(err, "netfilter: unable to create nfq queue.")
		return
	}

	if ret, err = C.nfq_set_queue_maxlen(nfq.qh, C.u_int32_t(maxPacketsInQueue)); err != nil || ret < 0 {
		err = errors.Wrap(err, "netfilter: unable to set nfq max queue length.")
		return
	}

	if C.nfq_set_mode(nfq.qh, C.u_int8_t(2), C.uint(packetSize)) < 0 {
		err = errors.Wrap(err, "netfilter: unable to set packet copy mode.")
		return
	}

	if nfq.fd, err = C.nfq_fd(nfq.h); err != nil {
		err = errors.Wrap(err, "netfilter: unable to get nfq queue file-descriptor.")
		return

	}

	// TODO: error handling
	// me: https://i.imgur.com/Lmy5P.gif
	C.nfnl_rcvbufsiz(C.nfq_nfnlh(nfq.h), 1024*16384)

	// register this queue object with the global dispatcher
	register(queueID, nfq.packets)

	return
}
918640
func New(client *gumble.Client, source Source) *Stream {
	return &Stream{
		client:  client,
		Volume:  1.0,
		Source:  source,
		Command: "ffmpeg",
		pause:   make(chan struct{}),
		state:   StateInitial,
	}
}
836138
func New(ctx context.Context, h HandlerC) http.Handler {
        return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
                h.ServeHTTPC(ctx, w, r.WithContext(ctx))
        })
}
561583
func New(redisURI string, min, max uint) (*Raus, error) {
	var s int64
	if err := binary.Read(crand.Reader, binary.LittleEndian, &s); err != nil {
		s = time.Now().UnixNano()
	}
	if min >= max {
		return nil, errors.New("max should be greater than min")
	}
	op, ns, err := ParseRedisURI(redisURI)
	if err != nil {
		return nil, err
	}

	return &Raus{
		rand:          rand.New(rand.NewSource(s)),
		uuid:          uuid.NewV4().String(),
		min:           min,
		max:           max,
		redisOptions:  op,
		namespace:     ns,
		pubSubChannel: ns + pubSubChannelSuffix,
		channel:       make(chan error, 0),
	}, nil
}
162833
func New(streamName string, opts ...Option) (*Consumer, error) {
	if streamName == "" {
		return nil, fmt.Errorf("must provide stream name")
	}

	// new consumer with no-op checkpoint, counter, and logger
	c := &Consumer{
		streamName:               streamName,
		initialShardIteratorType: kinesis.ShardIteratorTypeLatest,
		checkpoint:               &noopCheckpoint{},
		counter:                  &noopCounter{},
		logger: &noopLogger{
			logger: log.New(ioutil.Discard, "", log.LstdFlags),
		},
	}

	// override defaults
	for _, opt := range opts {
		opt(c)
	}

	// default client if none provided
	if c.client == nil {
		newSession, err := session.NewSession(aws.NewConfig())
		if err != nil {
			return nil, err
		}
		c.client = kinesis.New(newSession)
	}

	return c, nil
}
527384
func New(session *session.Session) *Lambda {
	fmt.Printf("\n")
	return &Lambda{
		Lambda: lambda.New(session),
	}
}