Documentation ¶
Overview ¶
Package registry is an interface for service discovery
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultRegistry = newConsulRegistry() ErrNotFound = errors.New("not found") )
Functions ¶
func Register ¶
func Register(s *Service, opts ...RegisterOption) error
Register a service node. Additionally supply options such as TTL.
Types ¶
type RegisterOption ¶
type RegisterOption func(*RegisterOptions)
func RegisterTTL ¶
func RegisterTTL(t time.Duration) RegisterOption
type RegisterOptions ¶
type Registry ¶
type Registry interface { Register(*Service, ...RegisterOption) error Deregister(*Service) error GetService(string) ([]*Service, error) ListServices() ([]*Service, error) Watch() (Watcher, error) String() string }
The registry provides an interface for service discovery and an abstraction over varying implementations {consul, etcd, zookeeper, ...}
func NewRegistry ¶
type Result ¶
Result is returned by a call to Next on the watcher. Actions can be create, update, delete
type Service ¶
type Service struct { Name string `json:"name"` Version string `json:"version"` Metadata map[string]string `json:"metadata"` Endpoints []*Endpoint `json:"endpoints"` Nodes []*Node `json:"nodes"` }
func GetService ¶
Retrieve a service. A slice is returned since we separate Name/Version.
func ListServices ¶
List the services. Only returns service names
Source Files ¶
Click to show internal directories.
Click to hide internal directories.