dptest

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DP

func DP() *datapoint.Datapoint

DP generates and returns a unique datapoint to use for testing purposes

func E added in v0.7.0

func E() *event.Event

E generates and returns a unique event to use for testing purposes

Types

type BasicSink

type BasicSink struct {
	RetErr     error
	PointsChan chan []*datapoint.Datapoint
	EventsChan chan []*event.Event
	// contains filtered or unexported fields
}

BasicSink is a pure testing sink that blocks forwarded points onto a channel

func NewBasicSink

func NewBasicSink() *BasicSink

NewBasicSink creates a BasicSink with an unbuffered chan. Note, calls to AddDatapoints will then block until you drain the PointsChan.

func (*BasicSink) AddDatapoints

func (f *BasicSink) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint) error

AddDatapoints buffers the point on an internal chan or returns errors if RetErr is set

func (*BasicSink) AddEvents added in v0.7.0

func (f *BasicSink) AddEvents(ctx context.Context, points []*event.Event) error

AddEvents buffers the event on an internal chan or returns errors if RetErr is set

func (*BasicSink) Next

func (f *BasicSink) Next() *datapoint.Datapoint

Next returns a single datapoint from the top of PointsChan and panics if the top doesn't contain only one point

func (*BasicSink) NextEvent added in v0.7.0

func (f *BasicSink) NextEvent() *event.Event

NextEvent returns a single event from the top of EventsChan and panics if the top doesn't contain only one event

func (*BasicSink) Resize

func (f *BasicSink) Resize(size int)

Resize the internal chan of points sent here

func (*BasicSink) RetError

func (f *BasicSink) RetError(err error)

RetError sets an error that is returned on AddDatapoints calls

type DatapointSource

type DatapointSource struct {
	CurrentIndex int64
	Metric       string
	Dims         map[string]string
	Dptype       datapoint.MetricType
	TimeSource   func() time.Time
	// contains filtered or unexported fields
}

DatapointSource is a simple way to generate throw away datapoints

func (*DatapointSource) Next

func (d *DatapointSource) Next() *datapoint.Datapoint

Next returns a unique datapoint

type EventSource added in v0.7.0

type EventSource struct {
	CurrentIndex int64
	EventType    string
	Dims         map[string]string
	Meta         map[string]interface{}
	TimeSource   func() time.Time
	// contains filtered or unexported fields
}

EventSource is a simple way to generate throw away events

func (*EventSource) Next added in v0.7.0

func (d *EventSource) Next() *event.Event

Next returns a unique event

Jump to

Keyboard shortcuts

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