This commit is contained in:
Asim
2016-01-26 23:32:27 +00:00
parent ce0c5908a6
commit 5ec9d561a6
8 changed files with 142 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
package registry
type Registry interface {
Register(*Service) error
Register(*Service, ...RegisterOption) error
Deregister(*Service) error
GetService(string) ([]*Service, error)
ListServices() ([]*Service, error)
@@ -11,6 +11,8 @@ type Registry interface {
type Option func(*Options)
type RegisterOption func(*RegisterOptions)
var (
DefaultRegistry = newConsulRegistry([]string{})
)
@@ -19,8 +21,8 @@ func NewRegistry(addrs []string, opt ...Option) Registry {
return newConsulRegistry(addrs, opt...)
}
func Register(s *Service) error {
return DefaultRegistry.Register(s)
func Register(s *Service, opts ...RegisterOption) error {
return DefaultRegistry.Register(s, opts...)
}
func Deregister(s *Service) error {