influx

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0, Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Field_Type_Unknown = 0
	Field_Type_Int     = 1
	Field_Type_UInt    = 2
	Field_Type_Float   = 3
	Field_Type_String  = 4
	Field_Type_Boolean = 5
	Field_Type_Tag     = 6
	Field_Type_Last    = 7
)
View Source
const (
	INDEXCOUNT = 1
)
View Source
const (
	MessageVersion = 1
)

Variables

View Source
var (
	// ErrPointMustHaveAField is returned when operating on a point that does not have any fields.
	ErrPointMustHaveAField   = errno.NewError(errno.WritePointMustHaveAField)
	ErrPointInvalidTimeField = errno.NewError(errno.WritePointInvalidTimeField)
	// ErrInvalidPoint is returned when a point cannot be parsed correctly.
	ErrInvalidPoint               = errno.NewError(errno.WriteInvalidPoint)
	ErrPointMustHaveAMeasurement  = errno.NewError(errno.WritePointMustHaveAMeasurement)
	ErrPointShouldHaveAllShardKey = errno.NewError(errno.WritePointShouldHaveAllShardKey)
)
View Source
var (
	NoTimestamp = int64(-100)
	ByteSplit   = byte(0)
	StringSplit = string(ByteSplit)
)
View Source
var FieldTypeName = map[int]string{
	Field_Type_Unknown: "Unknown",
	Field_Type_Int:     "Integer",
	Field_Type_UInt:    "Unsigned",
	Field_Type_Float:   "Float",
	Field_Type_String:  "String",
	Field_Type_Boolean: "Boolean",
	Field_Type_Tag:     "Tag",
	Field_Type_Last:    "Unknown",
}

Functions

func FastMarshalMultiRows

func FastMarshalMultiRows(src []byte, rows []Row) ([]byte, error)

func FastUnmarshalMultiRows

func FastUnmarshalMultiRows(src []byte, rows []Row, tagPool []Tag, fieldPool []Field, indexOptionPool []IndexOption,
	indexKeyPool []byte) ([]Row, []Tag, []Field, []IndexOption, []byte, error)

func FieldType2Val

func FieldType2Val(fieldType int) (interface{}, error)

func FieldTypeString

func FieldTypeString(fieldType int32) string

func GetBytesBuffer

func GetBytesBuffer() []byte

func GetNameWithVersion

func GetNameWithVersion(name string, version uint32) string

func GetOriginMstName

func GetOriginMstName(nameWithVer string) string

func GetStreamContext

func GetStreamContext(r io.Reader) *streamContext

func GetUnmarshalWork

func GetUnmarshalWork() *unmarshalWork

func IsValidNumber

func IsValidNumber(s string) bool

func MakeGroupTagsKey

func MakeGroupTagsKey(dims []string, tags PointTags, dst []byte) []byte

MakeGroupTagsKey converts a tag set to bytes for use as a lookup key.

func MakeIndexKey

func MakeIndexKey(name string, tags PointTags, dst []byte) []byte

func MeasurementName

func MeasurementName(src []byte) ([]byte, []byte, error)

MeasurementName extract measurement from series key, return measurement_name_with_version, tail, error

func Parse2SeriesKey

func Parse2SeriesKey(key []byte, dst []byte, splittWithNull bool) []byte

Parse2SeriesKey parse encoded index key to line protocol series key encoded index key format: [total len][ms len][ms][tagk1 len][tagk1 val]...] parse to line protocol format: mst_0001,tagkey1=tagv1,tagk2=tagv2...

func PutBytesBuffer

func PutBytesBuffer(buf []byte)

func PutStreamContext

func PutStreamContext(ctx *streamContext)

func ReadLinesBlockExt

func ReadLinesBlockExt(r io.Reader, dstBuf, tailBuf []byte, maxLineLen, blockSize int) ([]byte, []byte, error)

func ScheduleUnmarshalWork

func ScheduleUnmarshalWork(uw UnmarshalWork)

ScheduleUnmarshalWork schedules uw to run in the worker pool.

It is expected that StartUnmarshalWorkers is already called.

func StartUnmarshalWorkers

func StartUnmarshalWorkers()

StartUnmarshalWorkers starts unmarshal workers.

func StopUnmarshalWorkers

func StopUnmarshalWorkers()

StopUnmarshalWorkers stops unmarshal workers.

No more calles to ScheduleUnmarshalWork are allowed after callsing stopUnmarshalWorkers

Types

type CharType

type CharType int
const (
	CharNumber CharType = iota
	CharExp
	CharPoint
	CharSign
	CharIllegal
)

type Field

type Field struct {
	Key      string
	NumValue float64
	StrValue string
	Type     int32
}

Field represents influx field.

func (*Field) Reset

func (f *Field) Reset()

type Fields

type Fields []Field

func (*Fields) Len

func (fs *Fields) Len() int

func (*Fields) Less

func (fs *Fields) Less(i, j int) bool

func (*Fields) Reset

func (fs *Fields) Reset()

func (*Fields) Swap

func (fs *Fields) Swap(i, j int)

type IndexOption

type IndexOption struct {
	IndexList []uint16
	Oid       uint32
}

func (*IndexOption) Reset

func (opt *IndexOption) Reset()

type IndexOptions

type IndexOptions []IndexOption

