Clarify the meanings of Stats accessors
This commit is contained in:
@@ -175,7 +175,8 @@ type Stat struct {
|
|||||||
canceledAcquireCount int64
|
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 {
|
func (s *Stat) TotalResources() int32 {
|
||||||
return s.constructingResources + s.acquiredResources + s.idleResources
|
return s.constructingResources + s.acquiredResources + s.idleResources
|
||||||
}
|
}
|
||||||
@@ -186,12 +187,12 @@ func (s *Stat) ConstructingResources() int32 {
|
|||||||
return s.constructingResources
|
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 {
|
func (s *Stat) AcquiredResources() int32 {
|
||||||
return s.acquiredResources
|
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 {
|
func (s *Stat) IdleResources() int32 {
|
||||||
return s.idleResources
|
return s.idleResources
|
||||||
}
|
}
|
||||||
@@ -201,7 +202,7 @@ func (s *Stat) MaxResources() int32 {
|
|||||||
return s.maxResources
|
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 {
|
func (s *Stat) AcquireCount() int64 {
|
||||||
return s.acquireCount
|
return s.acquireCount
|
||||||
}
|
}
|
||||||
@@ -212,14 +213,14 @@ func (s *Stat) AcquireDuration() time.Duration {
|
|||||||
return s.acquireDuration
|
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
|
// that waited for a resource to be released or constructed because the pool was
|
||||||
// empty.
|
// empty.
|
||||||
func (s *Stat) EmptyAcquireCount() int64 {
|
func (s *Stat) EmptyAcquireCount() int64 {
|
||||||
return s.emptyAcquireCount
|
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.
|
// that were canceled by a context.
|
||||||
func (s *Stat) CanceledAcquireCount() int64 {
|
func (s *Stat) CanceledAcquireCount() int64 {
|
||||||
return s.canceledAcquireCount
|
return s.canceledAcquireCount
|
||||||
|
|||||||
Reference in New Issue
Block a user