Documentation ¶
Overview ¶
Package protobuf is a generated GoMock package.
Index ¶
- func ReuseAggregatedMetricProto(pb *metricpb.AggregatedMetric)
- func ReuseMetricWithMetadatasProto(pb *metricpb.MetricWithMetadatas)
- type AggregatedDecoder
- func (d *AggregatedDecoder) Close()
- func (d *AggregatedDecoder) Decode(b []byte) error
- func (d AggregatedDecoder) EncodeNanos() int64
- func (d AggregatedDecoder) ID() []byte
- func (d AggregatedDecoder) StoragePolicy() policy.StoragePolicy
- func (d AggregatedDecoder) TimeNanos() int64
- func (d *AggregatedDecoder) Type() ts.PromMetricType
- func (d AggregatedDecoder) Value() float64
- type AggregatedDecoderPool
- type AggregatedEncoder
- type Buffer
- type MockUnaggregatedEncoder
- func (m *MockUnaggregatedEncoder) EXPECT() *MockUnaggregatedEncoderMockRecorder
- func (m *MockUnaggregatedEncoder) EncodeMessage(arg0 encoding.UnaggregatedMessageUnion) error
- func (m *MockUnaggregatedEncoder) Len() int
- func (m *MockUnaggregatedEncoder) Relinquish() Buffer
- func (m *MockUnaggregatedEncoder) Reset(arg0 []byte)
- func (m *MockUnaggregatedEncoder) Truncate(arg0 int) error
- type MockUnaggregatedEncoderMockRecorder
- func (mr *MockUnaggregatedEncoderMockRecorder) EncodeMessage(arg0 interface{}) *gomock.Call
- func (mr *MockUnaggregatedEncoderMockRecorder) Len() *gomock.Call
- func (mr *MockUnaggregatedEncoderMockRecorder) Relinquish() *gomock.Call
- func (mr *MockUnaggregatedEncoderMockRecorder) Reset(arg0 interface{}) *gomock.Call
- func (mr *MockUnaggregatedEncoderMockRecorder) Truncate(arg0 interface{}) *gomock.Call
- type PoolReleaseFn
- type UnaggregatedEncoder
- type UnaggregatedIterator
- type UnaggregatedOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReuseAggregatedMetricProto ¶ added in v1.0.0
func ReuseAggregatedMetricProto(pb *metricpb.AggregatedMetric)
ReuseAggregatedMetricProto allows for zero-alloc reuse of *metricpb.AggregatedMetric
func ReuseMetricWithMetadatasProto ¶ added in v0.15.0
func ReuseMetricWithMetadatasProto(pb *metricpb.MetricWithMetadatas)
ReuseMetricWithMetadatasProto allows for zero-alloc reuse of *metricpb.MetricWithMetadatas by deep resetting the internal slices and when using gogoprotobuf's unmarshal function will reuse the slices and byte buffers already allocated on the message itself.
It is required to use nullable: false annotations so that it does not use pointer types for slices on the message to achieve zero alloc resets.
The methods resets the metric with metadatas proto, and in particular message fields that are slices because the `Unmarshal` generated from gogoprotobuf simply append a new entry at the end of the slice, and as such, the fields with slice types need to be reset to be zero-length. NB: reset only needs to be done to the top-level slice fields as the individual items in the slice are created afresh during unmarshaling.
Types ¶
type AggregatedDecoder ¶ added in v0.5.0
type AggregatedDecoder struct {
// contains filtered or unexported fields
}
AggregatedDecoder is a decoder for decoding aggregated metrics.
func NewAggregatedDecoder ¶ added in v0.5.0
func NewAggregatedDecoder(p AggregatedDecoderPool) *AggregatedDecoder
NewAggregatedDecoder creates an aggregated decoder.
func (*AggregatedDecoder) Close ¶ added in v0.5.0
func (d *AggregatedDecoder) Close()
Close closes the decoder.
func (*AggregatedDecoder) Decode ¶ added in v0.5.0
func (d *AggregatedDecoder) Decode(b []byte) error
Decode decodes the aggregated metric from the given bytes.
func (AggregatedDecoder) EncodeNanos ¶ added in v0.5.0
func (d AggregatedDecoder) EncodeNanos() int64
EncodeNanos returns the decoded encodeNanos.
func (AggregatedDecoder) ID ¶ added in v0.5.0
func (d AggregatedDecoder) ID() []byte
ID returns the decoded id.
func (AggregatedDecoder) StoragePolicy ¶ added in v0.5.0
func (d AggregatedDecoder) StoragePolicy() policy.StoragePolicy
StoragePolicy returns the decoded storage policy.
func (AggregatedDecoder) TimeNanos ¶ added in v0.5.0
func (d AggregatedDecoder) TimeNanos() int64
TimeNanos returns the decoded timestamp.
func (*AggregatedDecoder) Type ¶ added in v1.1.0
func (d *AggregatedDecoder) Type() ts.PromMetricType
Type returns the type of the metric.
func (AggregatedDecoder) Value ¶ added in v0.5.0
func (d AggregatedDecoder) Value() float64
Value returns the decoded value.
type AggregatedDecoderPool ¶ added in v0.5.0
type AggregatedDecoderPool interface { Init() Get() *AggregatedDecoder Put(d *AggregatedDecoder) }
AggregatedDecoderPool is a pool of aggregated decoders.
func NewAggregatedDecoderPool ¶ added in v0.5.0
func NewAggregatedDecoderPool(opts pool.ObjectPoolOptions) AggregatedDecoderPool
NewAggregatedDecoderPool creates a new pool for aggregated decoders.
type AggregatedEncoder ¶ added in v0.5.0
type AggregatedEncoder interface { // Encode encodes a metric with an applicable storage policy, // alongside the time at which encoding happens. Encode(m aggregated.MetricWithStoragePolicy, encodedAtNanos int64) error // Buffer returns the encoded buffer. Buffer() Buffer }
AggregatedEncoder is an encoder for encoding aggregated metrics.
func NewAggregatedEncoder ¶ added in v0.5.0
func NewAggregatedEncoder(p pool.BytesPool) AggregatedEncoder
NewAggregatedEncoder creates a new aggregated encoder.
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer contains a byte slice backed by an optional bytes pool.
type MockUnaggregatedEncoder ¶
type MockUnaggregatedEncoder struct {
// contains filtered or unexported fields
}
MockUnaggregatedEncoder is a mock of UnaggregatedEncoder interface
func NewMockUnaggregatedEncoder ¶
func NewMockUnaggregatedEncoder(ctrl *gomock.Controller) *MockUnaggregatedEncoder
NewMockUnaggregatedEncoder creates a new mock instance
func (*MockUnaggregatedEncoder) EXPECT ¶
func (m *MockUnaggregatedEncoder) EXPECT() *MockUnaggregatedEncoderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockUnaggregatedEncoder) EncodeMessage ¶
func (m *MockUnaggregatedEncoder) EncodeMessage(arg0 encoding.UnaggregatedMessageUnion) error
EncodeMessage mocks base method
func (*MockUnaggregatedEncoder) Len ¶
func (m *MockUnaggregatedEncoder) Len() int
Len mocks base method
func (*MockUnaggregatedEncoder) Relinquish ¶
func (m *MockUnaggregatedEncoder) Relinquish() Buffer
Relinquish mocks base method
func (*MockUnaggregatedEncoder) Reset ¶
func (m *MockUnaggregatedEncoder) Reset(arg0 []byte)
Reset mocks base method
func (*MockUnaggregatedEncoder) Truncate ¶
func (m *MockUnaggregatedEncoder) Truncate(arg0 int) error
Truncate mocks base method
type MockUnaggregatedEncoderMockRecorder ¶
type MockUnaggregatedEncoderMockRecorder struct {
// contains filtered or unexported fields
}
MockUnaggregatedEncoderMockRecorder is the mock recorder for MockUnaggregatedEncoder
func (*MockUnaggregatedEncoderMockRecorder) EncodeMessage ¶
func (mr *MockUnaggregatedEncoderMockRecorder) EncodeMessage(arg0 interface{}) *gomock.Call
EncodeMessage indicates an expected call of EncodeMessage
func (*MockUnaggregatedEncoderMockRecorder) Len ¶
func (mr *MockUnaggregatedEncoderMockRecorder) Len() *gomock.Call
Len indicates an expected call of Len
func (*MockUnaggregatedEncoderMockRecorder) Relinquish ¶
func (mr *MockUnaggregatedEncoderMockRecorder) Relinquish() *gomock.Call
Relinquish indicates an expected call of Relinquish
func (*MockUnaggregatedEncoderMockRecorder) Reset ¶
func (mr *MockUnaggregatedEncoderMockRecorder) Reset(arg0 interface{}) *gomock.Call
Reset indicates an expected call of Reset
func (*MockUnaggregatedEncoderMockRecorder) Truncate ¶
func (mr *MockUnaggregatedEncoderMockRecorder) Truncate(arg0 interface{}) *gomock.Call
Truncate indicates an expected call of Truncate
type PoolReleaseFn ¶ added in v1.0.1
type PoolReleaseFn func([]byte)
PoolReleaseFn is a function used to release underlying slice back to bytes pool.
type UnaggregatedEncoder ¶
type UnaggregatedEncoder interface { // Len returns the number of bytes accumulated in the encoder so far. Len() int // Reset resets the encoder buffer with optional initial data. Reset(initData []byte) // Truncate discards all but the first n encoded bytes but continues to use // the same allocated storage. If n is negative or greater than the length of // encoded buffer, an error is returned. Truncate(n int) error // EncodeMessage encodes an unaggregated message. EncodeMessage(msg encoding.UnaggregatedMessageUnion) error // Relinquish relinquishes ownership of the encoded byte stream to the caller, // and resets the internal encoding buffer. Relinquish() Buffer }
UnaggregatedEncoder encodes unaggregated metrics.
func NewUnaggregatedEncoder ¶
func NewUnaggregatedEncoder(opts UnaggregatedOptions) UnaggregatedEncoder
NewUnaggregatedEncoder creates a new unaggregated encoder.
type UnaggregatedIterator ¶
type UnaggregatedIterator interface { // Next returns true if there are more items to decode. Next() bool // Current returns the current decoded value. Current() encoding.UnaggregatedMessageUnion // Err returns the error encountered during decoding, if any. Err() error // Close closes the iterator. Close() }
UnaggregatedIterator decodes unaggregated metrics.
func NewUnaggregatedIterator ¶
func NewUnaggregatedIterator( reader encoding.ByteReadScanner, opts UnaggregatedOptions, ) UnaggregatedIterator
NewUnaggregatedIterator creates a new unaggregated iterator.
type UnaggregatedOptions ¶
type UnaggregatedOptions interface { // SetBytesPool sets the bytes pool. SetBytesPool(value pool.BytesPool) UnaggregatedOptions // BytesPool returns the bytes pool. BytesPool() pool.BytesPool // SetInitBufferSize sets the initial buffer size. SetInitBufferSize(value int) UnaggregatedOptions // InitBufferSize returns the initial buffer size. InitBufferSize() int // SetMaxMessageSize sets the maximum message size. SetMaxMessageSize(value int) UnaggregatedOptions // MaxMessageSize returns the maximum message size. MaxMessageSize() int }
UnaggregatedOptions provide a set of options for the unaggregated encoder and iterator.
func NewUnaggregatedOptions ¶
func NewUnaggregatedOptions() UnaggregatedOptions
NewUnaggregatedOptions create a new set of unaggregated options.