Documentation ¶
Overview ¶
Utilities used by falcore and its sub-packages IMPORTANT: utils cannot import falcore or there will be a circular dependency.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferPool ¶
type BufferPool struct {
// contains filtered or unexported fields
}
A leaky bucket buffer pool for bufio.Readers Dramatically reduces garbage when you have lots of short lived http connections.
func NewBufferPool ¶
func NewBufferPool(poolSize, bufferSize int) *BufferPool
func (*BufferPool) Give ¶
func (p *BufferPool) Give(bpe *BufferPoolEntry)
Return a buffer to the pool
func (*BufferPool) Take ¶
func (p *BufferPool) Take(r io.Reader) (bpe *BufferPoolEntry)
Take a buffer from the pool and set it up to read from r
type BufferPoolEntry ¶
This is what's stored in the buffer. It allows for the underlying io.Reader to be changed out inside a bufio.Reader. This is required for reuse.
type WriteBufferPool ¶
type WriteBufferPool struct {
// contains filtered or unexported fields
}
A leaky bucket buffer pool for bufio.Writers Dramatically reduces garbage when you have lots of short lived http connections.
func NewWriteBufferPool ¶
func NewWriteBufferPool(poolSize, bufferSize int) *WriteBufferPool
func (*WriteBufferPool) Give ¶
func (p *WriteBufferPool) Give(bpe *WriteBufferPoolEntry)
Return a buffer to the pool
func (*WriteBufferPool) Take ¶
func (p *WriteBufferPool) Take(r io.Writer) (bpe *WriteBufferPoolEntry)
Take a buffer from the pool and set it up to read from r
type WriteBufferPoolEntry ¶
This is what's stored in the buffer. It allows for the underlying io.Writer to be changed out inside a bufio.Writer. This is required for reuse.