agent: use persist/load/purge convention for function names
This commit is contained in:
parent
08a12ffd5b
commit
e4f937f71d
|
@ -761,7 +761,7 @@ func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *CheckType, persist
|
|||
}
|
||||
|
||||
// Restore persisted state, if any
|
||||
if err := a.recallCheckState(check); err != nil {
|
||||
if err := a.loadCheckState(check); err != nil {
|
||||
a.logger.Printf("[WARN] agent: failed restoring state for check %q: %s",
|
||||
check.CheckID, err)
|
||||
}
|
||||
|
@ -917,8 +917,8 @@ func (a *Agent) persistCheckState(check *CheckTTL, status, output string) error
|
|||
return nil
|
||||
}
|
||||
|
||||
// recallCheckState is used to restore the persisted state of a check.
|
||||
func (a *Agent) recallCheckState(check *structs.HealthCheck) error {
|
||||
// loadCheckState is used to restore the persisted state of a check.
|
||||
func (a *Agent) loadCheckState(check *structs.HealthCheck) error {
|
||||
// Try to read the persisted state for this check
|
||||
file := filepath.Join(a.config.DataDir, checkStateDir, stringHash(check.CheckID))
|
||||
buf, err := ioutil.ReadFile(file)
|
||||
|
|
|
@ -1441,7 +1441,7 @@ func TestAgent_persistCheckState(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestAgent_recallCheckState(t *testing.T) {
|
||||
func TestAgent_loadCheckState(t *testing.T) {
|
||||
config := nextConfig()
|
||||
dir, agent := makeAgent(t, config)
|
||||
defer os.RemoveAll(dir)
|
||||
|
@ -1459,12 +1459,12 @@ func TestAgent_recallCheckState(t *testing.T) {
|
|||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
// Try to recall the state
|
||||
// Try to load the state
|
||||
health := &structs.HealthCheck{
|
||||
CheckID: "check1",
|
||||
Status: structs.HealthCritical,
|
||||
}
|
||||
if err := agent.recallCheckState(health); err != nil {
|
||||
if err := agent.loadCheckState(health); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
|
@ -1489,8 +1489,8 @@ func TestAgent_recallCheckState(t *testing.T) {
|
|||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
// Try to recall
|
||||
if err := agent.recallCheckState(health); err != nil {
|
||||
// Try to load
|
||||
if err := agent.loadCheckState(health); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue