Exemplo n.º 1
0
func (b Bucket) getConnPools() []*connectionPool {
	if b.connPools != nil {
		return *(*[]*connectionPool)(atomic.LoadPointer(&b.connPools))
	} else {
		return nil
	}
}
Exemplo n.º 2
0
// this version of replaceConnPools will not close the pools that are being reused
func (b *Bucket) replaceConnPools2(with []*connectionPool) {
	for {
		old := atomic.LoadPointer(&b.connPools)
		if atomic.CompareAndSwapPointer(&b.connPools, old, unsafe.Pointer(&with)) {
			if old != nil {
				for _, pool := range *(*[]*connectionPool)(old) {
					if pool != nil && pool.inUse == false {
						pool.Close()
					}
				}
			}
			return
		}
	}
}
Exemplo n.º 3
0
// Nodes returns teh current list of nodes servicing this bucket.
func (b Bucket) Nodes() []Node {
	return *(*[]Node)(atomic.LoadPointer(&b.nodeList))
}
Exemplo n.º 4
0
// VBServerMap returns the current VBucketServerMap.
func (b *Bucket) VBServerMap() *VBucketServerMap {
	return (*VBucketServerMap)(atomic.LoadPointer(&(b.vBucketServerMap)))
}
Exemplo n.º 5
0
func (b Bucket) getConnPools() []*connectionPool {
	return *(*[]*connectionPool)(atomic.LoadPointer(&b.connPools))
}
Exemplo n.º 6
0
// Nodes returns teh current list of nodes servicing this bucket.
func (b Bucket) Nodes() []Node {
	b.nodeListLock.RLock()
	defer b.nodeListLock.RUnlock()
	return *(*[]Node)(atomic.LoadPointer(&b.nodeList))
}