models

package
v0.12.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Provides a set of structures for passing data around Kapacitor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchToRow

func BatchToRow(b Batch) (row *models.Row)

func PointToRow

func PointToRow(p Point) (row *models.Row)

func SortedFields

func SortedFields(fields Fields) []string

func SortedKeys

func SortedKeys(tags map[string]string) []string

Types

type Batch

type Batch struct {
	Name   string       `json:"name,omitempty"`
	Group  GroupID      `json:"-"`
	TMax   time.Time    `json:"-"`
	Tags   Tags         `json:"tags,omitempty"`
	Points []BatchPoint `json:"points,omitempty"`
}

func ResultToBatches

func ResultToBatches(res client.Result) ([]Batch, error)

func (Batch) Copy added in v0.11.0

func (b Batch) Copy() PointInterface

func (Batch) PointDimensions

func (b Batch) PointDimensions() Dimensions

func (Batch) PointFields

func (b Batch) PointFields() Fields

func (Batch) PointGroup

func (b Batch) PointGroup() GroupID

func (Batch) PointName

func (b Batch) PointName() string

func (Batch) PointTags

func (b Batch) PointTags() Tags

func (Batch) PointTime

func (b Batch) PointTime() time.Time

func (*Batch) SetNewDimTag added in v0.11.0

func (b *Batch) SetNewDimTag(key string, value string)

func (Batch) Setter added in v0.11.0

func (b Batch) Setter() PointSetter

func (*Batch) UpdateGroup added in v0.11.0

func (b *Batch) UpdateGroup()

type BatchPoint

type BatchPoint struct {
	Time   time.Time `json:"time"`
	Fields Fields    `json:"fields"`
	Tags   Tags      `json:"tags"`
}

A point in batch, similar to Point but most information is found on the containing Batch.

Tags on a BatchPoint are a superset of the tags on the Batch All points in a batch should have the same tag and field keys.

func BatchPointFromPoint

func BatchPointFromPoint(p Point) BatchPoint

type Dimensions added in v0.11.0

type Dimensions []string

func (Dimensions) Copy added in v0.11.0

func (d Dimensions) Copy() Dimensions

type Fields

type Fields map[string]interface{}

func (Fields) Copy

func (f Fields) Copy() Fields

type GroupID

type GroupID string
const (
	NilGroup GroupID = ""
)

func TagsToGroupID

func TagsToGroupID(dims []string, tags map[string]string) GroupID

type Point

type Point struct {
	Name            string
	Database        string
	RetentionPolicy string

	Group      GroupID
	Dimensions Dimensions

	Tags Tags

	Fields Fields

	Time time.Time
}

Represents a single data point

func (Point) Bytes

func (p Point) Bytes(precision string) []byte

Returns byte array of a line protocol representation of the point

func (Point) Copy added in v0.11.0

func (p Point) Copy() PointInterface

func (Point) PointDimensions

func (p Point) PointDimensions() Dimensions

func (Point) PointFields

func (p Point) PointFields() Fields

func (Point) PointGroup

func (p Point) PointGroup() GroupID

func (Point) PointName

func (p Point) PointName() string

func (Point) PointTags

func (p Point) PointTags() Tags

func (Point) PointTime

func (p Point) PointTime() time.Time

func (*Point) SetNewDimTag added in v0.11.0

func (p *Point) SetNewDimTag(key string, value string)

func (Point) Setter added in v0.11.0

func (p Point) Setter() PointSetter

func (*Point) UpdateGroup added in v0.11.0

func (p *Point) UpdateGroup()

type PointInterface

type PointInterface interface {
	PointName() string
	PointTime() time.Time
	PointGroup() GroupID
	PointTags() Tags
	PointDimensions() Dimensions
	PointFields() Fields

	// Return a copy of self
	Copy() PointInterface
	Setter() PointSetter
}

Common interface for both Point and Batch objects

type PointSetter added in v0.11.0

type PointSetter interface {
	PointInterface
	SetNewDimTag(key string, value string)
	UpdateGroup()
}

type Tags

type Tags map[string]string

func (Tags) Copy added in v0.11.0

func (t Tags) Copy() Tags

Jump to

Keyboard shortcuts

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