37 lines
471 B
Go
37 lines
471 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"gosvc"
|
|
|
|
"robotfs/engine"
|
|
)
|
|
|
|
type Service struct {
|
|
gosvc.ServiceBase
|
|
|
|
*engine.Engine
|
|
}
|
|
|
|
func CreateService() (*Service, error) {
|
|
return &Service{
|
|
Engine: engine.NewEngine(),
|
|
}, nil
|
|
}
|
|
|
|
func (s *Service) LoadMetadata() error {
|
|
return nil
|
|
}
|
|
|
|
func (s *Service) Start() error {
|
|
if err := s.Engine.Start(); err != nil {
|
|
return fmt.Errorf("start engine failed: %v", err)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (s *Service) Stop() {
|
|
s.Engine.Stop()
|
|
}
|