Function to be called when a new resource must be created.
Function to be called when a resource must be destroyed.
An empty ResourcePool.
A Promise that resolves to the response of each call to destroy() after all resources have been returned.
An unused resource from the pool. If none are available, one will be created.
Resources that are pending are counted here.
The number of in-use resources owned by this pool.
The number of resources owned by this pool.
The number of unused resources owned by this pool.
The resource to return to the pool.
The Promise
to settle before returning the resource.
The resource to return after promise
settles.
Gets a resource, invokes f
with it, then returns it to the pool.
A function that accepts a resource and returns some value.
A Promise
that follows the result of invoking f
.
Generated using TypeDoc
Represents a generic resource pool. If no resources are available, will create and register a new one. Uses a doubly-linked list as a FIFO queue for unused resources and a Set for in-use resources.