sync

package
v6.0.0-...-6a67b46 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBufioReader

func GetBufioReader(reader io.Reader) *bufio.Reader

GetBufioReader returns a *bufio.Reader that is managed by a sync.Pool. Returns a bufio.Reader that is reset with reader and ready for use.

After use, the *bufio.Reader should be put back into the sync.Pool by calling PutBufioReader.

func GetByteSlice

func GetByteSlice() *[]byte

GetByteSlice returns a *[]byte that is managed by a sync.Pool. The initial slice length will be 32768 (32kb).

After use, the *[]byte should be put back into the sync.Pool by calling PutByteSlice.

func GetBytesBuffer

func GetBytesBuffer() *bytes.Buffer

GetBytesBuffer returns a *bytes.Buffer that is managed by a sync.Pool. Returns a buffer that is reset and ready for use.

After use, the *bytes.Buffer should be put back into the sync.Pool by calling PutBytesBuffer.

func GetZlibWriter

func GetZlibWriter(w io.Writer) *zlib.Writer

GetZlibWriter returns a *zlib.Writer that is managed by a sync.Pool. Returns a writer that is reset with w and ready for use.

After use, the *zlib.Writer should be put back into the sync.Pool by calling PutZlibWriter.

func PutBufioReader

func PutBufioReader(reader *bufio.Reader)

PutBufioReader puts reader back into its sync.Pool.

func PutByteSlice

func PutByteSlice(buf *[]byte)

PutByteSlice puts buf back into its sync.Pool.

func PutBytesBuffer

func PutBytesBuffer(buf *bytes.Buffer)

PutBytesBuffer puts buf back into its sync.Pool.

func PutZlibReader

func PutZlibReader(z *ZLibReader)

PutZlibReader puts z back into its sync.Pool. The Byte slice dictionary is also put back into its sync.Pool.

func PutZlibWriter

func PutZlibWriter(w *zlib.Writer)

PutZlibWriter puts w back into its sync.Pool.

Types

type ZLibReader

type ZLibReader struct {
	// contains filtered or unexported fields
}

func GetZlibReader

func GetZlibReader(r io.Reader) (*ZLibReader, error)

GetZlibReader returns a ZLibReader that is managed by a sync.Pool. Returns a ZLibReader that is reset using a dictionary that is also managed by a sync.Pool.

After use, the ZLibReader should be put back into the sync.Pool by calling PutZlibReader.

func (*ZLibReader) Close

func (r *ZLibReader) Close() error

func (*ZLibReader) Read

func (r *ZLibReader) Read(p []byte) (int, error)

Jump to

Keyboard shortcuts

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