recorder

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataRecorder

type DataRecorder interface {
	InterTimer

	// Recorder should not block when RecordJob is sent to this channel.
	PayloadChan() chan *RecordJob

	// The recorder's loop should be inside a goroutine, and return a done channel.
	// The done channel should be closed one it's work is finished and wants to quit.
	// When the context is timedout or canceled, the recorder should return.
	Start(ctx context.Context) chan struct{}

	// Name should return the representation string for this recorder. Choose a very simple name.
	Name() string

	// IndexName comes from the configuration, but the engine takes over.
	// Recorders should not intercept the engine for its decision, unless they have a
	// valid reason.
	IndexName() string

	// TypeName is usually the application name.
	// Recorders should not intercept the engine for its decision, unless they have a
	// valid reason.
	TypeName() string
}

DataRecorder in an interface for shipping data to a repository. The repository should have the concept of index/database and type/table abstractions. See ElasticSearch for more information. Recorder should send nil to Err channel of the RecordJob object if no error occurs.

type InterTimer added in v0.1.1

type InterTimer interface {
	Timeout() time.Duration
	Interval() time.Duration
}

InterTimer is required by the Engine so it can read the intervals and timeouts.

type RecordJob

type RecordJob struct {
	Ctx       context.Context
	Payload   datatype.DataContainer
	IndexName string
	TypeName  string
	Time      time.Time // Is used for timeseries data
	Err       chan error
}

RecordJob is sent with a context and a payload to be recorded. If the TypeName and IndexName are different than the previous one, the recorder should use the ones engine provides

type SimpleRecorder added in v0.1.1

type SimpleRecorder struct {
	PayloadChanFunc func() chan *RecordJob
	ErrorFunc       func() error
	StartFunc       func() chan struct{}
	// contains filtered or unexported fields
}
Example
Output:

func NewSimpleRecorder added in v0.1.1

func NewSimpleRecorder(ctx context.Context, logger logrus.FieldLogger, name, endpoint, indexName, typeName string, interval, timeout time.Duration) (*SimpleRecorder, error)

func (*SimpleRecorder) Error added in v0.1.1

func (s *SimpleRecorder) Error() error

func (*SimpleRecorder) IndexName added in v0.1.1

func (s *SimpleRecorder) IndexName() string

func (*SimpleRecorder) Interval added in v0.1.1

func (s *SimpleRecorder) Interval() time.Duration

func (*SimpleRecorder) Name added in v0.1.1

func (s *SimpleRecorder) Name() string

func (*SimpleRecorder) PayloadChan added in v0.1.1

func (s *SimpleRecorder) PayloadChan() chan *RecordJob

func (*SimpleRecorder) Start added in v0.1.1

func (s *SimpleRecorder) Start(ctx context.Context) chan struct{}

func (*SimpleRecorder) Timeout added in v0.1.1

func (s *SimpleRecorder) Timeout() time.Duration

func (*SimpleRecorder) TypeName added in v0.1.1

func (s *SimpleRecorder) TypeName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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