File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ func main() {
7979}
8080
8181// performQueries tests the resource pool of connections.
82- func performQueries (query int , p pool.Interface ) {
82+ func performQueries (query int , p pool.AcquireReleaseCloser ) {
8383 // Acquire a connection from the pool.
8484 conn , err := p .Acquire ()
8585 if err != nil {
Original file line number Diff line number Diff line change @@ -12,10 +12,9 @@ import (
1212 "sync"
1313)
1414
15- // Pool manages a set of resources that can be acquired, released and closed.
16- // We name it Interface because when the package is imported it will be used
17- // as pool.Interface, which is better semantics.
18- type Interface interface {
15+ // AcquireReleaseCloser is behavior that need to be implemented
16+ // to use the pool package.
17+ type AcquireReleaseCloser interface {
1918 Acquire () (Resource , error )
2019 Release (Resource )
2120 Close ()
@@ -43,7 +42,7 @@ var ErrInvalidCapacity = errors.New("Capacity needs to be greater than zero.")
4342
4443// New creates a pool from a set of factory functions. A pool provides capacity
4544// number of resources that can be shared safely by multiple goroutines.
46- func New (fn func () (Resource , error ), capacity uint ) (Interface , error ) {
45+ func New (fn func () (Resource , error ), capacity uint ) (AcquireReleaseCloser , error ) {
4746 if capacity == 0 {
4847 return nil , ErrInvalidCapacity
4948 }
You can’t perform that action at this time.
0 commit comments