Documentation ¶
Index ¶
Constants ¶
const ( TrafficCtl = "traffic_ctl" ParentsFile = "parent.config" StrategiesFile = "strategies.yaml" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FailOver ¶
type FailOver struct { MaxSimpleRetries int `yaml:"max_simple_retries,omitempty"` RingMode string `yaml:"ring_mode,omitempty"` ResponseCodes []int `yaml:"response_codes,omitempty"` MarkDownCodes []int `yaml:"markdown_codes,omitempty"` HealthCheck []string `yaml:"health_check,omitempty"` }
when reading the 'strategies.yaml', these fields are used to help parse out fail_over objects.
type ParentAvailable ¶
type ParentAvailable interface {
// contains filtered or unexported methods
}
type ParentInfo ¶
type ParentInfo struct { ParentDotConfig util.ConfigFile StrategiesDotYaml util.ConfigFile TrafficServerBinDir string TrafficServerConfigDir string Parents map[string]ParentStatus Cfg config.Cfg }
the necessary data required to keep track of trafficserver config files, lists of parents a trafficserver instance uses, and directory locations used for configuration and trafficserver executables.
func NewParentInfo ¶
func NewParentInfo(cfg config.Cfg) (*ParentInfo, error)
used at startup to load a trafficservers list of parents from it's 'parent.config', 'strategies.yaml' and current parent status from trafficservers HostStatus subsystem.
func (*ParentInfo) GetCacheStatuses ¶
func (c *ParentInfo) GetCacheStatuses() (map[tc.CacheName]datareq.CacheStatus, error)
Queries a traffic monitor that is monitoring the trafficserver instance running on a host to obtain the availability, health, of a parent used by trafficserver.
func (*ParentInfo) PollAndUpdateCacheStatus ¶
func (c *ParentInfo) PollAndUpdateCacheStatus()
The main polling function that keeps the parents list current if with any changes to the trafficserver 'parent.config' or 'strategies.yaml'. Also, it keeps parent status current with the the trafficserver HostStatus subsystem. Finally, on each poll cycle a trafficmonitor is queried to check that all parents used by this trafficserver are available for use based upon the trafficmonitors idea from it's health protocol. Parents are marked up or down in the trafficserver subsystem based upon that hosts current status and the status that trafficmonitor health protocol has determined for a parent.
func (*ParentInfo) UpdateParentInfo ¶
func (c *ParentInfo) UpdateParentInfo() error
Used by the polling function to update the parents list from changes to 'parent.config' and 'strategies.yaml'. The parents availability is also updated to reflect the current state from the trafficserver HostStatus subsystem.
type ParentStatus ¶
the trafficserver 'HostStatus' fields that are necessary to interface with the trafficserver 'traffic_ctl' command.
func (ParentStatus) Status ¶
func (p ParentStatus) Status() string
used to log that a parent's status is either UP or DOWN based upon the HostStatus reason codes. to be considered UP, all reason codes must be 'true'.
type Protocol ¶
type Protocol struct { Scheme string `yaml:"scheme"` Port int `yaml:"port"` Health_check_url string `yaml:"health_check_url,omitempty"` Weight float64 `yaml:"weight,omitempty"` }
the protocol object in 'strategies.yaml' that help to describe a parent.
type StatusReason ¶
type StatusReason int
const ( ACTIVE StatusReason = iota LOCAL MANUAL )
these are the HostStatus reason codes used withing trafficserver.
func (StatusReason) String ¶
func (s StatusReason) String() string
used for logging a parent's HostStatus reason code setting.
type Strategies ¶
type Strategies struct { Strategy []Strategy `yaml:"strategies"` Hosts []Host `yaml:"hosts"` Groups []interface{} `yaml:"groups"` }
the top level array defintions in a trafficserver 'strategies.yaml' configuration file.
type Strategy ¶
type Strategy struct { Strategy string `yaml:"strategy"` Policy string `yaml:"policy"` HashKey string `yaml:"hash_key,omitempty"` GoDirect bool `yaml:"go_direct,omitempty"` ParentIsProxy bool `yaml:"parent_is_proxy,omitempty"` CachePeerResult bool `yaml:"cache_peer_result,omitempty"` Scheme string `yaml:"scheme"` FailOvers FailOver `yaml:"failover,omitempty"` }
a trafficserver strategy object from 'strategies.yaml'.