Documentation
¶
Index ¶
- Constants
- func StartServiceManagement(confPath string) error
- func SystemOpen(target string)
- type ManagedService
- func (s *ManagedService) IsInExecution() bool
- func (s *ManagedService) Kill(appOnly bool)
- func (s *ManagedService) Open()
- func (s *ManagedService) Restart(baseCtx context.Context, appOnly bool, outputWidth, outputHeight int)
- func (s *ManagedService) Start(baseCtx context.Context, outputWidth, outputHeight int)
- type Orchestrator
- func (o *Orchestrator) KillService(id string, appOnly bool)
- func (o *Orchestrator) OpenService(id string)
- func (o *Orchestrator) RestartService(id string, appOnly bool, outputWidth, outputHeight int)
- func (o *Orchestrator) Shutdown()
- func (o *Orchestrator) SortedServices() []*ManagedService
- func (o *Orchestrator) StartService(id string, outputWidth, outputHeight int)
- type ServiceBrickModel
- type ServiceDependency
- type ServiceState
Constants ¶
View Source
const ( INDICATOR_OFF = "⠺ OFF ⠗" INDICATOR_STARTING = "⠺ STARTING ⠗" INDICATOR_RUNNING = "⠺ RUNNING ⠗" INDICATOR_ERROR = "⠺ ERROR ⠗" )
View Source
const BRICK_MIN_WIDTH = 25
View Source
const HPADDING = 2
View Source
const INDICATOR_LEN = 12
It is important that all indicators have the same len
Variables ¶
This section is empty.
Functions ¶
func StartServiceManagement ¶
func SystemOpen ¶
func SystemOpen(target string)
Types ¶
type ManagedService ¶
type ManagedService struct {
Id string
BasePath string
Config cfg.ServiceConfig
Dependencies []*ServiceDependency
Output cmdrunr.SafeBuffer
State ServiceState
StateMtx sync.Mutex
DoneCond *sync.Cond
StartupOverCond *sync.Cond
// contains filtered or unexported fields
}
func (*ManagedService) IsInExecution ¶
func (s *ManagedService) IsInExecution() bool
Check if the service is running. Be careful, you should lock the service's StateMtx before calling this method
func (*ManagedService) Kill ¶
func (s *ManagedService) Kill(appOnly bool)
Trigger the kill message, then waits for the process to have finished (and if appOnly=false, same for all dependencies)
func (*ManagedService) Open ¶
func (s *ManagedService) Open()
Run the os-specific command to open the service target It may wait until the service is not in "starting" anymore
type Orchestrator ¶
type Orchestrator struct {
BasePath string
ServiceList map[string]*ManagedService
// contains filtered or unexported fields
}
func NewOrchestrator ¶
func NewOrchestrator(basePath string, serviceConfigList map[string]cfg.ServiceConfig) (*Orchestrator, error)
func (*Orchestrator) KillService ¶
func (o *Orchestrator) KillService(id string, appOnly bool)
Calls kill on a given service
func (*Orchestrator) OpenService ¶
func (o *Orchestrator) OpenService(id string)
Calls open on a given service
func (*Orchestrator) RestartService ¶
func (o *Orchestrator) RestartService(id string, appOnly bool, outputWidth, outputHeight int)
Calls restart on a given service
func (*Orchestrator) Shutdown ¶
func (o *Orchestrator) Shutdown()
Kill all services, wait for all process to end and return.
func (*Orchestrator) SortedServices ¶
func (o *Orchestrator) SortedServices() []*ManagedService
Returns the list of services sorted by case-insensitive alphabetical order
func (*Orchestrator) StartService ¶
func (o *Orchestrator) StartService(id string, outputWidth, outputHeight int)
Calls start on a given service
type ServiceBrickModel ¶
type ServiceBrickModel struct {
// contains filtered or unexported fields
}
func NewServiceBrick ¶
func NewServiceBrick(id string, service *ManagedService, theme iface.Theme, width int) *ServiceBrickModel
func (*ServiceBrickModel) Focusable ¶
func (s *ServiceBrickModel) Focusable() bool
func (*ServiceBrickModel) Height ¶
func (s *ServiceBrickModel) Height() int
func (*ServiceBrickModel) Id ¶
func (s *ServiceBrickModel) Id() string
func (*ServiceBrickModel) Resize ¶
func (s *ServiceBrickModel) Resize(width int)
func (*ServiceBrickModel) SetFocusLevel ¶
func (s *ServiceBrickModel) SetFocusLevel(level int)
func (*ServiceBrickModel) View ¶
func (s *ServiceBrickModel) View() string
type ServiceDependency ¶
type ServiceDependency struct {
Target *ManagedService
RestartWithTarget bool
WaitTargetStarted bool
}
type ServiceState ¶
type ServiceState int
const ( SERVICE_OFF ServiceState = iota SERVICE_STARTING SERVICE_FAILED_DEPENDENCY SERVICE_RUNNING SERVICE_ERROR )
Click to show internal directories.
Click to hide internal directories.