2
0

Merge pull request #6 from yasushi-saito/master

Clarify the meanings of Stats accessors
This commit is contained in:
Jack Christensen
2020-10-05 08:59:19 -05:00
committed by GitHub
+8 -6
View File
@@ -175,7 +175,9 @@ type Stat struct {
canceledAcquireCount int64
}
// TotalResource returns the total number of resources.
// TotalResource returns the total number of resources currently 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 +188,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 +203,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 +214,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