diff --git a/lib/logstorage/filter.go b/lib/logstorage/filter.go index b8f0ba4c6..950223b75 100644 --- a/lib/logstorage/filter.go +++ b/lib/logstorage/filter.go @@ -67,30 +67,6 @@ func (fs *streamFilter) apply(bs *blockSearch, bm *bitmap) { } } -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 - func getTokensSkipLast(s string) []string { for { r, runeSize := utf8.DecodeLastRuneInString(s) diff --git a/lib/logstorage/stringbucket.go b/lib/logstorage/stringbucket.go new file mode 100644 index 000000000..fd1fc60f1 --- /dev/null +++ b/lib/logstorage/stringbucket.go @@ -0,0 +1,29 @@ +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