Rename NewConsulService to NewSyncer

This commit is contained in:
Sean Chittenden 2016-05-23 07:29:08 -07:00
parent b9789e0cf7
commit 88f3422d7c
No known key found for this signature in database
GPG key ID: 4EBC9DC16C2E5E16
5 changed files with 8 additions and 8 deletions

View file

@ -1267,9 +1267,9 @@ func (c *Client) addAlloc(alloc *structs.Allocation) error {
return nil return nil
} }
// setupConsulClient creates a ConsulService // setupConsulClient creates a consul.Syncer
func (c *Client) setupConsulClient() error { func (c *Client) setupConsulClient() error {
cs, err := consul.NewConsulService(c.config.ConsulAgentConfig, c.logger) cs, err := consul.NewSyncer(c.config.ConsulAgentConfig, c.logger)
c.consulSyncer = cs c.consulSyncer = cs
return err return err
} }

View file

@ -59,8 +59,8 @@ const (
ttlCheckBuffer = 31 * time.Second ttlCheckBuffer = 31 * time.Second
) )
// NewConsulService returns a new ConsulService // NewSyncer returns a new consul.Syncer
func NewConsulService(config *AgentConfig, serverManager *servers.Manager, logger *log.Logger) (*Syncer, error) { func NewSyncer(config *AgentConfig, logger *log.Logger) (*Syncer, error) {
var err error var err error
var c *consul.Client var c *consul.Client
cfg := consul.DefaultConfig() cfg := consul.DefaultConfig()

View file

@ -41,7 +41,7 @@ var (
) )
func TestConsulServiceRegisterServices(t *testing.T) { func TestConsulServiceRegisterServices(t *testing.T) {
cs, err := NewConsulService(&AgentConfig{}, logger) cs, err := NewSyncer(&AgentConfig{}, logger)
if err != nil { if err != nil {
t.Fatalf("Err: %v", err) t.Fatalf("Err: %v", err)
} }
@ -68,7 +68,7 @@ func TestConsulServiceRegisterServices(t *testing.T) {
} }
func TestConsulServiceUpdateService(t *testing.T) { func TestConsulServiceUpdateService(t *testing.T) {
cs, err := NewConsulService(&AgentConfig{}, logger) cs, err := NewSyncer(&AgentConfig{}, logger)
if err != nil { if err != nil {
t.Fatalf("Err: %v", err) t.Fatalf("Err: %v", err)
} }

View file

@ -471,7 +471,7 @@ func (e *UniversalExecutor) SyncServices(ctx *ConsulContext) error {
e.logger.Printf("[INFO] executor: registering services") e.logger.Printf("[INFO] executor: registering services")
e.consulCtx = ctx e.consulCtx = ctx
if e.consulSyncer == nil { if e.consulSyncer == nil {
cs, err := consul.NewConsulService(ctx.ConsulAgentConfig, e.logger) cs, err := consul.NewSyncer(ctx.ConsulAgentConfig, e.logger)
if err != nil { if err != nil {
return err return err
} }

View file

@ -505,7 +505,7 @@ func (a *Agent) createAgentConfig() {
// syncAgentServicesWithConsul syncs this Nomad Agent's services with Consul // syncAgentServicesWithConsul syncs this Nomad Agent's services with Consul
// when running in either Client or Server mode. // when running in either Client or Server mode.
func (a *Agent) syncAgentServicesWithConsul(clientHttpAddr string, serverHttpAddr string) error { func (a *Agent) syncAgentServicesWithConsul(clientHttpAddr string, serverHttpAddr string) error {
cs, err := consul.NewConsulService(a.consulAgentConfig, a.logger) cs, err := consul.NewSyncer(a.consulAgentConfig, a.logger)
if err != nil { if err != nil {
return err return err
} }