Documentation
¶
Index ¶
- type DataRecorder
- type InterTimer
- type RecordJob
- type SimpleRecorder
- func (s *SimpleRecorder) Error() error
- func (s *SimpleRecorder) IndexName() string
- func (s *SimpleRecorder) Interval() time.Duration
- func (s *SimpleRecorder) Name() string
- func (s *SimpleRecorder) PayloadChan() chan *RecordJob
- func (s *SimpleRecorder) Start(ctx context.Context) chan struct{}
- func (s *SimpleRecorder) Timeout() time.Duration
- func (s *SimpleRecorder) TypeName() string
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
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
Click to show internal directories.
Click to hide internal directories.