docs: document exported functions in agent.go (closes #7101) (#7366)

and fix one linter error
pull/7572/head
Shaker Islam 5 years ago committed by GitHub
parent c2f4063103
commit ac309d55f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3240,6 +3240,8 @@ func (a *Agent) removeCheckLocked(checkID structs.CheckID, persist bool) error {
return nil return nil
} }
// ServiceHTTPBasedChecks returns HTTP and GRPC based Checks
// for the given serviceID
func (a *Agent) ServiceHTTPBasedChecks(serviceID structs.ServiceID) []structs.CheckType { func (a *Agent) ServiceHTTPBasedChecks(serviceID structs.ServiceID) []structs.CheckType {
a.stateLock.Lock() a.stateLock.Lock()
defer a.stateLock.Unlock() defer a.stateLock.Unlock()
@ -3258,6 +3260,7 @@ func (a *Agent) ServiceHTTPBasedChecks(serviceID structs.ServiceID) []structs.Ch
return chkTypes return chkTypes
} }
// AdvertiseAddrLAN returns the AdvertiseAddrLAN config value
func (a *Agent) AdvertiseAddrLAN() string { func (a *Agent) AdvertiseAddrLAN() string {
return a.config.AdvertiseAddrLAN.String() return a.config.AdvertiseAddrLAN.String()
} }
@ -3668,7 +3671,7 @@ func (a *Agent) loadServices(conf *config.RuntimeConfig, snap map[structs.CheckI
} }
} }
for serviceID, _ := range persistedServiceConfigs { for serviceID := range persistedServiceConfigs {
if a.State.Service(serviceID) == nil { if a.State.Service(serviceID) == nil {
// This can be cleaned up now. // This can be cleaned up now.
if err := a.purgeServiceConfig(serviceID); err != nil { if err := a.purgeServiceConfig(serviceID); err != nil {
@ -4015,6 +4018,9 @@ func (a *Agent) loadLimits(conf *config.RuntimeConfig) {
a.config.RPCMaxBurst = conf.RPCMaxBurst a.config.RPCMaxBurst = conf.RPCMaxBurst
} }
// ReloadConfig will atomically reload all configs from the given newCfg,
// including all services, checks, tokens, metadata, dnsServer configs, etc.
// It will also reload all ongoing watches.
func (a *Agent) ReloadConfig(newCfg *config.RuntimeConfig) error { func (a *Agent) ReloadConfig(newCfg *config.RuntimeConfig) error {
// Bulk update the services and checks // Bulk update the services and checks
a.PauseSync() a.PauseSync()
@ -4305,6 +4311,7 @@ func (a *Agent) registerCache() {
}) })
} }
// LocalState returns the agent's local state
func (a *Agent) LocalState() *local.State { func (a *Agent) LocalState() *local.State {
return a.State return a.State
} }

Loading…
Cancel
Save