pools

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 5 Imported by: 3

README

A selection of type-defined sync.Pool implementations with redefined "getter" and "putter" methods to handle their appropriate types.

As these are only type definitions you MUST use the appropriate New___() function instantiate them. Or do it manually yourself from a sync.Pool setting the sync.Pool.New function as appropriate.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferPool

type BufferPool interface {
	// Get fetches a bytes.Buffer from pool
	Get() *bytes.Buffer

	// Put places supplied bytes.Buffer in pool
	Put(*bytes.Buffer)
}

BufferPool is a pooled allocator for bytes.Buffer objects

func NewBufferPool

func NewBufferPool(size int) BufferPool

NewBufferPool returns a newly instantiated bytes.Buffer pool

type BufioReaderPool

type BufioReaderPool interface {
	// Get fetches a bufio.Reader from pool and resets to supplied reader
	Get(io.Reader) *bufio.Reader

	// Put places supplied bufio.Reader back in pool
	Put(*bufio.Reader)
}

BufioReaderPool is a pooled allocator for bufio.Reader objects

func NewBufioReaderPool

func NewBufioReaderPool(size int) BufioReaderPool

NewBufioReaderPool returns a newly instantiated bufio.Reader pool

type BufioWriterPool

type BufioWriterPool interface {
	// Get fetches a bufio.Writer from pool and resets to supplied writer
	Get(io.Writer) *bufio.Writer

	// Put places supplied bufio.Writer back in pool
	Put(*bufio.Writer)
}

BufioWriterPool is a pooled allocator for bufio.Writer objects

func NewBufioWriterPool

func NewBufioWriterPool(size int) BufioWriterPool

NewBufioWriterPool returns a newly instantiated bufio.Writer pool

type PathBuilderPool

type PathBuilderPool interface {
	// Get fetches a fastpath.Builder from pool
	Get() *fastpath.Builder

	// Put places supplied fastpath.Builder back in pool
	Put(*fastpath.Builder)
}

PathBuilderPool is a pooled allocator for fastpath.Builder objects

func NewPathBuilderPool

func NewPathBuilderPool(size int) PathBuilderPool

NewPathBuilderPool returns a newly instantiated fastpath.Builder pool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL