pool

package
v0.0.0-...-e5d0cd3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBiggerClosestN

func GetBiggerClosestN(need int) (n int)

func GetBuffer

func GetBuffer() *bytes.Buffer

func GetClosestN

func GetClosestN(need int) (n int)

func GetZero

func GetZero(size int) []byte

GetZero returns buffer and set all the values to 0

func Put

func Put(buf []byte)

Put puts a buffer into pool.

func PutBuffer

func PutBuffer(buf *bytes.Buffer)

Types

type B

type B []byte

B is bytes not from pool

func (B) Bytes

func (b B) Bytes() []byte

func (B) HeadOverlap

func (b B) HeadOverlap(p []byte) bool

func (B) Put

func (B) Put()

type Bytes

type Bytes interface {
	Put()
	Bytes() []byte
	HeadOverlap([]byte) bool
}

type PB

type PB []byte

PB is bytes from pool

func Get

func Get(size int) PB

Get gets a buffer from pool, size should in range: [1, 65536], otherwise, this function will call make([]byte, size) directly.

func GetFullCap

func GetFullCap(size int) PB

func GetMustBigger

func GetMustBigger(size int) PB

func (PB) Bytes

func (b PB) Bytes() []byte

func (PB) HeadOverlap

func (b PB) HeadOverlap(p []byte) bool

func (PB) Put

func (b PB) Put()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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