From a70fb082dfdb0f508f570ea890f8513845a400dc Mon Sep 17 00:00:00 2001 From: Yaz Saito Date: Mon, 28 Sep 2020 07:53:01 -0700 Subject: [PATCH] Clarify the meanings of Stats accessors --- pool.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pool.go b/pool.go index a3b341c..52c5e8f 100644 --- a/pool.go +++ b/pool.go @@ -175,7 +175,8 @@ type Stat struct { canceledAcquireCount int64 } -// TotalResource returns the total number of resources. +// TotalResource returns the total number of allocated resources in the pool. +// The value is the sum of ConstructingResources, AcquiredResources, and IdleResources. func (s *Stat) TotalResources() int32 { return s.constructingResources + s.acquiredResources + s.idleResources } @@ -186,12 +187,12 @@ func (s *Stat) ConstructingResources() int32 { return s.constructingResources } -// AcquiredResources returns the number of acquired resources in the pool. +// AcquiredResources returns the number of currently acquired resources in the pool. func (s *Stat) AcquiredResources() int32 { return s.acquiredResources } -// IdleResources returns the number of idle resources in the pool. +// IdleResources returns the number of currently idle resources in the pool. func (s *Stat) IdleResources() int32 { return s.idleResources } @@ -201,7 +202,7 @@ func (s *Stat) MaxResources() int32 { return s.maxResources } -// AcquireCount returns the number of successful acquires from the pool. +// AcquireCount returns the cumulative count of successful acquires from the pool. func (s *Stat) AcquireCount() int64 { return s.acquireCount } @@ -212,14 +213,14 @@ func (s *Stat) AcquireDuration() time.Duration { return s.acquireDuration } -// EmptyAcquireCount returns the number of successful acquires from the pool +// EmptyAcquireCount returns the cumulative count of successful acquires from the pool // that waited for a resource to be released or constructed because the pool was // empty. func (s *Stat) EmptyAcquireCount() int64 { return s.emptyAcquireCount } -// CanceledAcquireCount returns the number of acquires from the pool +// CanceledAcquireCount returns the cumulative count of acquires from the pool // that were canceled by a context. func (s *Stat) CanceledAcquireCount() int64 { return s.canceledAcquireCount