Documentation
¶
Overview ¶
Package cmd provides cobra commands for github.com/Felixoid/coal-mine application
Copyright © 2021 Mikhail f. Shiryaev <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CatchedSignals = make(chan os.Signal, 1)
CatchedSignals are catched by program and processed gracefully
var Version = "0.1"
Version is set during the build and used in `--version` flag
Functions ¶
Types ¶
type Config ¶
type Config struct { Carbon string `` /* 143-byte string literal not displayed */ Const []string `` /* 180-byte string literal not displayed */ Counter []string `` /* 210-byte string literal not displayed */ Random []string `` /* 184-byte string literal not displayed */ General `mapstructure:",squash"` Custom []Custom `toml:"custom,omitempty" json:"custom,omitempty" comment:"generators with custom parameters can be specified separately"` }
Config is a general application config. Everything besides Generators can be set both from flags and config file.
func (*Config) GetCarbonWriter ¶
GetCarbonWriter returns net.Conn. If it's unable to parse the Carbon field, an error is not nil.
func (*Config) ResetStartStop ¶
func (c *Config) ResetStartStop()
ResetStartStop sets all start and stop values of the general and cutom configs to the current timestamp
func (*Config) SetStartStop ¶
func (c *Config) SetStartStop()
SetStartStop process graphite-web from/until and sets start and stop fields
func (*Config) ToGenerators ¶
func (c *Config) ToGenerators() ([]generator.Generators, error)
ToGenerators returns slice of generator.Generators for main config and each Config.Custom
type Custom ¶
type Custom struct { Name string `toml:"name,omitempty" json:"name,omitempty" comment:"names for generator, braces are expanded like in shell"` Type string `toml:"type,omitempty" json:"type,omitempty" comment:"type of generator"` General `mapstructure:",squash"` }
Custom is a config for a generators with special parameters. Is readed only from a config file.
func (*Custom) ToGenerators ¶
func (c *Custom) ToGenerators() (generator.Generators, error)
ToGenerators returns generator.Generators for a given custom config
type General ¶
type General struct { From string `toml:"from,omitempty" json:"from,omitempty" comment:"from in graphite-web format, the local TZ is used"` Until string `toml:"until,omitempty" json:"until,omitempty" comment:"until in graphite-web format, the local TZ is used"` Step uint `toml:"step,omitempty" json:"step,omitempty" comment:"step in seconds"` Randomize bool `toml:"randomize" json:"randomize" comment:"randomize starting time with [0,step)"` Value float64 `toml:"value,omitempty" json:"value,omitempty" comment:"first value for all generators"` Deviation float64 `` /* 207-byte string literal not displayed */ Probability uint8 `` /* 243-byte string literal not displayed */ // contains filtered or unexported fields }
General is the general part of configs