From e4f937f71d9e9f0f7a254559a2c46c0b2007a3fa Mon Sep 17 00:00:00 2001 From: Ryan Uber Date: Mon, 8 Jun 2015 09:35:10 -0700 Subject: [PATCH] agent: use persist/load/purge convention for function names --- command/agent/agent.go | 6 +++--- command/agent/agent_test.go | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/command/agent/agent.go b/command/agent/agent.go index 16d1b741a..d1d9e9291 100644 --- a/command/agent/agent.go +++ b/command/agent/agent.go @@ -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) diff --git a/command/agent/agent_test.go b/command/agent/agent_test.go index bb21464c7..b36a8a274 100644 --- a/command/agent/agent_test.go +++ b/command/agent/agent_test.go @@ -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) }