Documentation ¶
Overview ¶
Package consul provides subscriber and registrar implementations for Consul.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
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) }
Client is a wrapper around the Consul API.
type Registrar ¶
type Registrar struct {
// contains filtered or unexported fields
}
Registrar registers service instance liveness information to Consul.
func NewRegistrar ¶
func NewRegistrar(client Client, r *stdconsul.AgentServiceRegistration, logger log.Logger) *Registrar
NewRegistrar returns a Consul Registrar acting on the provided catalog registration.
func (*Registrar) Deregister ¶
func (p *Registrar) Deregister()
Deregister implements sd.Registrar interface.
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber yields endpoints for a service in Consul. Updates to the service are watched and will update the Subscriber endpoints.
func NewSubscriber ¶
func NewSubscriber(client Client, factory sd.Factory, logger log.Logger, service string, tags []string, passingOnly bool) *Subscriber
NewSubscriber returns a Consul subscriber which returns endpoints for the requested service. It only returns instances for which all of the passed tags are present.
Click to show internal directories.
Click to hide internal directories.