config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger Logger  `json:"logger"`
	DB     DB      `json:"db"`
	Grid   Grid    `json:"grid"`
	Statsd *Statsd `json:"statsd,omitempty"`
}

Config - settings of application.

func New

func New() *Config

New - Constructor of config.

func (*Config) LoadFromFile

func (c *Config) LoadFromFile(path string) error

LoadFromFile - config loader from json file.

type DB

type DB struct {
	Implementation string `json:"implementation"`
	Connection     string `json:"connection"`
}

DB - Configuration of storage.

type Grid

type Grid struct {
	ClientType       string     `json:"client_type"`
	Port             int        `json:"port"`
	StrategyList     []Strategy `json:"strategy_list"`
	BusyNodeDuration string     `json:"busy_node_duration"` // duration string format ex. 12m, see time.ParseDuration()
	// todo: выпилить и сделать равным дедлайну http запроса
	ReservedDuration string `json:"reserved_node_duration"` // duration string format ex. 12m, see time.ParseDuration()
}

Grid general settings

type Logger

type Logger struct {
	Level string `json:"level"`
}

Logger - Configuration of logger.

type Node

type Node struct {
	Params           json.RawMessage          `json:"params"` // ex. image_name, etc.
	CapabilitiesList []map[string]interface{} `json:"capabilities_list"`
}

Node - Describes node properties and capabilities. Applicable only for on-demand strategies.

type Statsd

type Statsd struct {
	Host             string                         `json:"host"`
	Port             int                            `json:"port"`
	Protocol         string                         `json:"protocol"`
	Prefix           string                         `json:"prefix"`
	Enable           bool                           `json:"enable"`
	CapabilitiesList []metrics.CapabilitiesSelector `json:"selectors"`
}

Statsd - Settings of metrics sender.

type Strategy

type Strategy struct {
	Params   json.RawMessage `json:"params"` // ex. docker config, kubernetes config, etc.
	Type     string          `json:"type"`
	Limit    int             `json:"limit"`
	NodeList []Node          `json:"node_list"`
}

Strategy - Describes the algorithm of node selection.

Jump to

Keyboard shortcuts

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