Documentation ¶
Index ¶
- Variables
- type Engine
- type ServiceManager
- func (s *ServiceManager) FetchService(service interface{}) error
- func (s *ServiceManager) GetService(name string) bool
- func (s *ServiceManager) SetService(name string, status bool) error
- func (s *ServiceManager) Start(name string) error
- func (s *ServiceManager) StartAll() error
- func (s *ServiceManager) Stop(name string) error
- func (s *ServiceManager) StopAll()
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( Copyright = fmt.Sprintf("Copyright (c) 2021-%d QuantStop.com", time.Now().Year()) PrereleaseBlurb = "This version is pre-release and is not intended to be used as a production ready system - use at your own risk." GitHub = "GitHub: https://github.com/QuantStop/QuantStopTerminal" Issues = "Issues: https://github.com/QuantStop/QuantStopTerminal/issues" )
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct { *Version // The engine version information *config.Config // Config for engine, and all services *ServiceManager // Registry of all services }
func (*Engine) WaitForInterrupt ¶
WaitForInterrupt is a blocking routine that returns when an operating system interrupt signal is received.
type ServiceManager ¶
type ServiceManager struct { // service wait group ServiceWG *sync.WaitGroup // contains filtered or unexported fields }
ServiceManager provides a useful pattern for managing services. It allows for ease of dependency management and ensures services dependent on others use the same references in memory.
func NewServiceManager ¶
func NewServiceManager(bot *Engine) (*ServiceManager, error)
NewServiceManager creates a new instance of the ServiceManager struct, then creates and registers all services.
func (*ServiceManager) FetchService ¶
func (s *ServiceManager) FetchService(service interface{}) error
FetchService takes in a struct pointer and sets the value of that pointer to a service currently stored in the service registry. This ensures the input argument is set to the right pointer that refers to the originally registered service.
func (*ServiceManager) GetService ¶ added in v0.3.0
func (s *ServiceManager) GetService(name string) bool
func (*ServiceManager) SetService ¶ added in v0.3.0
func (s *ServiceManager) SetService(name string, status bool) error
SetService allows starting/stopping individual services. Not all services are allowed as some are core features that rely on other services as well. If the service is not found, or the service is not allowed, an error will be returned.
func (*ServiceManager) Start ¶ added in v0.3.0
func (s *ServiceManager) Start(name string) error
Start takes in a subsystem name string, and wait group, attempts to find the service by its name, and then start it.
func (*ServiceManager) StartAll ¶
func (s *ServiceManager) StartAll() error
StartAll initialized each service in order of registration.
func (*ServiceManager) Stop ¶ added in v0.3.0
func (s *ServiceManager) Stop(name string) error
Stop takes in a subsystem name string and attempts to find the service by its name, and then Stop
func (*ServiceManager) StopAll ¶
func (s *ServiceManager) StopAll()
StopAll ends every service in reverse order of registration, logging a panic if any of them fail to stop.
type Version ¶
type Version struct { Version string BuildTime string Commit string Copyright string PrereleaseBlurb string GitHub string Issues string IsDaemon bool IsPreRelease bool IsDevMode bool }
func CreateDefaultVersion ¶
func CreateDefaultVersion() *Version
func CreateVersion ¶ added in v0.3.0
func (*Version) GetVersionString ¶
GetVersionString returns the version string