mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
29 lines
402 B
Go
29 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
|