當前位置: 首頁>>代碼示例>>Golang>>正文


Golang pools.NewNumbered函數代碼示例

本文整理匯總了Golang中github.com/youtube/vitess/go/pools.NewNumbered函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewNumbered函數的具體用法?Golang NewNumbered怎麽用?Golang NewNumbered使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewNumbered函數的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: NewTxPool

// NewTxPool creates a new TxPool. It's not operational until it's Open'd.
func NewTxPool(
	name string,
	txStatsPrefix string,
	capacity int,
	timeout time.Duration,
	idleTimeout time.Duration,
	enablePublishStats bool,
	qStats *QueryServiceStats,
	checker MySQLChecker) *TxPool {

	txStatsName := ""
	if enablePublishStats {
		txStatsName = txStatsPrefix + "Transactions"
	}

	axp := &TxPool{
		pool:              NewConnPool(name, capacity, idleTimeout, enablePublishStats, qStats, checker),
		activePool:        pools.NewNumbered(),
		lastID:            sync2.NewAtomicInt64(time.Now().UnixNano()),
		timeout:           sync2.NewAtomicDuration(timeout),
		ticks:             timer.NewTimer(timeout / 10),
		txStats:           stats.NewTimings(txStatsName),
		checker:           checker,
		queryServiceStats: qStats,
	}
	// Careful: pool also exports name+"xxx" vars,
	// but we know it doesn't export Timeout.
	if enablePublishStats {
		stats.Publish(name+"Timeout", stats.DurationFunc(axp.timeout.Get))
	}
	return axp
}
開發者ID:littleyang,項目名稱:vitess,代碼行數:33,代碼來源:tx_pool.go

示例2: NewActivePool

func NewActivePool(queryTimeout, idleTimeout time.Duration) *ActivePool {
	return &ActivePool{
		pool:     pools.NewNumbered(),
		timeout:  sync2.AtomicDuration(queryTimeout),
		connPool: NewConnectionPool(1, idleTimeout),
		ticks:    timer.NewTimer(queryTimeout / 10),
	}
}
開發者ID:Eric-Chen,項目名稱:vitess,代碼行數:8,代碼來源:active_pool.go

示例3: NewActiveTxPool

func NewActiveTxPool(timeout time.Duration) *ActiveTxPool {
	return &ActiveTxPool{
		pool:    pools.NewNumbered(),
		lastId:  sync2.AtomicInt64(time.Now().UnixNano()),
		timeout: sync2.AtomicDuration(timeout),
		ticks:   timer.NewTimer(timeout / 10),
		txStats: stats.NewTimings("Transactions"),
	}
}
開發者ID:Eric-Chen,項目名稱:vitess,代碼行數:9,代碼來源:active_tx_pool.go

示例4: resetVTGate

// resetVTGate resets the internal state of RpcVTGate.
func resetVTGate() (sess proto.Session) {
	resetSandbox()
	*RpcVTGate = VTGate{
		balancerMap:    NewBalancerMap(new(sandboxTopo), "aa", "vt"),
		tabletProtocol: "sandbox",
		connections:    pools.NewNumbered(),
		retryDelay:     1 * time.Second,
		retryCount:     10,
	}
	RpcVTGate.GetSessionId(&proto.SessionParams{TabletType: "master"}, &sess)
	return
}
開發者ID:ZhuoRoger,項目名稱:vitess,代碼行數:13,代碼來源:vtgate_test.go

示例5: Init

func Init(blm *BalancerMap, tabletProtocol string, retryDelay time.Duration, retryCount int) {
	if RpcVTGate != nil {
		log.Fatalf("VTGate already initialized")
	}
	RpcVTGate = &VTGate{
		balancerMap:    blm,
		tabletProtocol: tabletProtocol,
		connections:    pools.NewNumbered(),
		retryDelay:     retryDelay,
		retryCount:     retryCount,
	}
	proto.RegisterAuthenticated(RpcVTGate)
}
開發者ID:ZhuoRoger,項目名稱:vitess,代碼行數:13,代碼來源:vtgate.go

示例6: NewActivePool

func NewActivePool(name string, queryTimeout time.Duration, connKiller *ConnectionKiller) *ActivePool {
	ap := &ActivePool{
		pool:       pools.NewNumbered(),
		timeout:    sync2.AtomicDuration(queryTimeout),
		ticks:      timer.NewTimer(queryTimeout / 10),
		connKiller: connKiller,
	}
	stats.Publish(name+"Size", stats.IntFunc(ap.pool.Size))
	stats.Publish(
		name+"Timeout",
		stats.DurationFunc(func() time.Duration { return ap.timeout.Get() }),
	)
	return ap
}
開發者ID:chinna1986,項目名稱:vitess,代碼行數:14,代碼來源:active_pool.go

示例7: NewActiveTxPool

func NewActiveTxPool(name string, timeout time.Duration) *ActiveTxPool {
	axp := &ActiveTxPool{
		pool:    pools.NewNumbered(),
		lastId:  sync2.AtomicInt64(time.Now().UnixNano()),
		timeout: sync2.AtomicDuration(timeout),
		ticks:   timer.NewTimer(timeout / 10),
		txStats: stats.NewTimings("Transactions"),
	}
	stats.Publish(name+"Size", stats.IntFunc(axp.pool.Size))
	stats.Publish(
		name+"Timeout",
		stats.DurationFunc(func() time.Duration { return axp.timeout.Get() }),
	)
	return axp
}
開發者ID:qman1989,項目名稱:vitess,代碼行數:15,代碼來源:active_tx_pool.go

示例8: NewTxPool

func NewTxPool(name string, capacity int, timeout, poolTimeout, idleTimeout time.Duration) *TxPool {
	axp := &TxPool{
		pool:        dbconnpool.NewConnectionPool(name, capacity, idleTimeout),
		activePool:  pools.NewNumbered(),
		lastId:      sync2.AtomicInt64(time.Now().UnixNano()),
		timeout:     sync2.AtomicDuration(timeout),
		poolTimeout: sync2.AtomicDuration(poolTimeout),
		ticks:       timer.NewTimer(timeout / 10),
		txStats:     stats.NewTimings("Transactions"),
	}
	// Careful: pool also exports name+"xxx" vars,
	// but we know it doesn't export Timeout.
	stats.Publish(name+"Timeout", stats.DurationFunc(axp.timeout.Get))
	stats.Publish(name+"PoolTimeout", stats.DurationFunc(axp.poolTimeout.Get))
	return axp
}
開發者ID:miffa,項目名稱:vitess,代碼行數:16,代碼來源:tx_pool.go

示例9: Close

func (ap *ActivePool) Close() {
	ap.ticks.Stop()
	ap.connPool.Close()
	ap.pool = pools.NewNumbered()
}
開發者ID:Eric-Chen,項目名稱:vitess,代碼行數:5,代碼來源:active_pool.go

示例10: NewReservedPool

func NewReservedPool() *ReservedPool {
	return &ReservedPool{pool: pools.NewNumbered(), lastId: 1}
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:3,代碼來源:reserved_pool.go

示例11: NewReservedPool

func NewReservedPool(name string) *ReservedPool {
	rp := &ReservedPool{pool: pools.NewNumbered(), lastId: 1}
	stats.Publish(name+"Size", stats.IntFunc(rp.pool.Size))
	return rp
}
開發者ID:CERN-Stage-3,項目名稱:vitess,代碼行數:5,代碼來源:reserved_pool.go


注:本文中的github.com/youtube/vitess/go/pools.NewNumbered函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。