当前位置: 首页>>代码示例>>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;未经允许,请勿转载。