// Pipeline to use while processing the request.
3456
func (r *BulkIndexRequest) Pipeline(pipeline string) *BulkIndexRequest {
	r.pipeline = pipeline
	r.source = nil
	return r
}
772956
func (c *Cmd) StdinPipe() (io.WriteCloser, error) {
	if c.Stdin != nil {
		return nil, errors.New("dexec: Stdin already set")
	}
	pr, pw := io.Pipe()
	c.Stdin = pr
	return pw, nil
}
268225
func loadPipe(do func(io.Reader) error) (*io.PipeWriter, <-chan error) {
	r, w := io.Pipe()
	errc := make(chan error)
	go func() {
		progress := NewProgressCounter(300)
		progress.Log = func() { plog.Infof("Read %v bytes from archive for restore", progress.Total) }

		tr := io.TeeReader(r, progress)
		err := do(tr)
		r.CloseWithError(err)
		errc <- err
	}()
	return w, errc
}
912063
func (whisper *Whisper) processQueue() {
	var e *Envelope
	for {
		select {
		case <-whisper.quit:
			return

		case e = <-whisper.messageQueue:
			whisper.filters.NotifyWatchers(e, false)

		case e = <-whisper.p2pMsgQueue:
			whisper.filters.NotifyWatchers(e, true)
		}
	}
}
280004
func (t *Tree) pipeline(context string) (pipe *PipeNode) {
	var decl []*VariableNode
	pos := t.peekNonSpace().pos
	// Are there declarations?
	for {
		if v := t.peekNonSpace(); v.typ == itemVariable {
			t.next()
			// Since space is a token, we need 3-token look-ahead here in the worst case:
			// in "$x foo" we need to read "foo" (as opposed to ":=") to know that $x is an
			// argument variable rather than a declaration. So remember the token
			// adjacent to the variable so we can push it back if necessary.
			tokenAfterVariable := t.peek()
			if next := t.peekNonSpace(); next.typ == itemColonEquals || (next.typ == itemChar && next.val == ",") {
				t.nextNonSpace()
				variable := t.newVariable(v.pos, v.val)
				decl = append(decl, variable)
				t.vars = append(t.vars, v.val)
				if next.typ == itemChar && next.val == "," {
					if context == "range" && len(decl) < 2 {
						continue
					}
					t.errorf("too many declarations in %s", context)
				}
			} else if tokenAfterVariable.typ == itemSpace {
				t.backup3(v, tokenAfterVariable)
			} else {
				t.backup2(v)
			}
		}
		break
	}
	pipe = t.newPipeline(pos, t.lex.lineNumber(), decl)
	for {
		switch token := t.nextNonSpace(); token.typ {
		case itemRightDelim, itemRightParen:
			if len(pipe.Cmds) == 0 {
				t.errorf("missing value for %s", context)
			}
			if token.typ == itemRightParen {
				t.backup()
			}
			return
		case itemBool, itemCharConstant, itemComplex, itemDot, itemField, itemIdentifier,
			itemNumber, itemNil, itemRawString, itemString, itemVariable, itemLeftParen:
			t.backup()
			pipe.append(t.command())
		default:
			t.unexpected(token, context)
		}
	}
}
1210214
func (c *Pipeline) Process(cmd Cmder) error {
	c.mu.Lock()
	c.cmds = append(c.cmds, cmd)
	c.mu.Unlock()
	return nil
}
804321
func (g *Generator) ProcessRequest(req *CertificateRequest) (csr, key []byte, err error) {

	log.Info("generate received request")
	err = g.Validator(req)
	if err != nil {
		log.Warningf("invalid request: %v", err)
		return nil, nil, err
	}

	csr, key, err = ParseRequest(req)
	if err != nil {
		return nil, nil, err
	}
	return
}
55364
func (p *pipeline) Run(r Reader, b WriterBuilder, errCh chan<- error) {
	errCh <- func() (err error) {

		errors := make(chan error, len(p.stages))
		for _, c := range p.stages[:len(p.stages)-1] {
			p := NewPipe()
			go c.Run(r, p.Builder(), errors)
			r = p.Reader()
		}
		go p.stages[len(p.stages)-1].Run(r, b, errors)

		running := len(p.stages)

		for running > 0 {
			e := <-errors
			running--
			if err == nil {
				err = e
			}
		}

		return err
	}()
}
989217
func (pipeline *Pipeline) Run() error {
	endpoints := pipeline.source.Endpoints()
	// send a boot event
	pipeline.source.pipe.Event <- events.NewBootEvent(time.Now().UnixNano(), pipeline.version, endpoints)

	errors := make(chan error, 2)
	go func() {
		errors <- pipeline.startErrorListener()
	}()
	go func() {
		errors <- pipeline.source.Start()
	}()

	return <-errors
}
82857
func Process(c http.ResponseWriter, req *http.Request) {
	mainServer.Process(c, req)
}
232953
func (p *Pipeline) AddStage(stage *Stage) {
	p.Stages = append(p.Stages, stage)
}
210005
func (p *Pipeline) Run(conn *Conn) (r []*Reply, err error) {
	if len(p.commands) == 0 {
		return nil, nil
	}
	if conn.state != connStateConnected {
		return nil, ErrNotConnected
	}
	conn.Lock()
	defer func() {
		conn.Unlock()
		if err != nil {
			conn.fail()
		}
	}()
	if conn.RequestTimeout != 0 {
		conn.tcpConn.SetWriteDeadline(time.Now().Add(conn.RequestTimeout * time.Duration(len(p.commands)/10+1)))
	}
	for _, cmd := range p.commands {
		err = cmd.writeCommand(conn)
		if err != nil {
			return nil, ErrWrite
		}
	}
	err = conn.wb.Flush()
	if err != nil {
		return nil, ErrWrite
	}
	if conn.RequestTimeout != 0 {
		conn.tcpConn.SetReadDeadline(time.Now().Add(conn.RequestTimeout * time.Duration(len(p.commands)/10+1)))
	}
	replies := make([]*Reply, len(p.commands))
	for i := range replies {
		rep, err := readReply(conn)
		if err != nil {
			return nil, err
		}
		replies[i] = rep
	}
	return replies, nil
}
362779
func (q *taskPipeline) Stop() {
	q.stopped.Do(func() {
		log.Debugf("Stopping task pipeline")

		close(q.quit)
		q.signalUntilShutdown()

		// Skip log if we also force quit.
		select {
		case <-q.forceQuit:
		default:
			log.Debugf("Task pipeline stopped successfully")
		}
	})
}
1210991
func Process(file string) (*raml.APIDefinition, error) {
	routes, err := raml.ParseFile(file)
	if err != nil {
		return nil, fmt.Errorf("Failed parsing RAML file: %s\n", err.Error())
	}
	return routes, nil
}
1129699
func (c *ClusterManager) ProcessPairRequest(
	request *api.ClusterPairProcessRequest,
) (*api.ClusterPairProcessResponse, error) {
	if request.SourceClusterId == c.Uuid() {
		return nil, fmt.Errorf("Cannot create cluster pair with self")
	}

	response := &api.ClusterPairProcessResponse{
		RemoteClusterId:   c.Uuid(),
		RemoteClusterName: c.config.ClusterId,
	}

	// Get the token without resetting it
	tokenResp, err := c.GetPairToken(false)
	if err != nil {
		return nil, fmt.Errorf("Error getting Cluster Token: %v", err)
	}
	if tokenResp.Token != request.RemoteClusterToken {
		return nil, fmt.Errorf("Token mismatch during pairing")
	}

	// Alert all listeners that we have received a pair request
	for e := c.listeners.Front(); e != nil; e = e.Next() {
		err := e.Value.(cluster.ClusterListener).ProcessPairRequest(
			request,
			response,
		)
		if err != nil {
			logrus.Errorf("Unable to notify %v on a a cluster remote pair request: %v",
				e.Value.(cluster.ClusterListener).String(),
				err,
			)

			return nil, err
		}
	}

	logrus.Infof("Successfully paired with remote cluster %v", request.SourceClusterId)

	return response, nil
}
111726
func (p *pipelineChannel) PushBack(h HandlerTempl) {
	p.Handlers = append(p.Handlers, h)
}
634530
func (p *Pipe) Iter() *Iter {
	iter := &Iter{
		session: p.session,
		timeout: -1,
	}
	iter.gotReply.L = &iter.m
	var result struct{ Result []bson.Raw }
	c := p.collection
	iter.err = c.Database.Run(bson.D{{"aggregate", c.Name}, {"pipeline", p.pipeline}}, &result)
	if iter.err != nil {
		return iter
	}
	for i := range result.Result {
		iter.docData.Push(result.Result[i].Data)
	}
	return iter
}