msg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: AGPL-3.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMsg

func CreateMsg(metrics []*schema.MetricData, id int64, version Format) ([]byte, error)

CreateMsg is the legacy function to create messages. It's not very fast

func ReadPointMsg

func ReadPointMsg(data []byte, defaultOrg uint32) ([]byte, schema.MetricPoint, error)

func WritePointMsg

func WritePointMsg(point schema.MetricPoint, buf []byte, version Format) (o []byte, err error)

WritePointMsg is like CreateMsg, except optimized for MetricPoint and buffer re-use. caller must assure a cap-len diff of at least: 33B (for FormatMetricPoint) 29B (for FormatMetricPointWithoutOrg) no other formats supported.

Types

type Format

type Format uint8
const (
	FormatMetricDataArrayJson Format = iota
	FormatMetricDataArrayMsgp
	FormatMetricPoint
	FormatMetricPointWithoutOrg
)

identifier of message format

func IsPointMsg

func IsPointMsg(data []byte) (Format, bool)

func (Format) String

func (i Format) String() string

type MetricData

type MetricData struct {
	Id       int64
	Metrics  []*schema.MetricData
	Produced time.Time
	Format   Format
	Msg      []byte
}

func (*MetricData) DecodeMetricData

func (m *MetricData) DecodeMetricData() error

sets m.Metrics to a []*schema.MetricData any subsequent call may however put different MetricData into our m.Metrics array

func (*MetricData) InitFromMsg

func (m *MetricData) InitFromMsg(msg []byte) error

parses format and id (cheap), but doesn't decode metrics (expensive) just yet.

Jump to

Keyboard shortcuts

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