diff options
author | Wolfy-J <[email protected]> | 2019-05-04 19:24:25 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-05-04 19:24:25 +0300 |
commit | 2efc533f2aac215d487a80020b0f9bf4ae5209c3 (patch) | |
tree | a80a7a74dc4ca8c290b8b1bf1f6d24535b5ae3d7 /service/watcher/service.go | |
parent | 726b31008e73ab83d0582305c28a8cf62322e47a (diff) |
watchers renamed to controllers
Diffstat (limited to 'service/watcher/service.go')
-rw-r--r-- | service/watcher/service.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/service/watcher/service.go b/service/watcher/service.go index 0d419716..3db23b68 100644 --- a/service/watcher/service.go +++ b/service/watcher/service.go @@ -5,25 +5,25 @@ import ( "github.com/spiral/roadrunner/service" ) -// ID defines watcher service name. -const ID = "watch" +// ID defines controller service name. +const ID = "control" -// Watchable defines the ability to attach rr watcher. +// Watchable defines the ability to attach rr controller. type Watchable interface { - // Watch attaches watcher to the service. - Watch(w roadrunner.Watcher) + // Watch attaches controller to the service. + Watch(w roadrunner.Controller) } -// Services to watch the state of rr service inside other services. +// Services to control the state of rr service inside other services. type Service struct { cfg *Config lsns []func(event int, ctx interface{}) } -// Init watcher service +// Init controller service func (s *Service) Init(cfg *Config, c service.Container) (bool, error) { // mount Services to designated services - for id, watcher := range cfg.Watchers(s.throw) { + for id, watcher := range cfg.Controllers(s.throw) { svc, _ := c.Get(id) if watchable, ok := svc.(Watchable); ok { watchable.Watch(watcher) @@ -33,7 +33,7 @@ func (s *Service) Init(cfg *Config, c service.Container) (bool, error) { return true, nil } -// AddListener attaches server event watcher. +// AddListener attaches server event controller. func (s *Service) AddListener(l func(event int, ctx interface{})) { s.lsns = append(s.lsns, l) } |