msgpack

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRawMetric

func NewRawMetric(data []byte, readerBufferSize int) aggregated.RawMetric

NewRawMetric creates a new raw metric.

Types

type AggregatedEncoder

type AggregatedEncoder interface {
	// EncodeMetricWithStoragePolicy encodes a metric with an applicable storage policy.
	EncodeMetricWithStoragePolicy(mp aggregated.MetricWithStoragePolicy) error

	// EncodeMetricWithStoragePolicyAndEncodeTime encodes a metric with an applicable
	// storage policy, alongside the time at which encoding happens.
	EncodeMetricWithStoragePolicyAndEncodeTime(
		mp aggregated.MetricWithStoragePolicy,
		encodedAtNanos int64,
	) error

	// EncodeChunkedMetricWithStoragePolicy encodes a chunked metric with an applicable storage policy.
	EncodeChunkedMetricWithStoragePolicy(cmp aggregated.ChunkedMetricWithStoragePolicy) error

	// EncodeChunkedMetricWithStoragePolicyAndEncodeTime encodes a chunked metric with
	// an applicable storage policy, alongside the time at which encoding happens.
	EncodeChunkedMetricWithStoragePolicyAndEncodeTime(
		cmp aggregated.ChunkedMetricWithStoragePolicy,
		encodedAtNanos int64,
	) error

	// Encoder returns the encoder.
	Encoder() BufferedEncoder

	// Reset resets the encoder.
	Reset(encoder BufferedEncoder)
}

AggregatedEncoder is an encoder for encoding aggregated metrics.

func NewAggregatedEncoder

func NewAggregatedEncoder(encoder BufferedEncoder) AggregatedEncoder

NewAggregatedEncoder creates an aggregated encoder.

type AggregatedIterator

type AggregatedIterator interface {
	// Next returns true if there are more metrics to decode.
	Next() bool

	// Value returns the current raw metric, the corresponding policy, and timestamp at
	// which the metric and the policy were encoded if applicable.
	Value() (aggregated.RawMetric, policy.StoragePolicy, int64)

	// Err returns the error encountered during decoding, if any.
	Err() error

	// Reset resets the iterator.
	Reset(reader io.Reader)

	// Close closes the iterator.
	Close()
}

AggregatedIterator is an iterator for decoding aggregated metrics.

func NewAggregatedIterator

func NewAggregatedIterator(reader io.Reader, opts AggregatedIteratorOptions) AggregatedIterator

NewAggregatedIterator creates a new aggregated iterator.

type AggregatedIteratorAlloc

type AggregatedIteratorAlloc func() AggregatedIterator

AggregatedIteratorAlloc allocates an aggregated iterator.

type AggregatedIteratorOptions

type AggregatedIteratorOptions interface {
	// SetIgnoreHigherVersion determines whether the iterator ignores messages
	// with higher-than-supported version.
	SetIgnoreHigherVersion(value bool) AggregatedIteratorOptions

	// IgnoreHigherVersion returns whether the iterator ignores messages with
	// higher-than-supported version.
	IgnoreHigherVersion() bool

	// SetReaderBufferSize sets the reader buffer size.
	SetReaderBufferSize(value int) AggregatedIteratorOptions

	// ReaderBufferSize returns the reader buffer size.
	ReaderBufferSize() int

	// SetIteratorPool sets the aggregated iterator pool.
	SetIteratorPool(value AggregatedIteratorPool) AggregatedIteratorOptions

	// IteratorPool returns the aggregated iterator pool.
	IteratorPool() AggregatedIteratorPool
}

AggregatedIteratorOptions provide options for aggregated iterators.

func NewAggregatedIteratorOptions

func NewAggregatedIteratorOptions() AggregatedIteratorOptions

NewAggregatedIteratorOptions creates a new set of aggregated iterator options.

type AggregatedIteratorPool

type AggregatedIteratorPool interface {
	// Init initializes the aggregated iterator pool.
	Init(alloc AggregatedIteratorAlloc)

	// Get returns an aggregated iterator from the pool.
	Get() AggregatedIterator

	// Put puts an aggregated iterator into the pool.
	Put(it AggregatedIterator)
}

AggregatedIteratorPool is a pool of aggregated iterators.

func NewAggregatedIteratorPool

