common

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(message string) error

Error creates an error, and logs it righteously

func ErrorE

func ErrorE(message string, err error) error

ErrorE encapsulates err in a structured log and return an abstracted high-level error with message as the payload

func ErrorEF

func ErrorEF(message string, err error, fields log.Fields) error

ErrorEF encapsulates fields and err in a structured log and return an abstracted high-level error with message as the payload

func ErrorF

func ErrorF(message string, fields log.Fields) error

ErrorF encapsulates fields in a structured log and return an abstracted high-level error with message as the payload

func EtcdClient

func EtcdClient() (*clientv3.Client, error)

EtcdClient read the specific configuration files to initiate etcd connection

func InitLogging

func InitLogging()

InitLogging initializes the logrus logger to Debug

func LoadConfig

func LoadConfig()

LoadConfig loads the cogs config from a well known file location.

func Warn added in v0.3.1

func Warn(message string)

Warn acts like Error, but doesnt return anything

func WarnE added in v0.3.1

func WarnE(message string, err error)

WarnE includes an error message which is treated as not

func WarnEF added in v0.4.1

func WarnEF(message string, err error, fields log.Fields)

WarnF includes an encapsulated field to the warning message

func WarnF added in v0.3.1

func WarnF(message string, fields log.Fields)

WarnF includes an encapsulated field to the warning message

Types

type Config

type Config struct {
	Driver    ServiceConfig
	Etcd      ServiceConfig
	Elastic   ServiceConfig
	Commander ServiceConfig
	Beluga    ServiceConfig
	Nex       ServiceConfig
	Tuning    Tuning
	Net       NetConfig
}

Config is the top level configuration object for the cogs system.

func GetConfig

func GetConfig() Config

GetConfig returns the cogs configuration. If the config has already been loaded, a cached copy is returned.

type NetConfig

type NetConfig struct {
	VtepIfx         string `yaml:"vtepIfx"`
	Mtu             int    `yaml:"mtu"`
	VtepMtu         int    `yaml:"vtepMtu"`
	ServiceTunnelIP string `yaml:"serviceTunnelIP"`

	ExternalIfx     string `yaml:"externalIfx"`
	ExternalIP      string `yaml:"externalIP"`
	ExternalSubnet  string `yaml:"externalSubnet"`
	ExternalGateway string `yaml:"externalGateway"`
}

NetConfig contains the cogs networking configuration.

type ServiceConfig

type ServiceConfig struct {
	Address string
	Port    int
	TLS     *TLSConfig
}

ServiceConfig encapsulates information for communicating with services.

func (*ServiceConfig) Endpoint

func (s *ServiceConfig) Endpoint() string

Endpoint returns the endpoint string of a service config.

type TLSConfig added in v0.3.1

type TLSConfig struct {
	Cacert string
	Cert   string
	Key    string
}

TLSConfig defines a TLS configuration for communicating with a service.

type Tuning

type Tuning struct {
	TaskQuantum int `yaml:"taskQuantum"`
	TaskLease   int `yaml:"taskLease"`
	FailSleep   int `yaml:"failSleep"`
}

Tuning contains tasks that can be tuned by a cogs administrator to tweak performance.

Jump to

Keyboard shortcuts

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