Add watch options

This commit is contained in:
Asim Aslam
2018-02-19 17:12:37 +00:00
parent eb7788ce25
commit 02260dcaa3
9 changed files with 78 additions and 27 deletions

View File

@@ -13,7 +13,7 @@ type Registry interface {
Deregister(*Service) error
GetService(string) ([]*Service, error)
ListServices() ([]*Service, error)
Watch() (Watcher, error)
Watch(...WatchOption) (Watcher, error)
String() string
}
@@ -21,6 +21,8 @@ type Option func(*Options)
type RegisterOption func(*RegisterOptions)
type WatchOption func(*WatchOptions)
var (
DefaultRegistry = newConsulRegistry()
@@ -52,8 +54,8 @@ func ListServices() ([]*Service, error) {
}
// Watch returns a watcher which allows you to track updates to the registry.
func Watch() (Watcher, error) {
return DefaultRegistry.Watch()
func Watch(opts ...WatchOption) (Watcher, error) {
return DefaultRegistry.Watch(opts...)
}
func String() string {