Documentation ¶
Index ¶
- func GetIP(config Configer, tracker *acomm.Tracker) (net.IP, error)
- func RunTick(config Configer, tick ActionFn) (chan struct{}, error)
- type ActionFn
- type Config
- func (c *Config) ClusterDataURL() *url.URL
- func (c *Config) ConfigFile() string
- func (c *Config) LoadConfig() error
- func (c *Config) LogLevel() string
- func (c *Config) NodeDataURL() *url.URL
- func (c *Config) RequestTimeout() time.Duration
- func (c *Config) SetupLogging() error
- func (c *Config) TickInterval() time.Duration
- func (c *Config) TickRetryInterval() time.Duration
- func (c *Config) Validate() error
- func (c *Config) ValidateURL(name string) error
- type ConfigData
- type Configer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is the configuration for a tick.
func (*Config) ClusterDataURL ¶
ClusterDataURL returns the url of the layer 2 coordinator, used for cluster information.
func (*Config) ConfigFile ¶
ConfigFile returns a path to a config file.
func (*Config) NodeDataURL ¶
NodeDataURL returns the url of the layer 1 coordinator, used for node information.
func (*Config) RequestTimeout ¶
RequestTimeout returns the default timeout for task requests.
func (*Config) SetupLogging ¶
SetupLogging sets up logging with the log level and formatting.
func (*Config) TickInterval ¶
TickInterval returns how often the tick function should be executed.
func (*Config) TickRetryInterval ¶
TickRetryInterval returns how often the tick function should be executed after an error.
func (*Config) ValidateURL ¶
ValidateURL is used in validation for checking url parameters.
type ConfigData ¶
type ConfigData struct { NodeDataURL string `json:"nodeDataURL"` ClusterDataURL string `json:"clusterDataURL"` LogLevel string `json:"logLevel"` RequestTimeout string `json:"requestTimeout"` TickInterval string `json:"tickInterval"` TickRetryInterval string `json:"tickRetryInterval"` }
ConfigData defines the structure of the config data (e.g. in the config file)
type Configer ¶
type Configer interface { ConfigFile() string NodeDataURL() *url.URL ClusterDataURL() *url.URL LogLevel() string RequestTimeout() time.Duration TickInterval() time.Duration TickRetryInterval() time.Duration }
Configer is an interface that provides information the tick needs to run. It allows more complex configs to be passed through to the tick function.