serialize

package
v0.0.0-...-ad73f87 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: MIT Imports: 7 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MongoPointAddFields

func MongoPointAddFields(builder *flatbuffers.Builder, fields flatbuffers.UOffsetT)

func MongoPointAddMeasurementName

func MongoPointAddMeasurementName(builder *flatbuffers.Builder, measurementName flatbuffers.UOffsetT)

func MongoPointAddTags

func MongoPointAddTags(builder *flatbuffers.Builder, tags flatbuffers.UOffsetT)

func MongoPointAddTimestamp

func MongoPointAddTimestamp(builder *flatbuffers.Builder, timestamp int64)

func MongoPointEnd

func MongoPointEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT

func MongoPointStart

func MongoPointStart(builder *flatbuffers.Builder)

func MongoPointStartFieldsVector

func MongoPointStartFieldsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT

func MongoPointStartTagsVector

func MongoPointStartTagsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT

func MongoReadingAddKey

func MongoReadingAddKey(builder *flatbuffers.Builder, key flatbuffers.UOffsetT)

func MongoReadingAddValue

func MongoReadingAddValue(builder *flatbuffers.Builder, value float64)

func MongoReadingEnd

func MongoReadingEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT

func MongoReadingStart

func MongoReadingStart(builder *flatbuffers.Builder)

func MongoTagAddKey

func MongoTagAddKey(builder *flatbuffers.Builder, key flatbuffers.UOffsetT)

func MongoTagAddValue

func MongoTagAddValue(builder *flatbuffers.Builder, value flatbuffers.UOffsetT)

func MongoTagEnd

func MongoTagEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT

func MongoTagStart

func MongoTagStart(builder *flatbuffers.Builder)

Types

type CassandraSerializer

type CassandraSerializer struct{}

CassandraSerializer writes a Point in a serialized form for Cassandra

func (*CassandraSerializer) Serialize

func (s *CassandraSerializer) Serialize(p *Point, w io.Writer) (err error)

Serialize writes Point data to the given writer, conforming to the Cassandra format.

This function writes output that looks like: series_double,cpu,hostname=host_0,region=eu-west-1,datacenter=eu-west-1b,rack=67,os=Ubuntu16.10,arch=x86,team=NYC,service=7,service_version=0,service_environment=production,usage_guest_nice,2016-01-01,1451606400000000000,38.2431182911542820

Which the loader will decode into a statement that looks like this: INSERT INTO series_double(series_id,timestamp_ns,value) VALUES('cpu,hostname=host_0,region=eu-west-1,datacenter=eu-west-1b,rack=67,os=Ubuntu16.10,arch=x86,team=NYC,service=7,service_version=0,service_environment=production#usage_guest_nice#2016-01-01', 1451606400000000000, 38.2431182911542820)

type InfluxSerializer

type InfluxSerializer struct{}

InfluxSerializer writes a Point in a serialized form for MongoDB

func (*InfluxSerializer) Serialize

func (s *InfluxSerializer) Serialize(p *Point, w io.Writer) (err error)

Serialize writes Point data to the given writer, conforming to the InfluxDB wire protocol.

This function writes output that looks like: <measurement>,<tag key>=<tag value> <field name>=<field value> <timestamp>\n

For example: foo,tag0=bar baz=-1.0 100\n

type MongoPoint

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

func GetRootAsMongoPoint

func GetRootAsMongoPoint(buf []byte, offset flatbuffers.UOffsetT) *MongoPoint

func (*MongoPoint) Fields

func (rcv *MongoPoint) Fields(obj *MongoReading, j int) bool

func (*MongoPoint) FieldsLength

func (rcv *MongoPoint) FieldsLength() int

func (*MongoPoint) Init

func (rcv *MongoPoint) Init(buf []byte, i flatbuffers.UOffsetT)

func (*MongoPoint) MeasurementName

func (rcv *MongoPoint) MeasurementName() []byte

func (*MongoPoint) MutateTimestamp

