msg

package
v1.2.0-arch32 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: AGPL-3.0, Apache-2.0 Imports: 9 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 IsIndexControlMsg

func IsIndexControlMsg(data []byte) bool

func ReadIndexControlMsg

func ReadIndexControlMsg(data []byte) (schema.ControlMsg, error)

func ReadPointMsg

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

func ReadPointMsgFormat

func ReadPointMsgFormat(data []byte, defaultOrg uint32, version Format) ([]byte, schema.MetricPoint, error)

func WriteIndexControlMsg

func WriteIndexControlMsg(cm *schema.ControlMsg) ([]byte, 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.

func WritePointMsgArray

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

WritePointMsgArray is like CreateMsg, except optimized for MetricPoint and buffer re-use. caller must assure a cap-len diff of exactly: 2 + 32B * len(points) (for FormatMetricPoint) 2 + 28B * len(points) (for FormatMetricPointWithoutOrg) no other formats supported.

Types

type Format

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

identifier of message format NOTE: None of these constants should be changed as external tasks may be using the absolute values.

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.

type MetricPointIter

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

func NewMetricPointIter

func NewMetricPointIter(data []byte, defaultOrg uint32) MetricPointIter

func (*MetricPointIter) Err

func (m *MetricPointIter) Err() error

func (*MetricPointIter) Format

func (m *MetricPointIter) Format() Format

func (*MetricPointIter) Next

func (m *MetricPointIter) Next() bool

func (*MetricPointIter) Value

func (m *MetricPointIter) Value() schema.MetricPoint

Jump to

Keyboard shortcuts

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