pool

package
v0.0.0-...-e537141 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Bufio16k = NewBufio(buffer16K)

Functions

This section is empty.

Types

type Bufio

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

func NewBufio

func NewBufio(size int) (b Bufio)

func (Bufio) GetReadWriter

func (b Bufio) GetReadWriter(irw io.ReadWriter) *bufio.ReadWriter

func (Bufio) GetReader

func (b Bufio) GetReader(r io.Reader) (br *bufio.Reader)

func (Bufio) GetWriter

func (b Bufio) GetWriter(w io.Writer) (bw *bufio.Writer)

func (Bufio) PutReadWriter

func (b Bufio) PutReadWriter(br *bufio.ReadWriter)

func (Bufio) PutReader

func (b Bufio) PutReader(br *bufio.Reader)

func (Bufio) PutWriter

func (b Bufio) PutWriter(bw *bufio.Writer)

type Of

type Of[T any] interface {
	PoolGet() *T
	PoolPut(*T)
}

type OfBytes

type OfBytes interface {
	GetBytes() *bytes.Buffer
	PutBytes(*bytes.Buffer)
}

Bytes represent a generic pool of byte buffers.

type OfRequests

type OfRequests interface {
	GetRequest() *Request
	PutRequest(*Request)
}

type OfResponse

type OfResponse interface {
	GetResponse() *Request
	PutResponse(*Request)
}

type Pool

type Pool[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any]() (p *Pool[T])

func WithFunc

func WithFunc[T any](fn func() (t *T)) (p *Pool[T])

func (*Pool[T]) PoolGet

func (p *Pool[T]) PoolGet() (t *T)

func (*Pool[T]) PoolPut

func (p *Pool[T]) PoolPut(t *T)

type Request

type Request = http.Request

type Response

type Response = http.Response

type SyncBytes

type SyncBytes struct {
	// contains filtered or unexported fields
}
SyncBytes uses the standard library's sync.Pool to implement the Bytes

interface.

func NewSyncBytes

func NewSyncBytes() (b SyncBytes)

func (SyncBytes) GetBytes

func (b SyncBytes) GetBytes() (buf *bytes.Buffer)

func (SyncBytes) PutBytes

func (b SyncBytes) PutBytes(buf *bytes.Buffer)

type SyncRequest

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

SyncRequest uses the standard library's sync.Pool.

func NewSyncRequest

func NewSyncRequest() (s *SyncRequest)

func (*SyncRequest) GetRequest

func (r *SyncRequest) GetRequest() (req *Request)

func (*SyncRequest) PutRequest

func (r *SyncRequest) PutRequest(req *Request)

type SyncResponse

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

SyncRequest uses the standard library's sync.Pool.

func NewSyncResponse

func NewSyncResponse() (s *SyncResponse)

func (*SyncResponse) GetResponse

func (r *SyncResponse) GetResponse() (resp *Response)

func (*SyncResponse) PutResponse

func (r *SyncResponse) PutResponse(resp *Response)

Jump to

Keyboard shortcuts

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