Versions in this module Expand all Collapse all v0 v0.2.0 Sep 30, 2023 Changes in this version + var ErrClosed = errors.New("resource pool is closed") + var ErrCtxTimeout = errors.New("resource pool context already expired") + var ErrTimeout = errors.New("resource pool timed out") + type Factory func(context.Context) (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) GetAll() (vals []interface{}) + 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{}, enforceTimeout bool) error + func (nu *Numbered) Size() (size int64) + func (nu *Numbered) StatsJSON() string + func (nu *Numbered) Unregister(id int64, reason string) + 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) Active() int64 + func (rp *ResourcePool) Available() int64 + func (rp *ResourcePool) Capacity() int64 + func (rp *ResourcePool) Close() + func (rp *ResourcePool) Exhausted() int64 + func (rp *ResourcePool) Get(ctx context.Context) (resource Resource, err error) + func (rp *ResourcePool) IdleClosed() int64 + func (rp *ResourcePool) IdleTimeout() time.Duration + func (rp *ResourcePool) InUse() int64 + 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) StatsJSON() string + func (rp *ResourcePool) WaitCount() int64 + func (rp *ResourcePool) WaitTime() time.Duration v0.1.0-rc1 Sep 1, 2022