func (u *LocalUnixSelector) Select(binlog *pb.Binlog, retryTime int) *PumpStatus {
	selectorLock.RLock()
	defer selectorLock.RUnlock()
	return u.Pump
}
Select implement PumpSelector.Select.
package client
import (
	"sync"
	"github.com/pingcap/log"
	pb "github.com/pingcap/tipb/go-binlog"
	"go.uber.org/zap"
)
const (
	Range = "range"
	Hash = "hash"
	Score = "score"
	LocalUnix = "local unix"
)
var (
	tsMap = make(map[int64]*PumpStatus)
	selectorLock sync.RWMutex
)
type PumpSelector interface {
	SetPumps([]*PumpStatus)
	Select(binlog *pb.Binlog, retryTime int) *PumpStatus
	Feedback(startTS int64, binlogType pb.BinlogType, pump *PumpStatus)
}
type HashSelector struct {
	Pumps []*PumpStatus
}
func NewHashSelector() PumpSelector {
	return &HashSelector{
		Pumps: make([]*PumpStatus, 0, 10),
	}
}
func (h *HashSelector) SetPumps(pumps []*PumpStatus) {
	selectorLock.Lock()
	h.Pumps = pumps
	selectorLock.Unlock()
}
func (h *HashSelector) Select(binlog *pb.Binlog, retryTime int) *PumpStatus {
	selectorLock.Lock()
	defer selectorLock.Unlock()
	if binlog.Tp != pb.BinlogType_Prewrite {
		if pump, ok := tsMap[binlog.StartTs]; ok {
			return pump
		}
		log.Warn("[pumps client] binlog don't have matched prewrite binlog", zap.Stringer("binlog type", binlog.Tp), zap.Int64("startTs", binlog.StartTs))
		return nil
	}
	if len(h.Pumps) == 0 {
		return nil
	}
	i := (binlog.StartTs + int64(retryTime)) % int64(len(h.Pumps))
	pump := h.Pumps[int(i)]
	return pump
}
func (h *HashSelector) Feedback(startTS int64, binlogType pb.BinlogType, pump *PumpStatus) {
	maintainTSMap(startTS, binlogType, pump)
}
type RangeSelector struct {
	Offset int
	Pumps []*PumpStatus
}
func NewRangeSelector() PumpSelector {
	return &RangeSelector{
		Offset: 0,
		Pumps:  make([]*PumpStatus, 0, 10),
	}
}
func (r *RangeSelector) SetPumps(pumps []*PumpStatus) {
	selectorLock.Lock()
	r.Pumps = pumps
	r.Offset = 0
	selectorLock.Unlock()
}
func (r *RangeSelector) Select(binlog *pb.Binlog, retryTime int) *PumpStatus {
	selectorLock.Lock()
	defer selectorLock.Unlock()
	if binlog.Tp != pb.BinlogType_Prewrite {
		if pump, ok := tsMap[binlog.StartTs]; ok {
			return pump
		}
		log.Warn("[pumps client] binlog don't have matched prewrite binlog", zap.Stringer("binlog type", binlog.Tp), zap.Int64("startTs", binlog.StartTs))
		return nil
	}
	if len(r.Pumps) == 0 {
		return nil
	}
	if r.Offset >= len(r.Pumps) {
		r.Offset = 0
	}
	pump := r.Pumps[r.Offset]
	r.Offset++
	return pump
}
func (r *RangeSelector) Feedback(startTS int64, binlogType pb.BinlogType, pump *PumpStatus) {
	maintainTSMap(startTS, binlogType, pump)
}
type LocalUnixSelector struct {
	Pump *PumpStatus
}
func NewLocalUnixSelector() PumpSelector {
	return &LocalUnixSelector{}
}
func (u *LocalUnixSelector) SetPumps(pumps []*PumpStatus) {
	selectorLock.Lock()
	if len(pumps) == 0 {
		u.Pump = nil
	} else {
		u.Pump = pumps[0]
	}
	selectorLock.Unlock()
}