func NewAggregatedIteratorPool(opts pool.ObjectPoolOptions) AggregatedIteratorPool

NewAggregatedIteratorPool creates a new pool for aggregated iterators.

type Buffer

type Buffer interface {
	// Buffer returns the bytes buffer.
	Buffer() *bytes.Buffer

	// Bytes returns the buffered bytes.
	Bytes() []byte

	// Reset resets the buffer.
	Reset()

	// Close closes the buffer.
	Close()
}

Buffer is a byte buffer.

type BufferedEncoder

type BufferedEncoder interface {
	Buffer
	Encoder
}

BufferedEncoder is an encoder backed by byte buffers.

func NewBufferedEncoder

func NewBufferedEncoder() BufferedEncoder

NewBufferedEncoder creates a new buffered encoder.

func NewPooledBufferedEncoder

func NewPooledBufferedEncoder(p BufferedEncoderPool) BufferedEncoder

NewPooledBufferedEncoder creates a new pooled buffered encoder.

func NewPooledBufferedEncoderSize

func NewPooledBufferedEncoderSize(p BufferedEncoderPool, size int) BufferedEncoder

NewPooledBufferedEncoderSize creates a new pooled buffered encoder with an initial buffer size.

type BufferedEncoderAlloc

type BufferedEncoderAlloc func() BufferedEncoder

BufferedEncoderAlloc allocates a bufferer encoder.

type BufferedEncoderPool

type BufferedEncoderPool interface {
	// Init initializes the buffered encoder pool.
	Init(alloc BufferedEncoderAlloc)

	// Get returns a buffered encoder from the pool.
	Get() BufferedEncoder

	// Put puts a buffered encoder into the pool.
	Put(enc BufferedEncoder)
}

BufferedEncoderPool is a pool of buffered encoders.

func NewBufferedEncoderPool

func NewBufferedEncoderPool(opts BufferedEncoderPoolOptions) BufferedEncoderPool

NewBufferedEncoderPool creates a new pool for buffered encoders.

type BufferedEncoderPoolOptions

type BufferedEncoderPoolOptions interface {
	// SetMaxCapacity sets the maximum capacity of buffers that can be returned to the pool.
	SetMaxCapacity(value int) BufferedEncoderPoolOptions

	// MaxBufferCapacity returns the maximum capacity of buffers that can be returned to the pool.
	MaxCapacity() int

	// SetObjectPoolOptions sets the object pool options.
	SetObjectPoolOptions(value pool.ObjectPoolOptions) BufferedEncoderPoolOptions

	// ObjectPoolOptions returns the object pool options.
	ObjectPoolOptions() pool.ObjectPoolOptions
}

BufferedEncoderPoolOptions provides options for buffered encoder pools.

func NewBufferedEncoderPoolOptions

func NewBufferedEncoderPoolOptions() BufferedEncoderPoolOptions

NewBufferedEncoderPoolOptions creates a new set of buffered encoder pool options.

type Encoder

type Encoder interface {
	// EncodeInt64 encodes an int64 value.
	EncodeInt64(value int64) error

	// EncodeBool encodes a boolean value.
	EncodeBool(value bool) error

	// EncodeFloat64 encodes a float64 value.
	EncodeFloat64(value float64) error

	// EncodeBytes encodes a byte slice.
	EncodeBytes(value []byte) error

	// EncodeBytesLen encodes the length of a byte slice.
	EncodeBytesLen(value int) error

	// EncodeArrayLen encodes the length of an array.
	EncodeArrayLen(value int) error
}

Encoder is an encoder.

type UnaggregatedEncoder

type UnaggregatedEncoder interface {
	// EncodeCounter encodes a counter.
	EncodeCounter(c unaggregated.Counter) error

	// EncodeBatchTimer encodes a batch timer.
	EncodeBatchTimer(bt unaggregated.BatchTimer) error

	// EncodeGauge encodes a gauge.
	EncodeGauge(g unaggregated.Gauge) error

	// EncodeCounterWithPoliciesList encodes a counter with applicable policies list.
	EncodeCounterWithPoliciesList(cp unaggregated.CounterWithPoliciesList) error

	// EncodeBatchTimerWithPoliciesList encodes a batched timer with applicable policies list.
	EncodeBatchTimerWithPoliciesList(btp unaggregated.BatchTimerWithPoliciesList) error

	// EncodeGaugeWithPoliciesList encodes a gauge with applicable policies list.
	EncodeGaugeWithPoliciesList(gp unaggregated.GaugeWithPoliciesList) error

	// Encoder returns the encoder.
	Encoder() BufferedEncoder

	// Reset resets the encoder.
	Reset(encoder BufferedEncoder)
}

