servicemgmt

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

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 StartServiceManagement(confPath string) error

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

func (*ManagedService) Restart

func (s *ManagedService) Restart(baseCtx context.Context, appOnly bool, outputWidth, outputHeight int)

Kill the service properly, then run the start sequence

func (*ManagedService) Start

func (s *ManagedService) Start(baseCtx context.Context, outputWidth, outputHeight int)

This method starts all dependencies, waits for them to be up, then starts the service and returns Be careful since this can block the routine for a while when waiting

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
)

Jump to

Keyboard shortcuts

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