mirror of
https://github.com/nikdoof/vsphere-influxdb-go.git
synced 2025-12-19 21:49:21 +00:00
add vendoring with go dep
This commit is contained in:
26
vendor/github.com/influxdata/influxdb/tsdb/engine/tsm1/pools.go
generated
vendored
Normal file
26
vendor/github.com/influxdata/influxdb/tsdb/engine/tsm1/pools.go
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
package tsm1
|
||||
|
||||
import "sync"
|
||||
|
||||
var bufPool sync.Pool
|
||||
|
||||
// getBuf returns a buffer with length size from the buffer pool.
|
||||
func getBuf(size int) *[]byte {
|
||||
x := bufPool.Get()
|
||||
if x == nil {
|
||||
b := make([]byte, size)
|
||||
return &b
|
||||
}
|
||||
buf := x.(*[]byte)
|
||||
if cap(*buf) < size {
|
||||
b := make([]byte, size)
|
||||
return &b
|
||||
}
|
||||
*buf = (*buf)[:size]
|
||||
return buf
|
||||
}
|
||||
|
||||
// putBuf returns a buffer to the pool.
|
||||
func putBuf(buf *[]byte) {
|
||||
bufPool.Put(buf)
|
||||
}
|
||||
Reference in New Issue
Block a user