Client is a wrapper around the Consul API.
type Client interface { // Register a service with the local agent. Register(r *consul.AgentServiceRegistration) error // Deregister a service with the local agent. Deregister(r *consul.AgentServiceRegistration) error // Service Service(service, tag string, passingOnly bool, queryOpts *consul.QueryOptions) ([]*consul.ServiceEntry, *consul.QueryMeta, error) }
func NewClient(c *consul.Client) Client
NewClient returns an implementation of the Client interface, wrapping a concrete Consul client.
Instancer yields instances for a service in Consul.
type Instancer struct {
// contains filtered or unexported fields
}
func NewInstancer(client Client, logger log.Logger, service string, tags []string, passingOnly bool) *Instancer
NewInstancer returns a Consul instancer that publishes instances for the requested service. It only returns instances for which all of the passed tags are present.
func (s *Instancer) Deregister(ch chan<- sd.Event)
Deregister implements Instancer.
func (s *Instancer) Register(ch chan<- sd.Event)
Register implements Instancer.
func (s *Instancer) Stop()
Stop terminates the instancer.
Registrar registers service instance liveness information to Consul.
type Registrar struct {
// contains filtered or unexported fields
}
func NewRegistrar(client Client, r *stdconsul.AgentServiceRegistration, logger log.Logger) *Registrar
NewRegistrar returns a Consul Registrar acting on the provided catalog registration.
func (p *Registrar) Deregister()
Deregister implements sd.Registrar interface.
func (p *Registrar) Register()
Register implements sd.Registrar interface.