lib/{promscrape,leveledbytebufferpool}: rename getPoolIdAndCapacity to getPoolIDAndCapacity in order to make golint happy

This commit is contained in:
Aliaksandr Valialkin 2020-08-28 09:44:08 +03:00
parent 45e770ed20
commit 5f2277624a
2 changed files with 6 additions and 6 deletions

View file

@ -19,7 +19,7 @@ var pools [30]sync.Pool
// Get returns byte buffer with the given capacity. // Get returns byte buffer with the given capacity.
func Get(capacity int) *bytesutil.ByteBuffer { func Get(capacity int) *bytesutil.ByteBuffer {
id, capacityNeeded := getPoolIdAndCapacity(capacity) id, capacityNeeded := getPoolIDAndCapacity(capacity)
for i := 0; i < 2; i++ { for i := 0; i < 2; i++ {
if id < 0 || id >= len(pools) { if id < 0 || id >= len(pools) {
break break
@ -37,12 +37,12 @@ func Get(capacity int) *bytesutil.ByteBuffer {
// Put returns bb to the pool. // Put returns bb to the pool.
func Put(bb *bytesutil.ByteBuffer) { func Put(bb *bytesutil.ByteBuffer) {
capacity := cap(bb.B) capacity := cap(bb.B)
id, _ := getPoolIdAndCapacity(capacity) id, _ := getPoolIDAndCapacity(capacity)
bb.Reset() bb.Reset()
pools[id].Put(bb) pools[id].Put(bb)
} }
func getPoolIdAndCapacity(size int) (int, int) { func getPoolIDAndCapacity(size int) (int, int) {
size-- size--
if size < 0 { if size < 0 {
size = 0 size = 0

View file

@ -265,7 +265,7 @@ type leveledWriteRequestCtxPool struct {
} }
func (lwp *leveledWriteRequestCtxPool) Get(labelsCapacity int) *writeRequestCtx { func (lwp *leveledWriteRequestCtxPool) Get(labelsCapacity int) *writeRequestCtx {
id, capacityNeeded := lwp.getPoolIdAndCapacity(labelsCapacity) id, capacityNeeded := lwp.getPoolIDAndCapacity(labelsCapacity)
for i := 0; i < 2; i++ { for i := 0; i < 2; i++ {
if id < 0 || id >= len(lwp.pools) { if id < 0 || id >= len(lwp.pools) {
break break
@ -282,12 +282,12 @@ func (lwp *leveledWriteRequestCtxPool) Get(labelsCapacity int) *writeRequestCtx
func (lwp *leveledWriteRequestCtxPool) Put(wc *writeRequestCtx) { func (lwp *leveledWriteRequestCtxPool) Put(wc *writeRequestCtx) {
capacity := cap(wc.labels) capacity := cap(wc.labels)
id, _ := lwp.getPoolIdAndCapacity(capacity) id, _ := lwp.getPoolIDAndCapacity(capacity)
wc.reset() wc.reset()
lwp.pools[id].Put(wc) lwp.pools[id].Put(wc)
} }
func (lwp *leveledWriteRequestCtxPool) getPoolIdAndCapacity(size int) (int, int) { func (lwp *leveledWriteRequestCtxPool) getPoolIDAndCapacity(size int) (int, int) {
size-- size--
if size < 0 { if size < 0 {
size = 0 size = 0