From 83b4c9ebc87d0fddf4e638f13e3af1483912e3a5 Mon Sep 17 00:00:00 2001 From: Terin Stock Date: Tue, 26 Apr 2022 20:30:25 -0700 Subject: [chore] remove vendor --- vendor/codeberg.org/gruf/go-pools/bytes.go | 46 ------------------------------ 1 file changed, 46 deletions(-) delete mode 100644 vendor/codeberg.org/gruf/go-pools/bytes.go (limited to 'vendor/codeberg.org/gruf/go-pools/bytes.go') diff --git a/vendor/codeberg.org/gruf/go-pools/bytes.go b/vendor/codeberg.org/gruf/go-pools/bytes.go deleted file mode 100644 index 1aee77064..000000000 --- a/vendor/codeberg.org/gruf/go-pools/bytes.go +++ /dev/null @@ -1,46 +0,0 @@ -package pools - -import ( - "sync" - - "codeberg.org/gruf/go-byteutil" -) - -// BufferPool is a pooled allocator for bytes.Buffer objects -type BufferPool interface { - // Get fetches a bytes.Buffer from pool - Get() *byteutil.Buffer - - // Put places supplied bytes.Buffer in pool - Put(*byteutil.Buffer) -} - -// NewBufferPool returns a newly instantiated bytes.Buffer pool -func NewBufferPool(size int) BufferPool { - return &bufferPool{ - pool: sync.Pool{ - New: func() interface{} { - return &byteutil.Buffer{B: make([]byte, 0, size)} - }, - }, - size: size, - } -} - -// bufferPool is our implementation of BufferPool -type bufferPool struct { - pool sync.Pool - size int -} - -func (p *bufferPool) Get() *byteutil.Buffer { - return p.pool.Get().(*byteutil.Buffer) -} - -func (p *bufferPool) Put(buf *byteutil.Buffer) { - if buf.Cap() < p.size { - return - } - buf.Reset() - p.pool.Put(buf) -} -- cgit v1.2.3