func (*IndexOptions) Len

func (opts *IndexOptions) Len() int

func (*IndexOptions) Less

func (opts *IndexOptions) Less(i, j int) bool

func (*IndexOptions) Reset

func (opts *IndexOptions) Reset()

func (*IndexOptions) Swap

func (opts *IndexOptions) Swap(i, j int)

type PointRows

type PointRows struct {
	Rows []Row
	// contains filtered or unexported fields
}

Rows contains parsed influx rows.

func (*PointRows) Reset

func (rs *PointRows) Reset()

Reset resets rs.

func (*PointRows) Unmarshal

func (rs *PointRows) Unmarshal(s string, enableTagArray bool) error

Unmarshal unmarshals influx line protocol rows from s.

See https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/

s shouldn't be modified when rs is in use.

type PointTags

type PointTags []Tag

func IndexKeyToTags

func IndexKeyToTags(src []byte, isCopy bool, dst *PointTags) (*PointTags, error)

func Parse2SeriesGroupKey

func Parse2SeriesGroupKey(src []byte, dst []byte, dims []string) (PointTags, []byte, int, bool, error)

Parse2SeriesGroupKey support reuse same memory space for src with dst, can reduce half memory space compared with Parse2SeriesKey

func (*PointTags) FindPointTag

func (pts *PointTags) FindPointTag(tagName string) *Tag

func (*PointTags) Len

func (pts *PointTags) Len() int

func (*PointTags) Less

func (pts *PointTags) Less(i, j int) bool

func (*PointTags) Reset

func (pts *PointTags) Reset()

func (*PointTags) Swap

func (pts *PointTags) Swap(i, j int)

func (*PointTags) TagsSize

func (pts *PointTags) TagsSize() int

type Row

type Row struct {
	// if streamOnly is false, it means that the source table data of the stream will also be written,
	// otherwise the source table data of the stream will not be written
	StreamOnly              bool
	Timestamp               int64
	SeriesId                uint64
	PrimaryId               uint64
	Name                    string // measurement name with version
	Tags                    PointTags
	Fields                  Fields
	IndexKey                []byte
	ShardKey                []byte
	StreamId                []uint64 // it used to indicate that the data is shared by multiple streams
	IndexOptions            IndexOptions
	ColumnToIndex           map[string]int // it indicates the sorted tagKey, fieldKey and index mapping relationship
	ReadyBuildColumnToIndex bool
}

Row is a single influx row.

func (*Row) CheckDuplicateTag

func (r *Row) CheckDuplicateTag(idx int) error

func (*Row) CheckValid

func (r *Row) CheckValid() error

func (*Row) Clone

func (r *Row) Clone(rr *Row)

func (*Row) Copy

func (r *Row) Copy(p *Row)

func (*Row) FastMarshalBinary

func (r *Row) FastMarshalBinary(dst []byte) ([]byte, error)

func (*Row) FastUnmarshalBinary

func (r *Row) FastUnmarshalBinary(src []byte, tagpool []Tag, fieldpool []Field, indexOptionPool []IndexOption, indexKeypool []byte) ([]byte, []Tag, []Field, []IndexOption, []byte, error)

func (*Row) ReFill

func (r *Row) ReFill()

func (*Row) Reset

func (r *Row) Reset()

func (*Row) ReuseSet

func (r *Row) ReuseSet()

ReuseSet Reuse Field and Tag, compare with Reset

func (*Row) TagsSize

func (r *Row) TagsSize() int

func (*Row) UnmarshalIndexKeys

func (r *Row) UnmarshalIndexKeys(indexkeypool []byte) []byte

func (*Row) UnmarshalShardKeyByDimOrTag

func (r *Row) UnmarshalShardKeyByDimOrTag(tags []string, dims []string) error

func (*Row) UnmarshalShardKeyByField

func (r *Row) UnmarshalShardKeyByField(shardKeys []string) error

func (*Row) UnmarshalShardKeyByTag

func (r *Row) UnmarshalShardKeyByTag(tags []string) error

func (*Row) UnmarshalShardKeyByTagOp

func (r *Row) UnmarshalShardKeyByTagOp(tags []string) error

type Rows

type Rows []Row

func (*Rows) Len

func (rs *Rows) Len() int

func (*Rows) Less

func (rs *Rows) Less(i, j int) bool

func (*Rows) Reset

func (rs *Rows) Reset()

func (*Rows) Swap

func (rs *Rows) Swap(i, j int)

type State

type State int
const (
	StateNone State = iota
	StateInitial
	StateIntSign
	StateInteger
	StatePoint
	StatePointWithoutInt
	StateFraction
	StateExp
	StateExpSign
	StateExpNumber
	StateEnd
)

type Tag

type Tag struct {
	Key     string
	Value   string
	IsArray bool
}

PointTag represents influx tag.

func (*Tag) Reset

func (tag *Tag) Reset()

func (*Tag) Size

func (tag *Tag) Size() int

type UnmarshalWork

type UnmarshalWork interface {
	// Unmarshal must implement CPU-bound unmarshal work.
	Unmarshal()
}

UnmarshalWork is a unit of unmarshal work.

type WritePointsIn

type WritePointsIn struct {
	Prs []Row
}

Jump to

Keyboard shortcuts

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