models

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2015 License: MIT Imports: 7 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   map[string]string `json:"tags,omitempty"`
	Points []BatchPoint      `json:"points,omitempty"`
}

func ResultToBatches

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

func (Batch) PointDimensions

func (b Batch) PointDimensions() []string

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

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 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 []string

	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) PointDimensions

func (p Point) PointDimensions() []string

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

type PointInterface

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

Common interface for both Point and Batch objects

type Tags

type Tags map[string]string

Jump to

Keyboard shortcuts

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