summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-store/util/pool.go
blob: 8400cb5b78d5f179e587f5a6a80b3fb8adf9dc63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package util

import (
	"codeberg.org/gruf/go-fastpath"
	"codeberg.org/gruf/go-pools"
)

// pathBuilderPool is the global fastpath.Builder pool
var pathBuilderPool = pools.NewPathBuilderPool(512)

// GetPathBuilder fetches a fastpath.Builder object from the pool
func GetPathBuilder() *fastpath.Builder {
	return pathBuilderPool.Get()
}

// PutPathBuilder places supplied fastpath.Builder back in the pool
func PutPathBuilder(pb *fastpath.Builder) {
	pb.Reset()
	pathBuilderPool.Put(pb)
}