Documentation
¶
Overview ¶
Package config reads the configurations from a yaml file and produces necessary configuration for instantiating readers and recorders. TODO: Add TLS to the endpoints.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // EmptyConfigErr is an error when the config file is empty EmptyConfigErr = &StructureErr{"", "empty configuration file", nil} )
Functions ¶
This section is empty.
Types ¶
type Conf ¶
type Conf interface { Endpoint() string Timeout() time.Duration // Backoff returns the amount of retries after the endpoint is rejected // the request or not responsive. Backoff() int Logger() logrus.FieldLogger }
Conf will return necessary information for setting up an endpoint, for readers or recorders.
type ConfMap ¶
type ConfMap struct { // Readers contains a map of reader names to their configuration. Readers map[string]ReaderConf // Recorders contains a map of recorder names to their configuration. Recorders map[string]RecorderConf // Routes contains a map of recorder names to a list of readers. // map["rec1"][]string{"red1", "red2"}: means whatever is read from red1 and red2, will be shipped to rec1. Routes map[string][]string }
ConfMap holds the relation between readers and recorders.
type ReaderConf ¶
type ReaderConf interface { Conf // Interval used to signal the reader when to do their job. Interval() time.Duration // NewInstance should return an initialised Reader instance. // You should return an error if the endpoint is not responding to a ping request. NewInstance(ctx context.Context) (reader.DataReader, error) // TypeName is usually the application name. // Recorders should not intercept the engine for its decision, unless they have a // valid reason. TypeName() string }
ReaderConf defines a behaviour of a reader.
type RecorderConf ¶
type RecorderConf interface { Conf // NewInstance should return an initialised Recorder instance. // You should return an error if the endpoint is not responding to a ping request. NewInstance(ctx context.Context) (recorder.DataRecorder, error) // IndexName comes from the configuration, but the engine might take over. // Recorders should not intercept the engine for its decision, unless they have a // valid reason. IndexName() string }
RecorderConf defines a behaviour that requires the recorders to have the concept of Index and Type. If any of these are not applicable, just return an empty string.
type StructureErr ¶
type StructureErr struct { Section string // The section that error happened Reason string // The reason behind the error Err error // Err is the error that occurred during the operation. }
StructureErr represents an error reading the configuration file
func (*StructureErr) Error ¶
func (e *StructureErr) Error() string
Click to show internal directories.
Click to hide internal directories.