UnaggregatedEncoder is an encoder for encoding different types of unaggregated metrics.

func NewUnaggregatedEncoder

func NewUnaggregatedEncoder(encoder BufferedEncoder) UnaggregatedEncoder

NewUnaggregatedEncoder creates a new unaggregated encoder.

type UnaggregatedIterator

type UnaggregatedIterator interface {
	// Next returns true if there are more items to decode.
	Next() bool

	// Metric returns the current metric.
	// The returned value remains valid until the next Next() call.
	Metric() unaggregated.MetricUnion

	// PoliciesList returns the current applicable policies list.
	// The returned value remains valid until the next Next() call.
	PoliciesList() policy.PoliciesList

	// Err returns the error encountered during decoding, if any.
	Err() error

	// Reset resets the iterator.
	Reset(reader io.Reader)

	// Close closes the iterator.
	Close()
}

UnaggregatedIterator is an iterator for decoding different types of unaggregated metrics.

func NewUnaggregatedIterator

func NewUnaggregatedIterator(reader io.Reader, opts UnaggregatedIteratorOptions) UnaggregatedIterator

NewUnaggregatedIterator creates a new unaggregated iterator.

type UnaggregatedIteratorAlloc

type UnaggregatedIteratorAlloc func() UnaggregatedIterator

UnaggregatedIteratorAlloc allocates an unaggregated iterator.

type UnaggregatedIteratorOptions

type UnaggregatedIteratorOptions interface {
	// SetIgnoreHigherVersion determines whether the iterator ignores messages
	// with higher-than-supported version.
	SetIgnoreHigherVersion(value bool) UnaggregatedIteratorOptions

	// IgnoreHigherVersion returns whether the iterator ignores messages with
	// higher-than-supported version.
	IgnoreHigherVersion() bool

	// SetReaderBufferSize sets the reader buffer size.
	SetReaderBufferSize(value int) UnaggregatedIteratorOptions

	// ReaderBufferSize returns the reader buffer size.
	ReaderBufferSize() int

	// SetLargeFloatsSize determines whether a float slice is considered a "large"
	// slice and therefore resort to the pool for allocating that slice.
	SetLargeFloatsSize(value int) UnaggregatedIteratorOptions

	// LargeFloatsSize returns whether a float slice is considered a "large"
	// slice and therefore resort to the pool for allocating that slice.
	LargeFloatsSize() int

	// SetLargeFloatsPool sets the large floats pool.
	SetLargeFloatsPool(value pool.FloatsPool) UnaggregatedIteratorOptions

	// LargeFloatsPool returns the large floats pool.
	LargeFloatsPool() pool.FloatsPool

	// SetIteratorPool sets the unaggregated iterator pool.
	SetIteratorPool(value UnaggregatedIteratorPool) UnaggregatedIteratorOptions

	// IteratorPool returns the unaggregated iterator pool.
	IteratorPool() UnaggregatedIteratorPool
}

UnaggregatedIteratorOptions provide options for unaggregated iterators.

func NewUnaggregatedIteratorOptions

func NewUnaggregatedIteratorOptions() UnaggregatedIteratorOptions

NewUnaggregatedIteratorOptions creates a new set of unaggregated iterator options.

type UnaggregatedIteratorPool

type UnaggregatedIteratorPool interface {
	// Init initializes the unaggregated iterator pool.
	Init(alloc UnaggregatedIteratorAlloc)

	// Get returns an unaggregated iterator from the pool.
	Get() UnaggregatedIterator

	// Put puts an unaggregated iterator into the pool.
	Put(it UnaggregatedIterator)
}

UnaggregatedIteratorPool is a pool of unaggregated iterators.

func NewUnaggregatedIteratorPool

func NewUnaggregatedIteratorPool(opts pool.ObjectPoolOptions) UnaggregatedIteratorPool

NewUnaggregatedIteratorPool creates a new pool for unaggregated iterators.

Jump to

Keyboard shortcuts

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