// newPipeSet connects to the provided pipe addresses
973529
func newPipeSet(ctx context.Context, stdin, stdout, stderr string, terminal bool) (*pipeSet, error) {
	var (
		err error
		set = &pipeSet{}
	)

	defer func() {
		if err != nil {
			set.Close()
		}
	}()

	g, _ := errgroup.WithContext(ctx)

	dialfn := func(name string, conn *net.Conn) error {
		if name == "" {
			return nil
		}
		dialTimeout := 3 * time.Second
		c, err := winio.DialPipe(name, &dialTimeout)
		if err != nil {
			return errors.Wrapf(err, "failed to connect to %s", name)
		}
		*conn = c
		return nil
	}

	g.Go(func() error {
		return dialfn(stdin, &set.stdin)
	})
	g.Go(func() error {
		return dialfn(stdout, &set.stdout)
	})
	g.Go(func() error {
		return dialfn(stderr, &set.stderr)
	})

	err = g.Wait()
	if err != nil {
		return nil, err
	}
	return set, nil
}
1271188
func NewResultSet() *ResultSet {
	return &ResultSet{
		Fields:    make([]string, 0),
		Values:    make([]*reflect.Value, 0),
		NameIndex: make(map[string]int),
		Length:    0,
	}
}
882257
func (r RedisPipeline) MGet(keys ...string) *redis.SliceCmd {
	return r.pipeline.MGet(keys...)
}
728633
func NetPipe() (net.Conn, net.Conn, error) {
	p1, p2 := net.Pipe()
	return p1, p2, nil
}
192276
func newKeysets(c *KopsClient, namespace string) *keysets {
	return &keysets{
		client: c.RESTClient(),
		ns:     namespace,
	}
}
980103
func (runner *runner) createSet(set *IPSet, ignoreExistErr bool) error {
	args := []string{"create", set.Name, string(set.SetType)}
	if set.SetType == HashIPPortIP || set.SetType == HashIPPort || set.SetType == HashIPPortNet {
		args = append(args,
			"family", set.HashFamily,
			"hashsize", strconv.Itoa(set.HashSize),
			"maxelem", strconv.Itoa(set.MaxElem),
		)
	}
	if set.SetType == BitmapPort {
		args = append(args, "range", set.PortRange)
	}
	if ignoreExistErr {
		args = append(args, "-exist")
	}
	if _, err := runner.exec.Command(IPSetCmd, args...).CombinedOutput(); err != nil {
		return fmt.Errorf("error creating ipset %s, error: %v", set.Name, err)
	}
	return nil
}
883533
func NewWordSet(a ...string) WordSet {
	s := make(WordSet)
	for _, i := range a {
		s.Add(i)
	}
	return s
}
1126195
func (s *ListPipelinesOutput) SetPipelines(v []*PipelineSummary) *ListPipelinesOutput {
	s.Pipelines = v
	return s
}
1132503
func NewFlagSet() *pflag.FlagSet {
	flags := &pflag.FlagSet{}

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

	return flags
}
1372836
func NewDirectIOFromFIFOSet(ctx context.Context, stdin io.WriteCloser, stdout, stderr io.ReadCloser, fifos *FIFOSet) *DirectIO {
	_, cancel := context.WithCancel(ctx)
	pipes := pipes{
		Stdin:  stdin,
		Stdout: stdout,
		Stderr: stderr,
	}
	return &DirectIO{
		pipes: pipes,
		cio: cio{
			config:  fifos.Config,
			closers: append(pipes.closers(), fifos),
			cancel:  cancel,
		},
	}
}
180664
func newRecordset(recSize, goroutines int, taskID uint64) *Recordset {
	var nilChan chan *struct{}

	rs := &Recordset{
		Records:   make(chan *Record, recSize),
		objectset: *newObjectset(reflect.ValueOf(nilChan), goroutines, taskID),
	}

	runtime.SetFinalizer(rs, recordsetFinalizer)
	return rs
}
1100491
func newFlagSetWithGlobals() *pflag.FlagSet {
	fs := pflag.NewFlagSet("", pflag.ExitOnError)
	// set the normalize func, similar to k8s.io/component-base/cli//flags.go:InitFlags
	fs.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
	// explicitly add flags from libs that register global flags
	options.AddGlobalFlags(fs)
	return fs
}
212114
func NewCustomSet(lessThan func(l, r interface{}) bool) *Set {
	return &Set{skiplist: SkipList{
		lessThan: lessThan,
		header: &node{
			forward: []*node{nil},
		},
		MaxLevel: DefaultMaxLevel,
	}}
}
1346942
func (s *Service) PipelineCreate(ctx context.Context, o PipelineCreateOpts) (*Pipeline, error) {
	var pipeline Pipeline
	return &pipeline, s.Post(ctx, &pipeline, fmt.Sprintf("/pipelines"), o)
}
1303948
func NewPipeBomb() (*Pipebomb, io.WriteCloser) {
	writerOutput, writerInput := io.Pipe()
	return &Pipebomb{ReadCloser: writerOutput}, writerInput
}
1050014
func NewRwSet(ccID string) *rwsetutil.NsRwSet {
	return &rwsetutil.NsRwSet{
		NameSpace:        ccID,
		KvRwSet:          &kvrwset.KVRWSet{},
		CollHashedRwSets: nil,
	}
}
643511
func newPipeline(input, retry, output chan *utils.Message) *pipeline {
	return &pipeline{
		input:  input,
		retry:  retry,
		output: output,
	}
}