Documentation ¶
Overview ¶
Package rpool provides a resource pool.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct { // New is used to create a new resource when necessary. New func() (io.Closer, error) // CloseErrorHandler will be called when an error occurs closing a resource. CloseErrorHandler func(err error) // Stats is optional and allows for the pool to provide stats for various // interesting events in the pool. Stats stats.Client // Max defines the maximum number of concurrently allocated resources. Max uint // MinIdle defines the number of minimum idle resources. These number of // resources are kept around when the idle cleanup kicks in. MinIdle uint // IdleTimeout defines the duration of idle time after which a resource will // be closed. IdleTimeout time.Duration // ClosePoolSize defines the number of concurrent goroutines that will close // resources. ClosePoolSize uint // Clock allows for testing timing related functionality. Do not specify this // in production code. Clock clock.Clock // contains filtered or unexported fields }
Pool manages the life cycle of resources.
func (*Pool) Close ¶
Close closes the pool and its resources. It waits until all acquired resources are released or discarded. It is an error to call Acquire after closing the pool.
Click to show internal directories.
Click to hide internal directories.