config

package
v3.1.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2016 License: MIT Imports: 9 Imported by: 8

Documentation

Overview

Package config provides data structure for storing resourced reader/writer configurations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	GoStruct       string
	GoStructFields map[string]interface{}
	Path           string
	Interval       string
	Host           *host.Host

	// There are 4 kinds: reader, writer, executor, and log
	Kind string

	// Writer specific fields
	// ReaderPaths defines input data endpoints for a Writer.
	ReaderPaths []string

	// Executor specific fields
	LowThreshold               int64
	HighThreshold              int64
	Conditions                 string
	ResourcedMasterURL         string
	ResourcedMasterAccessToken string

	// Logger specific fields
	Source     string
	BufferSize int64
	Targets    []LogTargetConfig
}

Config is a unit of execution for a reader/writer. Reader config defines how to fetch a particular information and its JSON data path. Writer config defines how to export the JSON data to a particular destination. E.g. Facts/graphing database.

func NewConfig

func NewConfig(fullpath, kind string) (Config, error)

NewConfig creates Config struct given fullpath and kind.

func (*Config) CommonJsonData

func (c *Config) CommonJsonData() map[string]interface{}

CommonJsonData returns common information for every reader/writer/executor JSON interpretation.

func (*Config) PathWithKindPrefix

func (c *Config) PathWithKindPrefix(kind string, input string) string

PathWithKindPrefix is common prepender function

func (*Config) PathWithPrefix

func (c *Config) PathWithPrefix() string

PathWithPrefix prepends the short version of config.Kind to path.

type Configs

type Configs struct {
	Readers   []Config
	Writers   []Config
	Executors []Config
	Loggers   []Config
}

Configs stores all readers, writers, and executors configuration.

func NewConfigs

func NewConfigs(configDir string) (*Configs, error)

NewConfigs creates Configs struct given configDir.

type GeneralConfig

type GeneralConfig struct {
	Addr     string
	LogLevel string
	TTL      int

	HTTPS struct {
		CertFile string
		KeyFile  string
	}
	ResourcedMaster struct {
		URL         string
		AccessToken string
	}
	MetricReceiver MetricReceiverConfig
	LogReceiver    LogReceiverConfig
}

GeneralConfig stores all other configuration data.

func NewGeneralConfig

func NewGeneralConfig(configDir string) (GeneralConfig, error)

NewGeneralConfig is the constructor for GeneralConfig.

type ITCPServer

type ITCPServer interface {
	GetAddr() string
	GetCertFile() string
	GetKeyFile() string
}

type LogReceiverConfig

type LogReceiverConfig struct {
	TCPConfig
	ChannelCapacity int64
}

type LogTargetConfig

type LogTargetConfig struct {
	Endpoint  string
	AllowList []string
	DenyList  []string
}

type MetricReceiverConfig

type MetricReceiverConfig struct {
	TCPConfig
	StatsInterval          string
	HistogramReservoirSize int
	Blacklist              []string
	BlacklistCompiled      []*regexp.Regexp
}

type TCPConfig

type TCPConfig struct {
	Addr     string
	CertFile string
	KeyFile  string
}

func (TCPConfig) GetAddr

func (c TCPConfig) GetAddr() string

func (TCPConfig) GetCertFile

func (c TCPConfig) GetCertFile() string

func (TCPConfig) GetKeyFile

func (c TCPConfig) GetKeyFile() string

Jump to

Keyboard shortcuts

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