engine

package
v1.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 {
	*config.Config  // Config for engine, and all services
	*ServiceManager // Registry of all services
	sync.WaitGroup  // Service WaitGroup
}

func NewEngine

func NewEngine() (error, *Engine)

func (*Engine) Restart

func (bot *Engine) Restart() error

func (*Engine) Start

func (bot *Engine) Start()

func (*Engine) Stop

func (bot *Engine) Stop()

func (*Engine) WaitForInterrupt

func (bot *Engine) WaitForInterrupt()

type ServiceManager

type ServiceManager struct {
	// 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() *ServiceManager

NewServiceManager creates a new instance of the ServiceManager struct

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) RegisterService

func (s *ServiceManager) RegisterService(service service.IService) error

RegisterService appends a service to the service registry.

func (*ServiceManager) StartAll

func (s *ServiceManager) StartAll(group *sync.WaitGroup)

StartAll initialized each service in order of registration.

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
	Copyright       string
	PrereleaseBlurb string
	GitHub          string
	Issues          string
	IsDaemon        bool
	IsPreRelease    bool
	IsDevMode       bool
}

func CreateDefaultVersion

func CreateDefaultVersion() *Version

func (*Version) GetVersionString

func (version *Version) GetVersionString(short bool) string

GetVersionString returns the version string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL