pool

package
v0.0.0-...-170def7 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatagramBufferPool

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

DatabramBufferPool is a strongly typed wrapper around a sync.Pool for *[][]byte

func NewDatagramBufferPool

func NewDatagramBufferPool(bufferSize int) *DatagramBufferPool

func (*DatagramBufferPool) Get

func (p *DatagramBufferPool) Get() *[][]byte

func (*DatagramBufferPool) Put

func (p *DatagramBufferPool) Put(b *[][]byte)

type MetricPool

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

MetricPool is a strongly typed wrapper around a sync.Pool for *gostatsd.Metric, it provides two main benefits: 1) metrics are very short lived and we create a lot of them, 2) reuse of the tags buffer

func NewMetricPool

func NewMetricPool(estimatedTags int) *MetricPool

NewMetricPool returns a new metric pool.

func (*MetricPool) Get

func (mp *MetricPool) Get() *gostatsd.Metric

Get returns a *gostatsd.Metric suitable for holding a metric. The DoneFunc should be called when the metric is no longer required, it must not be called earlier. The Tags field may be reused, so any usage of tags must be be Tags.Copy()'d before calling Metric.Done()

Jump to

Keyboard shortcuts

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