Documentation
¶
Index ¶
- Constants
- Variables
- type Codec
- func (c *Codec) Close() error
- func (c *Codec) Decode(head Head, body []byte) (*Iterator, error)
- func (c *Codec) DecodeValues(first float64, count int, stream []byte) (*Iterator, error)
- func (c *Codec) Encode(samples []Sample) (Head, []byte, error)
- func (c *Codec) EncodeValues(values []float64) ([]byte, error)
- type Head
- type Iterator
- type Sample
Constants ¶
const (
MaxSamples = 240
)
Variables ¶
var ErrInvalid = errors.New("invalid metric payload")
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec owns one bounded encoder and decoder; returned iterators own their buffers.
func (*Codec) Decode ¶
Decode copies the bounded body; iteration needs neither a lock nor an open Codec.
func (*Codec) DecodeValues ¶
DecodeValues reads what EncodeValues wrote, given the first value and the count, which the stream does not repeat. It carries no checksum of its own, so the caller checks the bytes it stored; each Sample's At is its index.
func (*Codec) Encode ¶
Encode requires strictly increasing timestamps and preserves every float64 bit.
func (*Codec) EncodeValues ¶
EncodeValues packs values alone, for a caller that keeps the timestamps and the first value itself. It returns Encode's stream for evenly spaced samples, which write no timestamps, behind the byte that says how it was packed:
Encode 1 | flags | 0 0 | stream | checksum EncodeValues flags | stream
type Head ¶
Head is what the row around a body already holds. Encode returns it, the caller stores it, and Decode is given it back; nothing in the body repeats it.