// Gets information about a pool given a PoolID
167006
func (a *api) GetResourcePool(id string) (*pool.ResourcePool, error) {
	client, err := a.connectMaster()
	if err != nil {
		return nil, err
	}

	return client.GetResourcePool(id)
}
1009531
func (_class PoolClass) GetAll(sessionID SessionRef) (_retval []PoolRef, _err error) {
	_method := "pool.get_all"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertPoolRefSetToGo(_method + " -> ", _result.Value)
	return
}
548597
func (a *api) GetResourcePools() ([]pool.ResourcePool, error) {
	client, err := a.connectMaster()
	if err != nil {
		return nil, err
	}

	return client.GetResourcePools()
}
218781
func (a *Allocator) Get(ctx context.Context, key AllocatorKey) (idpool.ID, error) {
	if id := a.mainCache.get(key.GetKey()); id != idpool.NoID {
		return id, nil
	}

	return a.GetNoCache(ctx, key)
}
515336
func (c *PoolInfoCache) Get(hash chainhash.Hash) (*apitypes.TicketPoolInfo, bool) {
	c.mtx.RLock()
	defer c.mtx.RUnlock()
	tpi, ok := c.poolInfo[hash]
	return tpi, ok
}
1309032
func (p *intPool) get() *big.Int {
	if p.pool.len() > 0 {
		return p.pool.pop()
	}
	return new(big.Int)
}
676031
func (_m *API) GetPoolIPs(_a0 string) (*pool.PoolIPs, error) {
	ret := _m.Called(_a0)

	var r0 *pool.PoolIPs
	if rf, ok := ret.Get(0).(func(string) *pool.PoolIPs); ok {
		r0 = rf(_a0)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*pool.PoolIPs)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string) error); ok {
		r1 = rf(_a0)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
762194
func (s *Server) GetResourcePool(poolID string, reply *pool.ResourcePool) error {
	response, err := s.f.GetResourcePool(s.context(), poolID)
	if err != nil {
		return err
	}
	if response == nil {
		return errors.New("pool not found")
	}
	*reply = *response
	return nil
}
948144
func (pool *ReaderPool) get(info *SegmentCommitInfo, create bool) *ReadersAndUpdates {
	pool.Lock() // synchronized
	defer pool.Unlock()

	assertn(info.Info.Dir == pool.owner.directory, "info.dir=%v vs %v", info.Info.Dir, pool.owner.directory)

	rld, ok := pool.readerMap[info]
	if !ok {
		if !create {
			return nil
		}
		rld = newReadersAndUpdates(pool.owner, info)
		// Steal initial reference:
		pool.readerMap[info] = rld
	} else {
		assertn(rld.info == info, "rld.info=%v info=%v isLive?= %v vs %v",
			rld.info, info, pool.infoIsLive(rld.info), pool.infoIsLive(info))
	}

	if create {
		// Return ref to caller:
		rld.incRef()
	}

	assert(pool.noDups())

	return rld
}
22528
func (p *Pool) Get(n, c int) []byte {
	if n > c {
		panic("requested length is greater than capacity")
	}

	v, x := p.pool.Get(c)
	if v != nil {
		bts := v.([]byte)
		bts = bts[:n]
		return bts
	}

	return make([]byte, n, x)
}
1023592
func (pool *connPool) Get() net.Conn {
	pool.mu.Lock()
	defer pool.mu.Unlock()
	if len(pool.conns) > 0 {
		c := pool.conns[len(pool.conns)-1]
		pool.conns = pool.conns[0 : len(pool.conns)-1]
		atomic.AddInt64(&pool.stats.reusuedConnections, 1)
		return c
	}
	return nil
}
305484
func (Ctx *Context) CpupoolInfo(Poolid uint32) (pool CpupoolInfo) {
	err := Ctx.CheckOpen()
	if err != nil {
		return
	}

	var c_cpupool C.libxl_cpupoolinfo

	ret := C.libxl_cpupool_info(Ctx.ctx, &c_cpupool, C.uint32_t(Poolid))
	if ret != 0 {
		err = Error(-ret)
		return
	}
	defer C.libxl_cpupoolinfo_dispose(&c_cpupool)

	pool = c_cpupool.toGo()

	return
}
675309
func (p *pool) Get(hostname string, caCert, tlsCert, tlsKey []byte) (as.ApplicationServerServiceClient, error) {
	defer p.Unlock()
	p.Lock()

	var connect bool
	c, ok := p.clients[hostname]
	if !ok {
		connect = true
	}

	// if the connection exists in the map, but when the certificates changed
	// try to close the connection and re-connect
	if ok && (!bytes.Equal(c.caCert, caCert) || !bytes.Equal(c.tlsCert, tlsCert) || !bytes.Equal(c.tlsKey, tlsKey)) {
		c.clientConn.Close()
		delete(p.clients, hostname)
		connect = true
	}

	if connect {
		clientConn, asClient, err := p.createClient(hostname, caCert, tlsCert, tlsKey)
		if err != nil {
			return nil, errors.Wrap(err, "create application-server api client error")
		}
		c = client{
			client:     asClient,
			clientConn: clientConn,
			caCert:     caCert,
			tlsCert:    tlsCert,
			tlsKey:     tlsKey,
		}
		p.clients[hostname] = c
	}

	return c.client, nil
}
1342112
func (s *Server) GetPoolIPs(poolID string, reply *pool.PoolIPs) error {
	response, err := s.f.GetPoolIPs(s.context(), poolID)
	if err != nil {
		return err
	}
	if response == nil {
		return errors.New("pool not found")
	}
	*reply = *response
	return nil
}
483504
func (bp *Pool) Get(params ...interface{}) interface{} {
	res := bp.pool.Poll()
	if res == nil || (bp.IsUsable != nil && !bp.IsUsable(res, params...)) {
		// not usable, so finalize
		if res != nil && bp.Finalize != nil {
			bp.Finalize(res)
		}

		if bp.New != nil {
			res = bp.New(params...)
		}
	}

	return res
}
1015715
func (db *StakeDatabase) PoolInfoBest() *apitypes.TicketPoolInfo {
	db.nodeMtx.RLock()
	if db.BestNode == nil {
		db.nodeMtx.RUnlock()
		log.Errorf("PoolInfoBest: BestNode is nil!")
		return nil
	}
	poolSize := db.BestNode.PoolSize()
	//liveTickets := db.BestNode.LiveTickets()
	winningTickets := db.BestNode.Winners()
	height := db.BestNode.Height()
	// expiredTickets, expireRevoked := db.expires()
	db.nodeMtx.RUnlock()

	return db.makePoolInfo(db.poolValue, int64(poolSize), winningTickets, height) // db.calcPoolInfo(liveTickets, winningTickets, height)
}
1176938
func getPoolReconnect(ctx context.Context, pool *dbconnpool.ConnectionPool) (*dbconnpool.PooledDBConnection, error) {
	conn, err := pool.Get(ctx)
	if err != nil {
		return conn, err
	}
	// Run a test query to see if this connection is still good.
	if _, err := conn.ExecuteFetch("SELECT 1", 1, false); err != nil {
		// If we get a connection error, try to reconnect.
		if sqlErr, ok := err.(*mysql.SQLError); ok && (sqlErr.Number() == mysql.CRServerGone || sqlErr.Number() == mysql.CRServerLost) {
			if err := conn.Reconnect(); err != nil {
				conn.Recycle()
				return nil, err
			}
			return conn, nil
		}
		conn.Recycle()
		return nil, err
	}
	return conn, nil
}