consul

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2016 License: Apache-2.0 Imports: 21 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestServer added in v1.0.0

func CreateTestServer(t *testing.T) *testutil.TestServer

Types

type Agent added in v0.3.6

type Agent struct {
	Client *consulapi.Client
	IP     string
	// contains filtered or unexported fields
}

func (*Agent) ClearFailures added in v0.3.6

func (a *Agent) ClearFailures()

func (*Agent) IncFailures added in v0.3.6

func (a *Agent) IncFailures() uint32

type Agents

type Agents interface {
	GetAgent(agentAddress string) (agent *consulapi.Client, err error)
	GetAnyAgent() (agent *Agent, err error)
	RemoveAgent(agentAddress string)
}

type Auth

type Auth struct {
	Enabled  bool
	Username string
	Password string
}

type ConcurrentAgents

type ConcurrentAgents struct {
	// contains filtered or unexported fields
}

func NewAgents

func NewAgents(config *Config) *ConcurrentAgents

func (*ConcurrentAgents) GetAgent

func (a *ConcurrentAgents) GetAgent(agentAddress string) (*consulapi.Client, error)

func (*ConcurrentAgents) GetAnyAgent

func (a *ConcurrentAgents) GetAnyAgent() (*Agent, error)

func (*ConcurrentAgents) RemoveAgent added in v0.3.4

func (a *ConcurrentAgents) RemoveAgent(agentAddress string)

type Config added in v1.0.0

type Config struct {
	Auth                   Auth
	Port                   string
	SslEnabled             bool
	SslVerify              bool
	SslCert                string
	SslCaCert              string
	Token                  string
	Tag                    string
	Timeout                time.Interval
	RequestRetries         uint32
	AgentFailuresTolerance uint32
	ConsulNameSeparator    string
	IgnoredHealthChecks    string
}

type Consul

type Consul struct {
	// contains filtered or unexported fields
}

func ClientAtServer added in v1.0.0

func ClientAtServer(server *testutil.TestServer) *Consul

func FailingClient added in v1.0.0

func FailingClient() *Consul

func New

func New(config Config) *Consul

func (*Consul) AddAgent added in v1.0.0

func (c *Consul) AddAgent(agentAddress string) error

func (*Consul) AddAgentsFromApps added in v1.0.0

func (c *Consul) AddAgentsFromApps(apps []*apps.App)

func (*Consul) Deregister

func (c *Consul) Deregister(toDeregister *service.Service) error

func (*Consul) DeregisterByTask added in v1.0.0

func (c *Consul) DeregisterByTask(taskID apps.TaskID) error

func (*Consul) GetAllServices

func (c *Consul) GetAllServices() ([]*service.Service, error)

func (*Consul) GetServices added in v0.3.1

func (c *Consul) GetServices(name string) ([]*service.Service, error)

func (*Consul) Register

func (c *Consul) Register(task *apps.Task, app *apps.App) error

type ServicesProvider added in v0.3.4

type ServicesProvider func(agent *consulapi.Client) ([]*service.Service, error)

type Stub added in v1.0.0

type Stub struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

TODO this should be a service registry stub in the service package, requires abstracting from AgentServiceRegistration

func NewConsulStub

func NewConsulStub() *Stub

func NewConsulStubWithTag added in v0.3.2

func NewConsulStubWithTag(tag string) *Stub

func (*Stub) Deregister added in v1.0.0

func (c *Stub) Deregister(toDeregister *service.Service) error

func (*Stub) DeregisterByTask added in v1.0.0

func (c *Stub) DeregisterByTask(taskID apps.TaskID) error

func (*Stub) FailDeregisterByTaskForID added in v1.0.0

func (c *Stub) FailDeregisterByTaskForID(taskID apps.TaskID)

func (*Stub) FailDeregisterForID added in v1.0.0

func (c *Stub) FailDeregisterForID(serviceID service.ServiceId)

func (*Stub) FailGetServicesForName added in v1.0.0

func (c *Stub) FailGetServicesForName(failOnName string)

func (*Stub) FailRegisterForID added in v1.0.0

func (c *Stub) FailRegisterForID(taskID apps.TaskID)

func (*Stub) GetAllServices added in v1.0.0

func (c *Stub) GetAllServices() ([]*service.Service, error)

func (*Stub) GetServices added in v1.0.0

func (c *Stub) GetServices(name string) ([]*service.Service, error)

func (*Stub) Register added in v1.0.0

func (c *Stub) Register(task *apps.Task, app *apps.App) error

func (*Stub) RegisterOnlyFirstRegistrationIntent added in v1.0.0

func (c *Stub) RegisterOnlyFirstRegistrationIntent(task *apps.Task, app *apps.App)

func (*Stub) RegisterWithoutMarathonTaskTag added in v1.0.0

func (c *Stub) RegisterWithoutMarathonTaskTag(task *apps.Task, app *apps.App)

func (*Stub) RegisteredTaskIDs added in v1.0.0

func (c *Stub) RegisteredTaskIDs() []apps.TaskID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL