bufferpool

package
v3.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPoolBufferCount

func GetPoolBufferCount(bufferPoolLimitMB int, receiveBufferSize int) (int, error)

GetPoolBufferCount returns number of buffers that can fit in the given buffer pool limit where each buffer is of size receiveBufferSize.

Types

type BufferPool

type BufferPool struct {
	// Slice of byte slices to store trace segments.
	Buffers []*[]byte
	// contains filtered or unexported fields
}

BufferPool is a structure for storing trace segments.

func Init

func Init(bufferLimit int, bufferSize int) *BufferPool

Init initializes new BufferPool with bufferLimit buffers, each of bufferSize.

func (*BufferPool) CurrentBuffersLen

func (b *BufferPool) CurrentBuffersLen() int

CurrentBuffersLen returns length of buffers.

func (*BufferPool) Get

func (b *BufferPool) Get() *[]byte

Get returns available buffer of BufferPool b, nil if not any.

func (*BufferPool) Return

func (b *BufferPool) Return(buf *[]byte)

Return adds buffer buf to BufferPool b.

Jump to

Keyboard shortcuts

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