func (rcv *MongoPoint) MutateTimestamp(n int64) bool

func (*MongoPoint) Table

func (rcv *MongoPoint) Table() flatbuffers.Table

func (*MongoPoint) Tags

func (rcv *MongoPoint) Tags(obj *MongoTag, j int) bool

func (*MongoPoint) TagsLength

func (rcv *MongoPoint) TagsLength() int

func (*MongoPoint) Timestamp

func (rcv *MongoPoint) Timestamp() int64

type MongoReading

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

func GetRootAsMongoReading

func GetRootAsMongoReading(buf []byte, offset flatbuffers.UOffsetT) *MongoReading

func (*MongoReading) Init

func (rcv *MongoReading) Init(buf []byte, i flatbuffers.UOffsetT)

func (*MongoReading) Key

func (rcv *MongoReading) Key() []byte

func (*MongoReading) MutateValue

func (rcv *MongoReading) MutateValue(n float64) bool

func (*MongoReading) Table

func (rcv *MongoReading) Table() flatbuffers.Table

func (*MongoReading) Value

func (rcv *MongoReading) Value() float64

type MongoSerializer

type MongoSerializer struct{}

MongoSerializer writes a Point in a serialized form for MongoDB

func (*MongoSerializer) Serialize

func (s *MongoSerializer) Serialize(p *Point, w io.Writer) (err error)

Serialize writes Point data to the given Writer, using basic gob encoding

type MongoTag

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

func GetRootAsMongoTag

func GetRootAsMongoTag(buf []byte, offset flatbuffers.UOffsetT) *MongoTag

func (*MongoTag) Init

func (rcv *MongoTag) Init(buf []byte, i flatbuffers.UOffsetT)

func (*MongoTag) Key

func (rcv *MongoTag) Key() []byte

func (*MongoTag) Table

func (rcv *MongoTag) Table() flatbuffers.Table

func (*MongoTag) Value

func (rcv *MongoTag) Value() []byte

type Point

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

Point wraps a single data point. It stores database-agnostic data representing one point in time of one measurement.

Internally, Point uses byte slices instead of strings to try to minimize overhead.

func NewPoint

func NewPoint() *Point

NewPoint returns a new empty Point

func (*Point) AppendField

func (p *Point) AppendField(key []byte, value interface{})

AppendField adds a field with a given key and value to this data point

func (*Point) AppendTag

func (p *Point) AppendTag(key, value []byte)

AppendTag adds a tag with a given key and value to this data point

func (*Point) FieldKeys

func (p *Point) FieldKeys() [][]byte

FieldKeys returns the Point's field keys

func (*Point) MeasurementName

func (p *Point) MeasurementName() []byte

MeasurementName returns the name of the Point's measurement

func (*Point) Reset

func (p *Point) Reset()

Reset clears all information from this Point so it can be reused.

func (*Point) SetMeasurementName

func (p *Point) SetMeasurementName(s []byte)

SetMeasurementName sets the name of the measurement for this data point

func (*Point) SetTimestamp

func (p *Point) SetTimestamp(t *time.Time)

SetTimestamp sets the Timestamp for this data point

type PointSerializer

type PointSerializer interface {
	Serialize(p *Point, w io.Writer) error
}

PointSerializer serializes a Point for writing

type TimescaleDBSerializer

type TimescaleDBSerializer struct{}

TimescaleDBSerializer writes a Point in a serialized form for TimescaleDB

func (*TimescaleDBSerializer) Serialize

func (s *TimescaleDBSerializer) Serialize(p *Point, w io.Writer) error

Serialize writes Point p to the given Writer w, so it can be loaded by the TimescaleDB loader. The format is CSV with two lines per Point, with the first row being the tags and the second row being the field values.

e.g., tags,<tag1>,<tag2>,<tag3>,... <measurement>,<timestamp>,<field1>,<field2>,<field3>,...

Jump to

Keyboard shortcuts

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