1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00

Add some comments

This commit is contained in:
Asim 2016-01-30 21:13:34 +00:00
parent 6b7f2f3bd3
commit 146701eeaa

View File

@ -1,5 +1,8 @@
package registry
// The registry provides an interface for service discovery
// and an abstraction over varying implementations
// {consul, etcd, zookeeper, ...}
type Registry interface {
Register(*Service, ...RegisterOption) error
Deregister(*Service) error
@ -21,22 +24,27 @@ func NewRegistry(addrs []string, opt ...Option) Registry {
return newConsulRegistry(addrs, opt...)
}
// Register a service node. Additionally supply options such as TTL.
func Register(s *Service, opts ...RegisterOption) error {
return DefaultRegistry.Register(s, opts...)
}
// Deregister a service node
func Deregister(s *Service) error {
return DefaultRegistry.Deregister(s)
}
// Retrieve a service. A slice is returned since we separate Name/Version.
func GetService(name string) ([]*Service, error) {
return DefaultRegistry.GetService(name)
}
// List the services. Only returns service names
func ListServices() ([]*Service, error) {
return DefaultRegistry.ListServices()
}
// Watch returns a watcher which allows you to track updates to the registry.
func Watch() (Watcher, error) {
return DefaultRegistry.Watch()
}