fix: add init to services and node
This commit is contained in:
parent
8914bada60
commit
9919ad72da
|
@ -55,6 +55,10 @@ func (n *Node) Start() error {
|
|||
return n.services.Start()
|
||||
}
|
||||
|
||||
func (n *Node) Init() error {
|
||||
return n.services.Init()
|
||||
}
|
||||
|
||||
func (n *Node) Stop() error {
|
||||
return n.services.Stop()
|
||||
}
|
||||
|
|
|
@ -69,6 +69,17 @@ func (s *ServicesImpl) IsStarted() bool {
|
|||
return s.started
|
||||
}
|
||||
|
||||
func (s *ServicesImpl) Init() error {
|
||||
for _, svc := range s.All() {
|
||||
err := svc.Init()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ServicesImpl) Start() error {
|
||||
for _, svc := range s.All() {
|
||||
err := svc.Start()
|
||||
|
|
|
@ -21,6 +21,7 @@ type Services interface {
|
|||
HTTP() HTTPService
|
||||
Storage() StorageService
|
||||
All() []Service
|
||||
Init() error
|
||||
IsStarted() bool
|
||||
Start() error
|
||||
Stop() error
|
||||
|
|
Loading…
Reference in New Issue