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

@@ -25,6 +25,15 @@ type RegisterOptions struct {
Context context.Context
}
type WatchOptions struct {
// Specify a service to watch
// If blank, the watch is for all services
Service string
// Other options for implementations of the interface
// can be stored in a context
Context context.Context
}
// Addrs is the registry addresses to use
func Addrs(addrs ...string) Option {
return func(o *Options) {
@@ -57,3 +66,10 @@ func RegisterTTL(t time.Duration) RegisterOption {
o.TTL = t
}
}
// Watch a service
func WatchService(name string) WatchOption {
return func(o *WatchOptions) {
o.Service = name
}
}