mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
30 lines
402 B
Go
30 lines
402 B
Go
package logstorage
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
type stringBucket struct {
|
|
a []string
|
|
}
|
|
|
|
func (sb *stringBucket) reset() {
|
|
clear(sb.a)
|
|
sb.a = sb.a[:0]
|
|
}
|
|
|
|
func getStringBucket() *stringBucket {
|
|
v := stringBucketPool.Get()
|
|
if v == nil {
|
|
return &stringBucket{}
|
|
}
|
|
return v.(*stringBucket)
|
|
}
|
|
|
|
func putStringBucket(sb *stringBucket) {
|
|
sb.reset()
|
|
stringBucketPool.Put(sb)
|
|
}
|
|
|
|
var stringBucketPool sync.Pool
|