// NewStringsWorker starts a new worker that runs a StringsHandler.
164914
func NewStringsWorker(config StringsConfig) (*StringsWorker, error) {
	if err := config.Validate(); err != nil {
		return nil, errors.Trace(err)
	}
	sw := &StringsWorker{
		config: config,
	}
	err := catacomb.Invoke(catacomb.Plan{
		Site: &sw.catacomb,
		Work: sw.loop,
	})
	if err != nil {
		return nil, errors.Trace(err)
	}
	return sw, nil
}
849082
func NewStringValue(s string) Value {
	value := &Value{}
	value.StoreString(s)
	return *value
}
1181661
func NewStringTokenizer(sql string) *Tokenizer {
	buf := []byte(sql)
	return &Tokenizer{
		buf:     buf,
		bufSize: len(buf),
	}
}
445311
func NewServer(handler http.Handler) *Server {
	ts := NewUnstartedServer(handler, "")
	ts.Start()
	return ts
}
535839
func NewStringSet(vs ...string) StringSet {
	s := &stringSet{make(map[string]struct{})}
	s.Add(vs...)
	return s
}
397799
func NewHandler(w io.Writer) events.Handler {
	var term bool

	if w == nil {
		return nil
	}

	if f, ok := w.(interface {
		Fd() uintptr
	}); ok {
		term = events.IsTerminal(int(f.Fd()))
	}

	if term {
		return text.NewHandler("", w)
	}
	return ecslogs.NewHandler(w)
}
1105454
func NewStringOrStringArrayWithStringArray(a []string) *StringOrStringArray {
	result := &StringOrStringArray{}
	result.StringArray = &a
	return result
}
697455
func newStringTokenStream() *StringTokenStream {
	ans := &StringTokenStream{TokenStreamImpl: analysis.NewTokenStream()}
	ans.termAttribute = ans.Attributes().Add("CharTermAttribute").(CharTermAttribute)
	ans.offsetAttribute = ans.Attributes().Add("OffsetAttribute").(OffsetAttribute)
	return ans
}
792583
func NewSocketWorker(wo *Websocket) *SocketWorker {
	data := make(chan interface{})

	sw := SocketWorker{
		wo:     wo,
		closer: make(chan bool),
		data:   data,
		queue:  flux.NewQueue(data),
	}

	go sw.manage()
	return &sw
}
654485
func NewString(into *string, v string) *StringValue {
	*into = v
	return (*StringValue)(into)
}
94777
func NewStringSet(ss []string) StringSet {
	res := StringSet{}
	for _, s := range ss {
		res[s] = struct{}{}
	}
	return res
}
669252
func NewSpanWorker(sinks []sinks.SpanSink, cl *trace.Client, statsd *statsd.Client, spanChan <-chan *ssf.SSFSpan, commonTags map[string]string) *SpanWorker {
	tags := make([]map[string]string, len(sinks))
	for i, sink := range sinks {
		tags[i] = map[string]string{
			"sink": sink.Name(),
		}
	}

	return &SpanWorker{
		SpanChan:        spanChan,
		sinks:           sinks,
		sinkTags:        tags,
		commonTags:      commonTags,
		cumulativeTimes: make([]int64, len(sinks)),
		traceClient:     cl,
		statsd:          statsd,
	}
}
1289869
func NewServer(readHandler func(filename string, rf io.ReaderFrom) error,
	writeHandler func(filename string, wt io.WriterTo) error) *Server {
	s := &Server{
		timeout:           defaultTimeout,
		retries:           defaultRetries,
		runGC:             make(chan []string),
		gcInterval:        1 * time.Minute,
		packetReadTimeout: 100 * time.Millisecond,
		readHandler:       readHandler,
		writeHandler:      writeHandler,
	}
	return s
}
1285283
func NewSetupHandler(b *SetupBackend) *SetupHandler {
	h := &SetupHandler{
		Router:            NewRouter(),
		Logger:            b.Logger,
		OnboardingService: b.OnboardingService,
	}
	h.HandlerFunc("POST", setupPath, h.handlePostSetup)
	h.HandlerFunc("GET", setupPath, h.isOnboarding)
	return h
}
14021
func NewServiceManager(
	isRunning func() bool,
	newService func(string, common.Conf) (Service, error),
) SystemdServiceManager {
	return &systemdServiceManager{
		isRunning:  isRunning,
		newService: newService,
	}
}
450954
func NewString(Expr node.Node) *String {
	return &String{
		FreeFloating: nil,
		Expr:         Expr,
	}
}
1010713
func newSpinner(text string, enabled bool) *Spinner {
	s := spinner.New(spinner.CharSets[9], 100*time.Millisecond)
	s.Suffix = " " + text
	return &Spinner{
		s,
		text,
		enabled,
	}
}