mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/{promscrape,leveledbytebufferpool}: rename getPoolIdAndCapacity to getPoolIDAndCapacity in order to make golint happy
This commit is contained in:
parent
f4c4ab811b
commit
acbcad1ece
2 changed files with 6 additions and 6 deletions
|
@ -19,7 +19,7 @@ var pools [30]sync.Pool
|
|||
|
||||
// Get returns byte buffer with the given capacity.
|
||||
func Get(capacity int) *bytesutil.ByteBuffer {
|
||||
id, capacityNeeded := getPoolIdAndCapacity(capacity)
|
||||
id, capacityNeeded := getPoolIDAndCapacity(capacity)
|
||||
for i := 0; i < 2; i++ {
|
||||
if id < 0 || id >= len(pools) {
|
||||
break
|
||||
|
@ -37,12 +37,12 @@ func Get(capacity int) *bytesutil.ByteBuffer {
|
|||
// Put returns bb to the pool.
|
||||
func Put(bb *bytesutil.ByteBuffer) {
|
||||
capacity := cap(bb.B)
|
||||
id, _ := getPoolIdAndCapacity(capacity)
|
||||
id, _ := getPoolIDAndCapacity(capacity)
|
||||
bb.Reset()
|
||||
pools[id].Put(bb)
|
||||
}
|
||||
|
||||
func getPoolIdAndCapacity(size int) (int, int) {
|
||||
func getPoolIDAndCapacity(size int) (int, int) {
|
||||
size--
|
||||
if size < 0 {
|
||||
size = 0
|
||||
|
|
|
@ -265,7 +265,7 @@ type leveledWriteRequestCtxPool struct {
|
|||
}
|
||||
|
||||
func (lwp *leveledWriteRequestCtxPool) Get(labelsCapacity int) *writeRequestCtx {
|
||||
id, capacityNeeded := lwp.getPoolIdAndCapacity(labelsCapacity)
|
||||
id, capacityNeeded := lwp.getPoolIDAndCapacity(labelsCapacity)
|
||||
for i := 0; i < 2; i++ {
|
||||
if id < 0 || id >= len(lwp.pools) {
|
||||
break
|
||||
|
@ -282,12 +282,12 @@ func (lwp *leveledWriteRequestCtxPool) Get(labelsCapacity int) *writeRequestCtx
|
|||
|
||||
func (lwp *leveledWriteRequestCtxPool) Put(wc *writeRequestCtx) {
|
||||
capacity := cap(wc.labels)
|
||||
id, _ := lwp.getPoolIdAndCapacity(capacity)
|
||||
id, _ := lwp.getPoolIDAndCapacity(capacity)
|
||||
wc.reset()
|
||||
lwp.pools[id].Put(wc)
|
||||
}
|
||||
|
||||
func (lwp *leveledWriteRequestCtxPool) getPoolIdAndCapacity(size int) (int, int) {
|
||||
func (lwp *leveledWriteRequestCtxPool) getPoolIDAndCapacity(size int) (int, int) {
|
||||
size--
|
||||
if size < 0 {
|
||||
size = 0
|
||||
|
|
Loading…
Reference in a new issue