2015-08-11 20:02:04 +00:00
|
|
|
package outputs
|
|
|
|
|
|
|
|
import (
|
2015-10-16 22:13:32 +00:00
|
|
|
"github.com/influxdb/influxdb/client/v2"
|
2015-08-11 20:02:04 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Output interface {
|
2015-10-22 16:17:57 +00:00
|
|
|
// Connect to the Output
|
2015-08-11 20:02:04 +00:00
|
|
|
Connect() error
|
2015-10-22 16:17:57 +00:00
|
|
|
// Close any connections to the Output
|
2015-08-12 17:04:25 +00:00
|
|
|
Close() error
|
2015-10-22 16:17:57 +00:00
|
|
|
// Description returns a one-sentence description on the Output
|
2015-08-25 23:59:12 +00:00
|
|
|
Description() string
|
2015-10-22 16:17:57 +00:00
|
|
|
// SampleConfig returns the default configuration of the Output
|
2015-08-25 23:59:12 +00:00
|
|
|
SampleConfig() string
|
2015-10-22 16:17:57 +00:00
|
|
|
// Write takes in group of points to be written to the Output
|
2015-10-16 22:13:32 +00:00
|
|
|
Write(points []*client.Point) error
|
2015-08-11 20:02:04 +00:00
|
|
|
}
|
|
|
|
|
2015-10-22 16:17:57 +00:00
|
|
|
type ServiceOutput interface {
|
|
|
|
// Connect to the Output
|
|
|
|
Connect() error
|
|
|
|
// Close any connections to the Output
|
|
|
|
Close() error
|
|
|
|
// Description returns a one-sentence description on the Output
|
|
|
|
Description() string
|
|
|
|
// SampleConfig returns the default configuration of the Output
|
|
|
|
SampleConfig() string
|
|
|
|
// Write takes in group of points to be written to the Output
|
|
|
|
Write(points []*client.Point) error
|
|
|
|
// Start the "service" that will provide an Output
|
|
|
|
Start() error
|
|
|
|
// Stop the "service" that will provide an Output
|
|
|
|
Stop()
|
|
|
|
}
|
|
|
|
|
2015-08-11 20:02:04 +00:00
|
|
|
type Creator func() Output
|
|
|
|
|
|
|
|
var Outputs = map[string]Creator{}
|
|
|
|
|
|
|
|
func Add(name string, creator Creator) {
|
|
|
|
Outputs[name] = creator
|
|
|
|
}
|