net_transport.go
func (n *netPipeline) AppendEntries(args *AppendEntriesRequest, resp *AppendEntriesResponse) (AppendFuture, error) {
	// Create a new future
	future := &appendFuture{
		start: time.Now(),
		args:  args,
		resp:  resp,
	}
	future.init()

	// Add a send timeout
	if timeout := n.trans.timeout; timeout > 0 {
		n.conn.conn.SetWriteDeadline(time.Now().Add(timeout))
	}

	// Send the RPC
	if err := sendRPC(n.conn, rpcAppendEntries, future.args); err != nil {
		return nil, err
	}

	// Hand-off for decoding, this can also cause back-pressure
	// to prevent too many inflight requests
	select {
	case n.inprogressCh <- future:
		return future, nil
	case <-n.shutdownCh:
		return nil, ErrPipelineShutdown
	}
}
func (n *netPipeline) AppendEntries(args *AppendEntriesRequest, resp *AppendEntriesResponse) (AppendFuture, error) {
	// Create a new future
	future := &appendFuture{
		start: time.Now(),
		args:  args,
		resp:  resp,
	}
	future.init()

	// Add a send timeout
	if timeout := n.trans.timeout; timeout > 0 {
		n.conn.conn.SetWriteDeadline(time.Now().Add(timeout))
	}

	// Send the RPC
	if err := sendRPC(n.conn, rpcAppendEntries, future.args); err != nil {
		return nil, err
	}

	// Hand-off for decoding, this can also cause back-pressure
	// to prevent too many inflight requests
	select {
	case n.inprogressCh <- future:
		return future, nil
	case <-n.shutdownCh:
		return nil, ErrPipelineShutdown
	}
}
func ( n * netPipeline ) AppendEntries ( args * AppendEntriesRequest , resp * AppendEntriesResponse ) ( AppendFuture , error ) { // Create a new future future := & appendFuture { start : time . Now ( ) , args : args , resp : resp , } future . init ( ) // Add a send timeout if timeout := n . trans . timeout ; timeout > 0 { n . conn . conn . SetWriteDeadline ( time . Now ( ) . Add ( timeout ) ) } // Send the RPC if err := sendRPC ( n . conn , rpcAppendEntries , future . args ) ; err != nil { return nil , err } // Hand-off for decoding, this can also cause back-pressure // to prevent too many inflight requests select { case n . inprogressCh <- future : return future , nil case <- n . shutdownCh : return nil , ErrPipelineShutdown } }
// AppendEntries is used to pipeline a new append entries request.
AppendEntries is used to pipeline a new append entries request .