update runtime to function

This commit is contained in:
Asim Aslam
2019-09-13 21:33:14 -07:00
parent ef86c9625b
commit 0fc4c180ee
4 changed files with 280 additions and 4 deletions

39
runtime/runtime.go Normal file
View File

@@ -0,0 +1,39 @@
// Package runtime is a service runtime manager
package runtime
// Runtime is a service runtime manager
type Runtime interface {
// Registers a service
Register(*Service) error
// starts the runtime
Run() error
// Shutdown the runtime
Stop() error
}
type Service struct {
// name of the service
Name string
// url location of source
Source string
// path to store source
Path string
// exec command
Exec string
}
var (
DefaultRuntime = newRuntime()
)
func Register(s *Service) error {
return DefaultRuntime.Register(s)
}
func Run() error {
return DefaultRuntime.Run()
}
func Stop() error {
return DefaultRuntime.Stop()
}