servstate

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StartupEnabled  = "enabled"
	StartupDisabled = "disabled"
)

Variables

This section is empty.

Functions

func Start

func Start(s *state.State, services []string) (*state.TaskSet, error)

Start creates and returns a task set for starting the given services.

func Stop

func Stop(s *state.State, services []string) (*state.TaskSet, error)

Stop creates and returns a task set for stopping the given services.

func StopRunning

func StopRunning(s *state.State, m *ServiceManager) (*state.TaskSet, error)

StopRunning creates and returns a task set for stopping all running services. It returns a nil *TaskSet if there are no services to stop.

Types

type LogManager

type LogManager interface {
	ServiceStarted(service *plan.Service, logs *servicelog.RingBuffer)
}

type Restarter

type Restarter interface {
	HandleRestart(t restart.RestartType)
}

type ServiceInfo

type ServiceInfo struct {
	Name         string
	Startup      ServiceStartup
	Current      ServiceStatus
	CurrentSince time.Time
}

type ServiceManager

type ServiceManager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(s *state.State, runner *state.TaskRunner, serviceOutput io.Writer, restarter Restarter, logMgr LogManager) (*ServiceManager, error)

func (*ServiceManager) CheckFailed

func (m *ServiceManager) CheckFailed(name string)

CheckFailed response to a health check failure. If the given check name is in the on-check-failure map for a service, tell the service to perform the configured action (for example, "restart").

func (*ServiceManager) DefaultServiceNames

func (m *ServiceManager) DefaultServiceNames() ([]string, error)

DefaultServiceNames returns the name of the services set to start by default.

func (*ServiceManager) Ensure

func (m *ServiceManager) Ensure() error

Ensure implements StateManager.Ensure.

func (*ServiceManager) PlanChanged added in v1.10.0

func (m *ServiceManager) PlanChanged(plan *plan.Plan)

PlanChanged informs the service manager that the plan has been updated.

func (*ServiceManager) Replan

func (m *ServiceManager) Replan() ([]string, []string, error)

Replan returns a list of services to stop and services to start because their plans had changed between when they started and this call.

func (*ServiceManager) SendSignal

func (m *ServiceManager) SendSignal(services []string, signal string) error

func (*ServiceManager) ServiceLogs

func (m *ServiceManager) ServiceLogs(services []string, last int) (map[string]servicelog.Iterator, error)

ServiceLogs returns iterators to the provided services. If last is negative, return tail iterators; if last is zero or positive, return head iterators going back last elements. Each iterator must be closed via the Close method.

func (*ServiceManager) Services

func (m *ServiceManager) Services(names []string) ([]*ServiceInfo, error)

Services returns the list of configured services and their status, sorted by service name. Filter by the specified service names if provided.

func (*ServiceManager) StartOrder

func (m *ServiceManager) StartOrder(services []string) ([]string, error)

StartOrder returns the provided services, together with any required dependencies, in the proper order for starting them all up.

func (*ServiceManager) Stop

func (m *ServiceManager) Stop()

Stop implements overlord.StateStopper and stops background functions.

func (*ServiceManager) StopOrder

func (m *ServiceManager) StopOrder(services []string) ([]string, error)

StopOrder returns the provided services, together with any dependants, in the proper order for stopping them all.

func (*ServiceManager) StopTimeout

func (m *ServiceManager) StopTimeout() time.Duration

StopTimeout returns the worst case duration that will have to be waited for to have all services in this manager stopped.

type ServiceRequest

type ServiceRequest struct {
	Name string
}

ServiceRequest holds the details required to perform service tasks.

func TaskServiceRequest

func TaskServiceRequest(task *state.Task) (*ServiceRequest, error)

TaskServiceRequest extracts the *ServiceRequest that was associated with the provided task when it was created, reflecting details of the operation requested.

type ServiceStartup

type ServiceStartup string

type ServiceStatus

type ServiceStatus string
const (
	StatusActive   ServiceStatus = "active"
	StatusBackoff  ServiceStatus = "backoff"
	StatusError    ServiceStatus = "error"
	StatusInactive ServiceStatus = "inactive"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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