//NewTransferCustomer 实例化
326990
func NewTransferCustomer(KfAccount string) *TransferCustomer {
	tc := new(TransferCustomer)
	if KfAccount != "" {
		transInfo := new(TransInfo)
		transInfo.KfAccount = KfAccount
		tc.TransInfo = transInfo
	}
	return tc
}
931834
func NewTransferClient(client *http.Client) (*Transferer, error) {
	st, err := storagetransfer.New(client)
	if err != nil {
		return nil, err
	}

	return &Transferer{storagetransfer.NewTransferJobsService(st)}, nil
}
747857
func NewTranslation() *Translation {
	tr := new(Translation)
	tr.Trs = make(map[int]string)

	return tr
}
654422
func (c *Callbacks) OnCUserMessageCameraTransition(fn func(*dota.CUserMessageCameraTransition) error) {
	c.onCUserMessageCameraTransition = append(c.onCUserMessageCameraTransition, fn)
}
1249035
func NewTransferPoller(setts *account.Settings, filter ReceiveEventFilter, interval time.Duration) *TransferPoller {
	if setts.EventMachine == nil {
		setts.EventMachine = &event.DiscardEventMachine{}
	}
	if filter == nil {
		filter = NewPerTailReceiveEventFilter(true)
	}
	poller := &TransferPoller{
		setts: setts, receiveEventFilter: filter,
	}
	poller.syncTimer = util.NewSyncIntervalTimer(interval, poller.pollTransfers, func(err error) {
		poller.setts.EventMachine.Emit(err, event.EventError)
	})
	return poller
}
286501
func NewTransitionParser() TransitionParser {
	return TransitionParser{
		lookup: []string{},
		tokens: []*tcontainer.TrieNode{},
		stack:  []ParserStateID{},
	}
}
278587
func newUSBTransfer(dev *libusbDevHandle, ei EndpointInfo, buf []byte, timeout time.Duration) (*usbTransfer, error) {
	var isoPackets int
	var isoPktSize uint32
	tt := ei.TransferType()
	if tt == TRANSFER_TYPE_ISOCHRONOUS {
		isoPktSize = ei.MaxIsoPacket
		if len(buf) < int(isoPktSize) {
			isoPktSize = uint32(len(buf))
		}
		isoPackets = len(buf) / int(isoPktSize)
		debug.Printf("New isochronous transfer - buffer length %d, using %d packets of %d bytes each", len(buf), isoPackets, isoPktSize)
	}

	xfer, err := libusb.alloc(dev, ei.Address, tt, timeout, isoPackets, buf)
	if err != nil {
		return nil, err
	}

	if tt == TRANSFER_TYPE_ISOCHRONOUS {
		libusb.setIsoPacketLengths(xfer, isoPktSize)
	}

	t := &usbTransfer{
		xfer: xfer,
		buf:  buf,
	}
	runtime.SetFinalizer(t, func(t *usbTransfer) {
		t.cancel()
		t.wait()
		t.free()
	})
	return t, nil
}
940690
func NewTransport(provider StreamProvider) libchan.Transport {
	session := &Transport{
		provider:         provider,
		referenceCounter: 1,
		receiverChan:     make(chan *receiver),
		streamC:          sync.NewCond(new(sync.Mutex)),
		streams:          make(map[uint64]*stream),
	}

	go session.handleStreams()

	return session
}
1295703
func NewTranslateFile(opts ...TranslateFileOption) *TranslateFile {
	var defaultMapSize64 int64 = 10 * (1 << 30)
	var defaultMapSize int

	if ^uint(0)>>32 > 0 {
		// 10GB default map size
		defaultMapSize = int(defaultMapSize64)
	} else {
		// Use 2GB default map size on 32-bit systems
		defaultMapSize = (1 << 31) - 1
	}
	f := &TranslateFile{
		writeNotify: make(chan struct{}),
		closing:     make(chan struct{}),
		cols:        make(map[string]*index),
		rows:        make(map[fieldKey]*index),

		mapSize: defaultMapSize,

		logger: logger.NopLogger,

		replicationClosing: make(chan struct{}),
		primaryStoreEvents: make(chan primaryStoreEvent),

		replicationRetryInterval: defaultReplicationRetryInterval,
	}

	for _, opt := range opts {
		err := opt(f)
		if err != nil {
			// TODO (2.0): Change func signature to return error
			panic(errors.Wrap(err, "applying option"))
		}
	}

	return f
}
167777
func NewTransportHandle(name string, t envelope.Transport) (Handle, error) {
	client := api.NewPluginClient(multiplex.NewClient(
		"Plugin",
		envelope.NewClient(_proto, t),
	))

	handshake, err := client.Handshake(&api.HandshakeRequest{})
	if err != nil {
		return nil, errHandshakeFailed{Name: name, Reason: err}
	}

	if handshake.Name != name {
		return nil, errHandshakeFailed{
			Name:   name,
			Reason: errNameMismatch{Want: name, Got: handshake.Name},
		}
	}

	if handshake.APIVersion != api.APIVersion {
		return nil, errHandshakeFailed{
			Name:   name,
			Reason: errAPIVersionMismatch{Want: api.APIVersion, Got: handshake.APIVersion},
		}
	}

	features := make(map[api.Feature]struct{}, len(handshake.Features))
	for _, feature := range handshake.Features {
		features[feature] = struct{}{}
	}

	return &transportHandle{
		name:      name,
		Transport: t,
		Client:    client,
		Running:   atomic.NewBool(true),
		Features:  features,
	}, nil
}
176796
func NewTranslatingReader(r io.Reader, tr Translator) io.Reader {
	return &translatingReader{r: r, tr: tr}
}
1044235
func (tm *transactionManager) newTransaction(id string, q *query) *transaction {
	return &transaction{
		id:       id,
		query:    q,
		response: make(chan struct{}, tm.dht.Try+1),
	}
}
230458
func NewTransaction(txID string, txValidationCode pb.TxValidationCode, headerType cb.HeaderType) *TxInfo {
	return &TxInfo{
		TxID:             txID,
		TxValidationCode: txValidationCode,
		HeaderType:       headerType,
	}
}
1319898
func NewTransport(hostAddr string, tlsConfig *tls.Config, config TransportConfig) *Transport {
	if config.IdleConnTimeout == 0 {
		config.IdleConnTimeout = DefaultIdleConnTimeout
	}
	if config.ConnLimit == 0 {
		config.ConnLimit = DefaultConnLimit
	}
	return &Transport{
		TransportConfig: config,
		hostAddr:        hostAddr,
		tlsConfig:       tlsConfig,
	}
}
592299
func (fw *Framework) NewTransportFromJSON(data string) (message protocol.TransportMessage, err error) {
	version := gjson.Get(data, "protocol").String()

	switch version {
	case protocol.TransportV1:
		message, err = v1.NewTransportFromJSON(data)
	default:
		err = fmt.Errorf("Do not know how to create a TransportMessage from an expected JSON format message with content: %s", data)
	}

	return
}
487316
func NewTransport(tlsConfig *tls.Config) *http.Transport {
	if tlsConfig == nil {
		tlsConfig = tlsconfig.ServerDefault()
	}

	direct := &net.Dialer{
		Timeout:   30 * time.Second,
		KeepAlive: 30 * time.Second,
		DualStack: true,
	}

	base := &http.Transport{
		Proxy:               http.ProxyFromEnvironment,
		Dial:                direct.Dial,
		TLSHandshakeTimeout: 10 * time.Second,
		TLSClientConfig:     tlsConfig,
		// TODO(dmcgowan): Call close idle connections when complete and use keep alive
		DisableKeepAlives: true,
	}

	proxyDialer, err := sockets.DialerFromEnvironment(direct)
	if err == nil {
		base.Dial = proxyDialer.Dial
	}
	return base
}
721338
func NewTransactionFromRLP(data []byte) (*Transaction, error) {
	tx := &Transaction{
		tx: new(types.Transaction),
	}
	if err := rlp.DecodeBytes(common.CopyBytes(data), tx.tx); err != nil {
		return nil, err
	}
	return tx, nil
}