mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-06 08:16:03 +02:00
40 lines
645 B
Go
40 lines
645 B
Go
// 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()
|
|
}
|