blob: ee2aed997a02390fd92e7c1dbafc530da1911041 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package reload
import (
"github.com/spiral/roadrunner/service"
"os"
)
// ID contains default service name.
const ID = "reload"
type Service struct {
reloadConfig *Config
}
// Init controller service
func (s *Service) Init(cfg *Config, c service.Container) (bool, error) {
// mount Services to designated services
//for id, watcher := range cfg.Controllers(s.throw) {
// svc, _ := c.Get(id)
// if ctrl, ok := svc.(controllable); ok {
// ctrl.Attach(watcher)
// }
//}
s.reloadConfig = cfg
return true, nil
}
func (s *Service) Serve() error {
w, err := NewWatcher(SetMaxFileEvents(100))
if err != nil {
return err
}
name , _ := os.Getwd()
w.AddSingle(name)
println("test")
return nil
}
func (s *Service) Stop() {
}
|