config

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: 12 Imported by: 0

Documentation

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
	Interval() time.Duration
	Timeout() time.Duration
	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 reader names to a list of recorders.
	// map["red1"][]string{"rec1", "rec2"}: means whatever is read from red1, will be shipped to both rec1 and rec2
	Routes map[string][]string
}

ConfMap holds the relation between readers and recorders.

func LoadYAML

func LoadYAML(log *logrus.Logger, v *viper.Viper) (*ConfMap, error)

LoadYAML loads the settings from the configuration file

type NotSpecifiedErr

type NotSpecifiedErr interface {
	NotSpecified()
}

NotSpecifiedErr represents an error when a section is not specified

type NotSupportedErr

type NotSupportedErr interface {
	NotSupported()
}

NotSupportedErr is for when something is still not supported

type ReaderConf

type ReaderConf interface {
	Conf

	// NewInstance should return an intialised Reader instance.
	NewInstance(context.Context) (reader.DataReader, error)
}

ReaderConf defines a behaviour of a reader.

type RecorderConf

type RecorderConf interface {
	Conf

	// NewInstance should return an intialised Recorder instance.
	NewInstance(context.Context) (recorder.DataRecorder, error)

	// 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
}

RecorderConf defines a behaviour that requies the recorders to have the concept of Index and Type. If any of these are not applicable, just return an empty string.

type RoutersErr

type RoutersErr interface {
	Routers()
}

RoutersErr represents an error when routes are not configured correctly The section on this error is the subsection of the route

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

Jump to

Keyboard shortcuts

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