Versions in this module Expand all Collapse all v1 v1.0.0 Oct 16, 2017 Changes in this version + var CLOSED_ERR = fmt.Errorf("ResourcePool is closed") + type Factory func() (Resource, error) + type IDPool struct + func NewIDPool() *IDPool + func (pool *IDPool) Get() (id uint32) + func (pool *IDPool) Put(id uint32) + type Numbered struct + func NewNumbered() *Numbered + func (nu *Numbered) Get(id int64, purpose string) (val interface{}, err error) + func (nu *Numbered) GetIdle(timeout time.Duration, purpose string) (vals []interface{}) + func (nu *Numbered) GetOutdated(age time.Duration, purpose string) (vals []interface{}) + func (nu *Numbered) Put(id int64) + func (nu *Numbered) Register(id int64, val interface{}) error + func (nu *Numbered) Size() (size int64) + func (nu *Numbered) StatsJSON() string + func (nu *Numbered) Unregister(id int64) + func (nu *Numbered) WaitForEmpty() + type Resource interface + Close func() + type ResourcePool struct + func NewResourcePool(factory Factory, capacity, maxCap int, idleTimeout time.Duration) *ResourcePool + func (rp *ResourcePool) Available() int64 + func (rp *ResourcePool) Capacity() int64 + func (rp *ResourcePool) Close() + func (rp *ResourcePool) Get() (resource Resource, err error) + func (rp *ResourcePool) IdleTimeout() time.Duration + func (rp *ResourcePool) IsClosed() (closed bool) + func (rp *ResourcePool) MaxCap() int64 + func (rp *ResourcePool) Put(resource Resource) + func (rp *ResourcePool) SetCapacity(capacity int) error + func (rp *ResourcePool) SetIdleTimeout(idleTimeout time.Duration) + func (rp *ResourcePool) Stats() (capacity, available, maxCap, waitCount int64, ...) + func (rp *ResourcePool) StatsJSON() string + func (rp *ResourcePool) TryGet() (resource Resource, err error) + func (rp *ResourcePool) WaitCount() int64 + func (rp *ResourcePool) WaitTime() time.Duration + type RoundRobin struct + func NewRoundRobin(capacity int, idleTimeout time.Duration) *RoundRobin + func (rr *RoundRobin) Close() + func (rr *RoundRobin) Get() (resource Resource, err error) + func (rr *RoundRobin) IsClosed() bool + func (rr *RoundRobin) Open(factory Factory) + func (rr *RoundRobin) Put(resource Resource) + func (rr *RoundRobin) SetCapacity(capacity int) error + func (rr *RoundRobin) SetIdleTimeout(idleTimeout time.Duration) + func (rr *RoundRobin) Stats() (size, capacity, available, waitCount int64, ...) + func (rr *RoundRobin) StatsJSON() string + func (rr *RoundRobin) TryGet() (resource Resource, err error)