Documentation
¶
Index ¶
- type LoggerProvider
- type ServiceInfo
- type ServiceStatus
- type Supervisor
- func (s *Supervisor) DisableCronJob(name string) error
- func (s *Supervisor) EnableCronJob(name string) error
- func (s *Supervisor) GetAllServiceStatuses() map[string]*ServiceInfo
- func (s *Supervisor) GetServiceStatus(name string) (*ServiceInfo, error)
- func (s *Supervisor) RestartService(name string) error
- func (s *Supervisor) SetLoggerProvider(provider LoggerProvider)
- func (s *Supervisor) Start() error
- func (s *Supervisor) StartService(name string) error
- func (s *Supervisor) Stop()
- func (s *Supervisor) StopService(name string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoggerProvider ¶
LoggerProvider is an interface for providing loggers for services
type ServiceInfo ¶
type ServiceInfo struct {
Name string
Status ServiceStatus
Pid int
Uptime time.Duration
StartTime time.Time
RestartCount int
NextRestart time.Time
NextRun time.Time
ExitCode int
Error string
Cmd *exec.Cmd
Process *os.Process
Config config.Process
// Resource usage
CpuPercent float64
MemoryUsage int64
LastUpdated time.Time
// Flag to indicate if the service was explicitly stopped
ExplicitlyStopped bool
}
ServiceInfo represents information about a service
type ServiceStatus ¶
type ServiceStatus string
ServiceStatus represents the status of a service
const ( StatusStopped ServiceStatus = "stopped" StatusRunning ServiceStatus = "running" StatusFailed ServiceStatus = "failed" StatusRestarting ServiceStatus = "restarting" StatusScheduled ServiceStatus = "scheduled" )
type Supervisor ¶
type Supervisor struct {
// contains filtered or unexported fields
}
Supervisor manages the lifecycle of services
func NewSupervisor ¶
NewSupervisor creates a new supervisor
func (*Supervisor) DisableCronJob ¶
func (s *Supervisor) DisableCronJob(name string) error
DisableCronJob disables a cron job
func (*Supervisor) EnableCronJob ¶
func (s *Supervisor) EnableCronJob(name string) error
EnableCronJob enables a cron job
func (*Supervisor) GetAllServiceStatuses ¶
func (s *Supervisor) GetAllServiceStatuses() map[string]*ServiceInfo
GetAllServiceStatuses returns the status of all services
func (*Supervisor) GetServiceStatus ¶
func (s *Supervisor) GetServiceStatus(name string) (*ServiceInfo, error)
GetServiceStatus returns the status of a service
func (*Supervisor) RestartService ¶
func (s *Supervisor) RestartService(name string) error
RestartService restarts a service
func (*Supervisor) SetLoggerProvider ¶
func (s *Supervisor) SetLoggerProvider(provider LoggerProvider)
SetLoggerProvider sets the logger provider for the supervisor
func (*Supervisor) StartService ¶
func (s *Supervisor) StartService(name string) error
StartService starts a service
func (*Supervisor) StopService ¶
func (s *Supervisor) StopService(name string) error
StopService stops a service
Click to show internal directories.
Click to hide internal directories.